share/hedgewars/Data/Missions/Training/User_Mission_-_Diver.lua
changeset 4662 63aafc9c2a81
child 4674 6c9d96d06800
equal deleted inserted replaced
4661:f5d858e4b634 4662:63aafc9c2a81
       
     1 
       
     2 loadfile(GetDataPath() .. "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 
       
    24 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
       
    25 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
       
    26 			
       
    27 	AddTeam(loc("Toxic Team"), 	1175851, "Simple", "Island", "Default")
       
    28 	enemy = AddHog(loc("Poison"), 1, 100, "Skull")
       
    29 
       
    30 	SetGearPosition(player, 1454, 1540)
       
    31 	SetGearPosition(enemy, 2488, 1960)
       
    32 
       
    33 end
       
    34 
       
    35 
       
    36 function onGameStart()
       
    37 
       
    38 
       
    39 	SpawnAmmoCrate(1450,1910,amJetpack)
       
    40 	SpawnAmmoCrate(2568,1714,amFirePunch)
       
    41 	SpawnAmmoCrate(1974,1875,amBlowTorch)
       
    42 	SpawnAmmoCrate(2056,1877,amParachute)
       
    43 
       
    44 	AddGear(1603, 1320, gtMine, 0, 0, 0, 0)
       
    45 
       
    46 	ShowMission(loc("Operation Diver"), loc("by mikade"), loc("Eliminate Poison before the time runs out"), -amFirePunch, 0);
       
    47 	--SetTag(AddGear(0, 0, gtATSmoothWindCh, 0, 0, 0, 1), -70)
       
    48 
       
    49 	SetWind(-100)
       
    50 
       
    51 end
       
    52 
       
    53 
       
    54 function onGameTick()
       
    55 
       
    56 
       
    57 	if (TotalRounds == 3) and (GameOver == false) then
       
    58 		SetHealth(player, 0)
       
    59 		GameOver = true
       
    60 	end
       
    61 
       
    62 	if TurnTimeLeft == 1 then
       
    63 		SetHealth(player, 0)
       
    64 		GameOver = true
       
    65 	end
       
    66 
       
    67 end
       
    68 
       
    69 
       
    70 function onAmmoStoreInit()
       
    71 	SetAmmo(amFirePunch, 1, 0, 0, 1)
       
    72 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
    73 	SetAmmo(amGirder, 1, 0, 0, 0)
       
    74 	SetAmmo(amParachute, 0, 0, 0, 1)
       
    75 	SetAmmo(amJetpack, 0, 0, 0, 1)
       
    76 end
       
    77 
       
    78 
       
    79 function onGearAdd(gear)
       
    80 
       
    81 	if GetGearType(gear) == gtJetpack then
       
    82 		SetHealth(gear,1000)
       
    83 	end
       
    84 
       
    85 end
       
    86 
       
    87 function onGearDelete(gear)
       
    88 
       
    89 	if (gear == enemy) and (GameOver == false) then
       
    90 		ShowMission(loc("Operation Diver"), loc("MISSION SUCCESS"), loc("Congratulations!"), 0, 0)
       
    91 	elseif gear == player then
       
    92 		ShowMission(loc("Operation Diver"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)		
       
    93 		GameOver = true
       
    94 	end
       
    95 
       
    96 end