share/hedgewars/Data/Missions/Scenario/User_Mission_-_Teamwork.lua
changeset 11973 1de4d6b35748
parent 8043 da083f8d95e6
child 12054 030464f34d47
equal deleted inserted replaced
11972:7dd85fe00de3 11973:1de4d6b35748
       
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
     2 
       
     3 local player = nil -- This variable will point to the hog's gear
       
     4 local p2 = nil
       
     5 local enemy = nil
       
     6 local bCrate = nil
       
     7 
       
     8 local GameOver = false
       
     9 
       
    10 function onGameInit()
       
    11 
       
    12 	-- Things we don't modify here will use their default values.
       
    13 	Seed = 0 -- The base number for the random number generator
       
    14 	GameFlags = gfDisableWind-- Game settings and rules
       
    15 	TurnTime = 30000 -- The time the player has to move each round (in ms)
       
    16 	CaseFreq = 0 -- The frequency of crate drops
       
    17 	MinesNum = 0 -- The number of mines being placed
       
    18 	MinesTime  = 1
       
    19 	Explosives = 0 -- The number of explosives being placed
       
    20 	Delay = 10 -- The delay between each round
       
    21 	Map = "Mushrooms" -- The map to be played
       
    22 	Theme = "Nature" -- The theme to be used
       
    23 	SuddenDeathTurns = 99999
       
    24 
       
    25 	AddTeam(loc("Feeble Resistance"), 14483456, "Simple", "Island", "Default")
       
    26 	player = AddHog(string.format(loc("Pathetic Hog #%d"), 1), 0, 50, "NoHat")
       
    27 	p2 = AddHog(string.format(loc("Pathetic Hog #%d"), 2), 0, 20, "NoHat")
       
    28 
       
    29 	--AddTeam("Toxic Team", 	1175851, "Simple", "Island", "Robot","cm_binary")
       
    30 	AddTeam(loc("Cybernetic Empire"), 	1175851, "Simple", "Island", "Robot", "cm_binary")
       
    31 	enemy = AddHog(loc("Unit 3378"), 5, 30, "cyborg1")
       
    32 
       
    33 	SetGearPosition(player,1403,235)
       
    34 	SetGearPosition(p2,1269,239)
       
    35 	SetGearPosition(enemy,492,495)
       
    36 
       
    37 end
       
    38 
       
    39 
       
    40 function onGameStart()
       
    41 
       
    42 	--mines
       
    43 	AddGear(276,76,gtMine, 0, 0, 0, 0)
       
    44 	AddGear(301,76,gtMine, 0, 0, 0, 0)
       
    45 	AddGear(326,76,gtMine, 0, 0, 0, 0)
       
    46 	AddGear(351,76,gtMine, 0, 0, 0, 0)
       
    47 	AddGear(376,76,gtMine, 0, 0, 0, 0)
       
    48 	AddGear(401,76,gtMine, 0, 0, 0, 0)
       
    49 	AddGear(426,76,gtMine, 0, 0, 0, 0)
       
    50 	AddGear(451,76,gtMine, 0, 0, 0, 0)
       
    51 	AddGear(476,76,gtMine, 0, 0, 0, 0)
       
    52 
       
    53 	AddGear(886,356,gtMine, 0, 0, 0, 0)
       
    54 	AddGear(901,356,gtMine, 0, 0, 0, 0)
       
    55 	AddGear(926,356,gtMine, 0, 0, 0, 0)
       
    56 	AddGear(951,356,gtMine, 0, 0, 0, 0)
       
    57 	AddGear(976,356,gtMine, 0, 0, 0, 0)
       
    58 	AddGear(1001,356,gtMine, 0, 0, 0, 0)
       
    59 
       
    60 	-- crates crates and more crates
       
    61 	bCrate = SpawnAmmoCrate(1688,476,amBaseballBat)
       
    62 	SpawnUtilityCrate(572,143,amGirder)
       
    63 	SpawnAmmoCrate(1704,954,amPickHammer)
       
    64 	SpawnAmmoCrate(704,623,amBlowTorch)
       
    65 	SpawnUtilityCrate(1543,744,amJetpack)
       
    66 	SpawnAmmoCrate(227,442,amDrill)
       
    67 
       
    68 	ShowMission(loc("Codename: Teamwork"), "", loc("- Eliminate Unit 3378 |- Feeble Resistance must survive") .. loc("|- Mines Time:") .. " " .. 0 .. " " .. loc("sec"), 0, 0)
       
    69 
       
    70 end
       
    71 
       
    72 
       
    73 --function onGameTick()
       
    74 
       
    75 	--if CurrentHedgehog ~= nil then
       
    76 	--	AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog))
       
    77 	--end
       
    78 
       
    79 --end
       
    80 
       
    81 
       
    82 function onAmmoStoreInit()
       
    83 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
    84 	SetAmmo(amGirder, 0, 0, 0, 1)
       
    85 	SetAmmo(amPickHammer, 0, 0, 0, 2)
       
    86 	SetAmmo(amJetpack, 0, 0, 0, 1)
       
    87 	SetAmmo(amDrill, 0, 0, 0, 2)
       
    88 	SetAmmo(amBaseballBat, 0, 0, 0, 1)
       
    89 	SetAmmo(amSwitch, 9, 0, 0, 0)
       
    90 	SetAmmo(amSkip, 9, 0, 0, 0)
       
    91 end
       
    92 
       
    93 function onGearDamage(gear, damage)
       
    94 	if (gear == player) and (damage == 30) then
       
    95 		HogSay(player,loc("T_T"),SAY_SHOUT)
       
    96 	end
       
    97 end
       
    98 
       
    99 function onGearDelete(gear)
       
   100 
       
   101 	if gear == bCrate then
       
   102 		HogSay(CurrentHedgehog, loc("Hmmm..."), SAY_THINK)
       
   103 	end
       
   104 
       
   105 	if GetGearType(gear) == gtCase then
       
   106 		TurnTimeLeft = TurnTimeLeft + 5000
       
   107 	end
       
   108 
       
   109 	if (gear == enemy) and (GameOver == false) then
       
   110 		ShowMission(loc("Codename: Teamwork"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
       
   111 		GameOver = true
       
   112 	elseif  ( ((gear == player) or (gear == p2)) and (GameOver == false)) then
       
   113 		ShowMission(loc("Codename: Teamwork"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
       
   114 		GameOver = true
       
   115 		SetHealth(p2,0)
       
   116 		SetHealth(player,0)
       
   117 	end
       
   118 
       
   119 end