share/hedgewars/Data/Missions/Training/User_Mission_-_Spooky_Tree.lua
changeset 4662 63aafc9c2a81
child 4674 6c9d96d06800
equal deleted inserted replaced
4661:f5d858e4b634 4662:63aafc9c2a81
       
     1 
       
     2 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
       
     3 
       
     4 ---------------------------------------------------------------
       
     5 
       
     6 local player = nil -- This variable will point to the hog's gear
       
     7 local instructor = nil
       
     8 local enemy = nil
       
     9 
       
    10 local GameOver = false
       
    11 local birdSpeech = false
       
    12 local birdSqualk = false
       
    13 
       
    14 local GirderCrate = nil
       
    15 
       
    16 function onGameInit()
       
    17 
       
    18 	-- Things we don't modify here will use their default values.
       
    19 	Seed = 0 -- The base number for the random number generator
       
    20 	GameFlags = gfInfAttack +gfDisableWind-- Game settings and rules
       
    21 	TurnTime = 90000 -- The time the player has to move each round (in ms)
       
    22 	CaseFreq = 0 -- The frequency of crate drops
       
    23 	MinesNum = 0 -- The number of mines being placed
       
    24 	MinesTime  = 1
       
    25 	Explosives = 0 -- The number of explosives being placed
       
    26 	Delay = 10 -- The delay between each round
       
    27 	Map = "Tree" -- The map to be played
       
    28 	Theme = "Halloween" -- The theme to be used
       
    29 
       
    30 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
       
    31 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
       
    32 			--852718
       
    33 	AddTeam(loc("Toxic Team"), 	1175851, "Simple", "Island", "Default")
       
    34 	enemy = AddHog(loc("Poison"), 1, 10, "Skull")
       
    35 
       
    36 	SetGearPosition(player, 1994, 1047)
       
    37 	SetGearPosition(enemy, 1522, 1830)
       
    38 
       
    39 end
       
    40 
       
    41 
       
    42 function onGameStart()
       
    43 
       
    44 	--right side mines
       
    45 	AddGear(2705, 1383, gtMine, 0, 0, 0, 0)
       
    46 	AddGear(2742, 1542, gtMine, 0, 0, 0, 0)
       
    47 	AddGear(2672, 1551, gtMine, 0, 0, 0, 0)
       
    48 	AddGear(2608, 1546, gtMine, 0, 0, 0, 0)
       
    49 
       
    50 	--tunnel mines
       
    51 	AddGear(1325, 1593, gtSMine, 0, 0, 0, 0)
       
    52 	AddGear(1396, 1632, gtSMine, 0, 0, 0, 0)
       
    53 	AddGear(1477, 1652, gtSMine, 0, 0, 0, 0)
       
    54 	AddGear(1548, 1635, gtSMine, 0, 0, 0, 0)
       
    55 	AddGear(1637, 1635, gtSMine, 0, 0, 0, 0)
       
    56 
       
    57 	AddGear(1332, 1510, gtSMine, 0, 0, 0, 0)
       
    58 	AddGear(1396, 1502, gtSMine, 0, 0, 0, 0)
       
    59 	AddGear(1477, 1490, gtSMine, 0, 0, 0, 0)
       
    60 	AddGear(1548, 1495, gtSMine, 0, 0, 0, 0)
       
    61 	AddGear(1637, 1490, gtSMine, 0, 0, 0, 0)
       
    62 
       
    63 	--above the tunnel mines
       
    64 	AddGear(1355, 1457, gtMine, 0, 0, 0, 0)
       
    65 	AddGear(1428, 1444, gtMine, 0, 0, 0, 0)
       
    66 	AddGear(1508, 1448, gtMine, 0, 0, 0, 0)
       
    67 	AddGear(1586, 1441, gtMine, 0, 0, 0, 0)
       
    68 	AddGear(1664, 1436, gtMine, 0, 0, 0, 0)
       
    69 
       
    70 	-- crates crates and more crates
       
    71 	SpawnAmmoCrate(2232,1600,amBlowTorch)
       
    72 	SpawnAmmoCrate(2491,1400,amPickHammer)
       
    73 	SpawnUtilityCrate(1397,1189,amGirder)
       
    74 	SpawnUtilityCrate(1728,1647,amJetpack)
       
    75 	SpawnUtilityCrate(2670,1773,amLaserSight)
       
    76 
       
    77 	SpawnAmmoCrate(1769,1442,amShotgun) --shotgun1
       
    78 	SpawnAmmoCrate(1857,1456,amFirePunch) --fire punch
       
    79 	GirderCrate = SpawnAmmoCrate(2813,1538,amShotgun) -- final shotgun
       
    80 	SpawnAmmoCrate(2205,1443,amBee)
       
    81 
       
    82 	ShowMission(loc("Spooky Tree"), loc("by mikade"), loc("Eliminate all enemies"), -amBee, 0);
       
    83 
       
    84 	SetWind(-75)
       
    85 
       
    86 end
       
    87 
       
    88 
       
    89 function onGameTick()
       
    90 
       
    91 
       
    92 	if CurrentHedgehog ~= nil then
       
    93 
       
    94 		if (birdSqualk == false) and (GetX(CurrentHedgehog) == 2126) and (GetY(CurrentHedgehog) == 1157)  then
       
    95 			birdSqualk = true
       
    96 			PlaySound(sndBirdyLay)
       
    97 		end
       
    98 
       
    99 		if (birdSpeech == false) and (GetX(CurrentHedgehog) == 2092) and (GetY(CurrentHedgehog) == 1186) then
       
   100 			birdSpeech = true
       
   101 			HogSay(player,loc("Good birdy......"),SAY_THINK)
       
   102 		end
       
   103 	end
       
   104 
       
   105 	if CurrentHedgehog ~= nil then
       
   106 		--AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog))
       
   107 	end
       
   108 
       
   109 	if (TotalRounds == 2) and (GameOver == false) then -- just in case
       
   110 		SetHealth(player, 0)
       
   111 		GameOver = true
       
   112 	end
       
   113 
       
   114 	if TurnTimeLeft == 1 then
       
   115 		--ShowMission(loc(caption), loc(subcaption), loc(timeout), -amSkip, 0);
       
   116 		SetHealth(player, 0)
       
   117 		GameOver = true
       
   118 	end
       
   119 
       
   120 end
       
   121 
       
   122 
       
   123 function onAmmoStoreInit()
       
   124 	SetAmmo(amShotgun, 0, 0, 0, 1)
       
   125 	SetAmmo(amFirePunch, 0, 0, 0, 1)
       
   126 	SetAmmo(amBee, 0, 0, 0, 1)
       
   127 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
   128 	SetAmmo(amGirder, 0, 0, 0, 1)
       
   129 	SetAmmo(amParachute, 1, 0, 0, 1)
       
   130 	SetAmmo(amPickHammer, 0, 0, 0, 1)
       
   131 	SetAmmo(amJetpack, 0, 0, 0, 1)
       
   132 	SetAmmo(amLaserSight, 0, 0, 0, 1)
       
   133 end
       
   134 
       
   135 function onGearDelete(gear)
       
   136 
       
   137 	if gear == GirderCrate then
       
   138 		TurnTimeLeft = TurnTimeLeft + 30000
       
   139 	end
       
   140 
       
   141 	if GetGearType(gear) == gtCase then
       
   142 		TurnTimeLeft = TurnTimeLeft + 5000
       
   143 	end
       
   144 
       
   145 	if (gear == enemy) and (GameOver == false) then
       
   146 		ShowMission(loc("Spooky Tree"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0);
       
   147 	elseif gear == player then
       
   148 		ShowMission(loc("Spooky Tree"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
       
   149 		GameOver = true
       
   150 	end
       
   151 
       
   152 end