share/hedgewars/Data/Missions/Training/User_Mission_-_Diver.lua
changeset 11968 1de4d6b35748
parent 11967 7dd85fe00de3
child 11969 7718ebf8cf14
equal deleted inserted replaced
11967:7dd85fe00de3 11968:1de4d6b35748
     1 
       
     2 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
     3 
       
     4 local player = nil -- This variable will point to the hog's gear
       
     5 local enemy = nil
       
     6 
       
     7 local GameOver = false
       
     8 
       
     9 function onGameInit()
       
    10 
       
    11 	-- Things we don't modify here will use their default values.
       
    12 
       
    13 	Seed = 0 -- The base number for the random number generator
       
    14 	GameFlags = gfInfAttack + gfDisableWind-- Game settings and rules
       
    15 	TurnTime = 90000 -- 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  = 1000
       
    19 	Explosives = 0 -- The number of explosives being placed
       
    20 	Delay = 10 -- The delay between each round
       
    21 	Map = "Hydrant" -- The map to be played
       
    22 	Theme = "City" -- The theme to be used
       
    23 	SuddenDeathTurns = 99999
       
    24 
       
    25 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
       
    26 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
       
    27 			
       
    28 	AddTeam(loc("Toxic Team"), 	1175851, "Simple", "Island", "Default")
       
    29 	enemy = AddHog(loc("Poison"), 1, 100, "Skull")
       
    30 
       
    31 	SetGearPosition(player,430,516)
       
    32 	SetGearPosition(enemy,1464,936)
       
    33 
       
    34 end
       
    35 
       
    36 
       
    37 function onGameStart()
       
    38 
       
    39 
       
    40 	SpawnAmmoCrate(426,886,amJetpack)
       
    41 	SpawnAmmoCrate(1544,690,amFirePunch)
       
    42 	SpawnAmmoCrate(950,851,amBlowTorch)
       
    43 	SpawnAmmoCrate(1032,853,amParachute)
       
    44 
       
    45 	AddGear(579, 296, gtMine, 0, 0, 0, 0)
       
    46 
       
    47 	ShowMission(loc("Operation Diver"), "", loc("Eliminate Poison before the time runs out") .. loc("|- Mines Time:") .. " " .. 1 .. " " .. loc("sec"), -amFirePunch, 0);
       
    48 	--SetTag(AddGear(0, 0, gtATSmoothWindCh, 0, 0, 0, 1), -70)
       
    49 
       
    50 	SetWind(-100)
       
    51 
       
    52 end
       
    53 
       
    54 
       
    55 function onGameTick()
       
    56 
       
    57 
       
    58 	if (TotalRounds == 3) and (GameOver == false) then
       
    59 		SetHealth(player, 0)
       
    60 		GameOver = true
       
    61 	end
       
    62 
       
    63 	if TurnTimeLeft == 1 then
       
    64 		SetHealth(player, 0)
       
    65 		GameOver = true
       
    66 	end
       
    67 
       
    68 end
       
    69 
       
    70 
       
    71 function onAmmoStoreInit()
       
    72 	SetAmmo(amFirePunch, 1, 0, 0, 1)
       
    73 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
    74 	SetAmmo(amGirder, 1, 0, 0, 0)
       
    75 	SetAmmo(amParachute, 0, 0, 0, 1)
       
    76 	SetAmmo(amJetpack, 0, 0, 0, 1)
       
    77 end
       
    78 
       
    79 
       
    80 function onGearAdd(gear)
       
    81 
       
    82 	if GetGearType(gear) == gtJetpack then
       
    83 		SetHealth(gear,1000)
       
    84 	end
       
    85 
       
    86 end
       
    87 
       
    88 function onGearDelete(gear)
       
    89 
       
    90 	if (gear == enemy) and (GameOver == false) then
       
    91 		ShowMission(loc("Operation Diver"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
       
    92 	elseif gear == player then
       
    93 		ShowMission(loc("Operation Diver"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)		
       
    94 		GameOver = true
       
    95 	end
       
    96 
       
    97 end