share/hedgewars/Data/Missions/Training/User_Mission_-_Spooky_Tree.lua
branchqmlfrontend
changeset 12855 1b2b84315d27
parent 11843 01f88c3b7b66
parent 12854 28cb18c5e712
child 12856 95d903b976d0
equal deleted inserted replaced
11843:01f88c3b7b66 12855:1b2b84315d27
     1 
       
     2 HedgewarsScriptLoad("/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 	SuddenDeathTurns = 99999
       
    30 
       
    31 	AddTeam(loc("Bloody Rookies"), 14483456, "Simple", "Island", "Default")
       
    32 	player = AddHog(loc("Hunter"), 0, 1, "NoHat")
       
    33 			--852718
       
    34 	AddTeam(loc("Toxic Team"), 	1175851, "Simple", "Island", "Default")
       
    35 	enemy = AddHog(loc("Poison"), 1, 10, "Skull")
       
    36 
       
    37 	SetGearPosition(player,970,23)
       
    38 	SetGearPosition(enemy,498,806)
       
    39 
       
    40 end
       
    41 
       
    42 
       
    43 function onGameStart()
       
    44 
       
    45 	--right side mines
       
    46 	AddGear(1681,359,gtMine, 0, 0, 0, 0)
       
    47 	AddGear(1718,518,gtMine, 0, 0, 0, 0)
       
    48 	AddGear(1648,527,gtMine, 0, 0, 0, 0)
       
    49 	AddGear(1584,522,gtMine, 0, 0, 0, 0)
       
    50 
       
    51 	--tunnel mines
       
    52 	AddGear(301,569,gtSMine, 0, 0, 0, 0)
       
    53 	AddGear(372,608,gtSMine, 0, 0, 0, 0)
       
    54 	AddGear(453,628,gtSMine, 0, 0, 0, 0)
       
    55 	AddGear(524,611,gtSMine, 0, 0, 0, 0)
       
    56 	AddGear(613,611,gtSMine, 0, 0, 0, 0)
       
    57 
       
    58 	AddGear(308,486,gtSMine, 0, 0, 0, 0)
       
    59 	AddGear(372,478,gtSMine, 0, 0, 0, 0)
       
    60 	AddGear(453,466,gtSMine, 0, 0, 0, 0)
       
    61 	AddGear(524,471,gtSMine, 0, 0, 0, 0)
       
    62 	AddGear(613,466,gtSMine, 0, 0, 0, 0)
       
    63 
       
    64 	--above the tunnel mines
       
    65 	AddGear(331,433,gtMine, 0, 0, 0, 0)
       
    66 	AddGear(404,420,gtMine, 0, 0, 0, 0)
       
    67 	AddGear(484,424,gtMine, 0, 0, 0, 0)
       
    68 	AddGear(562,417,gtMine, 0, 0, 0, 0)
       
    69 	AddGear(640,412,gtMine, 0, 0, 0, 0)
       
    70 
       
    71 	-- crates crates and more crates
       
    72 	SpawnAmmoCrate(1208,576,amBlowTorch)
       
    73 	SpawnAmmoCrate(1467,376,amPickHammer)
       
    74 	SpawnUtilityCrate(373,165,amGirder)
       
    75 	SpawnUtilityCrate(704,623,amJetpack)
       
    76 	SpawnUtilityCrate(1646,749,amLaserSight)
       
    77 
       
    78 	SpawnAmmoCrate(745,418,amShotgun) --shotgun1
       
    79 	SpawnAmmoCrate(833,432,amFirePunch) --fire punch
       
    80 	GirderCrate = SpawnAmmoCrate(1789,514,amShotgun) -- final shotgun
       
    81 	SpawnAmmoCrate(1181,419,amBee)
       
    82 
       
    83 	ShowMission(loc("Spooky Tree"), "", loc("Eliminate all enemies") .. loc("|- Mines Time:") .. " " .. 0 .. " " .. loc("sec"), -amBee, 0)
       
    84 
       
    85 	SetWind(-75)
       
    86 
       
    87 end
       
    88 
       
    89 
       
    90 function onGameTick()
       
    91 
       
    92 
       
    93 	if CurrentHedgehog ~= nil then
       
    94 
       
    95 		if (birdSqualk == false) and (GetX(CurrentHedgehog) == 1102) and (GetY(CurrentHedgehog) == 133)  then
       
    96 			birdSqualk = true
       
    97 			PlaySound(sndBirdyLay)
       
    98 		end
       
    99 
       
   100 		if (birdSpeech == false) and (GetX(CurrentHedgehog) == 1068) and (GetY(CurrentHedgehog) == 162) then
       
   101 			birdSpeech = true
       
   102 			HogSay(player,loc("Good birdy......"),SAY_THINK)
       
   103 		end
       
   104 	end
       
   105 
       
   106 	if CurrentHedgehog ~= nil then
       
   107 		--AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog))
       
   108 	end
       
   109 
       
   110 	if (TotalRounds == 2) and (GameOver == false) then -- just in case
       
   111 		SetHealth(player, 0)
       
   112 		GameOver = true
       
   113 	end
       
   114 
       
   115 	if TurnTimeLeft == 1 then
       
   116 		--ShowMission(loc(caption), loc(subcaption), loc(timeout), -amSkip, 0);
       
   117 		SetHealth(player, 0)
       
   118 		GameOver = true
       
   119 	end
       
   120 
       
   121 end
       
   122 
       
   123 
       
   124 function onAmmoStoreInit()
       
   125 	SetAmmo(amShotgun, 0, 0, 0, 1)
       
   126 	SetAmmo(amFirePunch, 0, 0, 0, 1)
       
   127 	SetAmmo(amBee, 0, 0, 0, 1)
       
   128 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
   129 	SetAmmo(amGirder, 0, 0, 0, 1)
       
   130 	SetAmmo(amParachute, 1, 0, 0, 1)
       
   131 	SetAmmo(amPickHammer, 0, 0, 0, 1)
       
   132 	SetAmmo(amJetpack, 0, 0, 0, 1)
       
   133 	SetAmmo(amLaserSight, 0, 0, 0, 1)
       
   134 end
       
   135 
       
   136 function onGearDelete(gear)
       
   137 
       
   138 	if gear == GirderCrate then
       
   139 		TurnTimeLeft = TurnTimeLeft + 30000
       
   140 	end
       
   141 
       
   142 	if GetGearType(gear) == gtCase then
       
   143 		TurnTimeLeft = TurnTimeLeft + 5000
       
   144 	end
       
   145 
       
   146 	if (gear == enemy) and (GameOver == false) then
       
   147 		ShowMission(loc("Spooky Tree"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0);
       
   148 	elseif gear == player then
       
   149 		ShowMission(loc("Spooky Tree"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
       
   150 		GameOver = true
       
   151 	end
       
   152 
       
   153 end