share/hedgewars/Data/Missions/Training/portal.lua
changeset 11676 7180ddb4bf5b
parent 11671 51c4ea6d7f91
equal deleted inserted replaced
11675:8efe91eae41e 11676:7180ddb4bf5b
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Utils.lua")
     2 HedgewarsScriptLoad("/Scripts/Utils.lua")
     3 
     3 
     4 local MineArray = {}
     4 local MineArray = {}
     5 local player 
     5 local player
     6 local adviceGiven = false
     6 local adviceGiven = false
     7 local adviceGiven2 = false
     7 local adviceGiven2 = false
     8 
     8 
     9 function onGameInit()
     9 function onGameInit()
    10 	Seed = 0 -- The base number for the random number generator
    10 	Seed = 0 -- The base number for the random number generator
    11 	GameFlags = gfInfAttack +gfBorder +gfDisableWind +gfSolidLand 
    11 	GameFlags = gfInfAttack +gfBorder +gfDisableWind +gfSolidLand
    12 	TurnTime = 1500000 -- The time the player has to move each round (in ms)
    12 	TurnTime = 1500000 -- The time the player has to move each round (in ms)
    13 	CaseFreq = 0 -- The frequency of crate drops
    13 	CaseFreq = 0 -- The frequency of crate drops
    14 	MinesNum = 0 -- The number of mines being placed
    14 	MinesNum = 0 -- The number of mines being placed
    15 	Explosives = 0 -- The number of explosives being placed
    15 	Explosives = 0 -- The number of explosives being placed
    16 	Delay = 10 -- The delay between each round
    16 	Delay = 10 -- The delay between each round
    17 	Map = "portal" -- The map to be played
    17 	Map = "portal" -- The map to be played
    18 	Theme = "Hell" -- The theme to be used
    18 	Theme = "Hell" -- The theme to be used
    19 	-- Disable Sudden Death
    19 	-- Disable Sudden Death
    20 	HealthDecrease = 0
    20 	HealthDecrease = 0
    21 	WaterRise = 0
    21 	WaterRise = 0
    22 	
    22 
    23 	AddTeam(loc("Subjects"), 0xFFFF01, "Simple", "Island", "Default", "cm_test")
    23 	AddTeam(loc("Subjects"), 0xFFFF01, "Simple", "Island", "Default", "cm_test")
    24 	player = AddHog(loc("Subject 1"), 0, 10, "Terminator_Glasses")
    24 	player = AddHog(loc("Subject 1"), 0, 10, "Terminator_Glasses")
    25 
    25 
    26 	AddTeam(loc("Hell Army"), 0xFF0402, "skull", "Island", "Default", "cm_hellish")
    26 	AddTeam(loc("Hell Army"), 0xFF0402, "skull", "Island", "Default", "cm_hellish")
    27 	enemy1 = AddHog(loc("Lucifer"), 1, 200, "InfernalHorns")
    27 	enemy1 = AddHog(loc("Lucifer"), 1, 200, "InfernalHorns")
   134 	SpawnUtilityCrate(1820, 567, amBlowTorch)
   134 	SpawnUtilityCrate(1820, 567, amBlowTorch)
   135 	SpawnUtilityCrate(1375, 900, amTeleport)
   135 	SpawnUtilityCrate(1375, 900, amTeleport)
   136 	SpawnUtilityCrate(130, 600, amPickHammer)
   136 	SpawnUtilityCrate(130, 600, amPickHammer)
   137 	SpawnUtilityCrate(1660,1820, amLaserSight)
   137 	SpawnUtilityCrate(1660,1820, amLaserSight)
   138 	SpawnUtilityCrate(4070,1840, amLaserSight)
   138 	SpawnUtilityCrate(4070,1840, amLaserSight)
   139 	
   139 
   140 	
   140 
   141 	--AMMO CRATE--
   141 	--AMMO CRATE--
   142 	portalgun = SpawnAmmoCrate(505, 1943, amPortalGun, 1000)
   142 	portalgun = SpawnAmmoCrate(505, 1943, amPortalGun, 1000)
   143 	extratime = SpawnAmmoCrate(4020, 785, amExtraTime, 2)
   143 	extratime = SpawnAmmoCrate(4020, 785, amExtraTime, 2)
   144 	SpawnAmmoCrate(425, 613, amSnowball)
   144 	SpawnAmmoCrate(425, 613, amSnowball)
   145 	SpawnAmmoCrate(861, 633, amHellishBomb)
   145 	SpawnAmmoCrate(861, 633, amHellishBomb)
   151 	SpawnAmmoCrate(2900, 1400, amRope)
   151 	SpawnAmmoCrate(2900, 1400, amRope)
   152 	SpawnAmmoCrate(4025, 1117, amFirePunch)
   152 	SpawnAmmoCrate(4025, 1117, amFirePunch)
   153 
   153 
   154 	--HEALTH CRATE--
   154 	--HEALTH CRATE--
   155 	SpawnHealthCrate(2000, 780)
   155 	SpawnHealthCrate(2000, 780)
   156 	
   156 
   157 	--GIRDER--
   157 	--GIRDER--
   158 	PlaceGirder(3363, 1323, 4)
   158 	PlaceGirder(3363, 1323, 4)
   159 
   159 
   160 	ShowMission (loc("Portal Mind Challenge"), loc("Mission"), 
   160 	ShowMission (loc("Portal Mind Challenge"), loc("Mission"),
   161 		loc("Defeat all enemies!") .. "|" .. loc("In this mission you have infinite time."),
   161 		loc("Defeat all enemies!") .. "|" .. loc("In this mission you have infinite time."),
   162 		-amPortalGun, 5000)
   162 		-amPortalGun, 5000)
   163 	HogSay(player, loc("I should get myself a portal device, maybe this crate has one."), SAY_THINK)
   163 	HogSay(player, loc("I should get myself a portal device, maybe this crate has one."), SAY_THINK)
   164 	
   164 
   165 end
   165 end
   166 
   166 
   167 function onGameTick()
   167 function onGameTick()
   168 
   168 
   169 	if (player ~= nil)  then
   169 	if (player ~= nil)  then
   173 		elseif (gearIsInBox(player, 2960, 790, 200, 60) and (adviceGiven2 == false)) then
   173 		elseif (gearIsInBox(player, 2960, 790, 200, 60) and (adviceGiven2 == false)) then
   174 			adviceGiven2 = true
   174 			adviceGiven2 = true
   175 			HogSay(player, loc("The anti-portal surface is all over the floor, and I have nothing to kill him. Dropping something could hurt him enough to kill him."), SAY_THINK)
   175 			HogSay(player, loc("The anti-portal surface is all over the floor, and I have nothing to kill him. Dropping something could hurt him enough to kill him."), SAY_THINK)
   176 		end
   176 		end
   177 	end
   177 	end
   178 	
   178 
   179 end
   179 end
   180 	
   180 
   181 function onGearDelete(gear)
   181 function onGearDelete(gear)
   182 	-- Check gear collection
   182 	-- Check gear collection
   183 	if CurrentHedgehog == player and (band(GetGearMessage(gear), gmDestroy) ~= 0) then
   183 	if CurrentHedgehog == player and (band(GetGearMessage(gear), gmDestroy) ~= 0) then
   184 		if gear == portalgun then
   184 		if gear == portalgun then
   185 			HogSay(player, loc("Great! Let’s kill all these enemies, using portals."), SAY_THINK)
   185 			HogSay(player, loc("Great! Let’s kill all these enemies, using portals."), SAY_THINK)
   186 		end
   186 		end
   187 
   187 
   188 		if gear == girder then 
   188 		if gear == girder then
   189 			HogSay(player, loc("This will be useful when I need a new platform or if I want to rise."), SAY_THINK)
   189 			HogSay(player, loc("This will be useful when I need a new platform or if I want to rise."), SAY_THINK)
   190 		end
   190 		end
   191 	
   191 
   192 		if gear == parachute then
   192 		if gear == parachute then
   193 			HogSay(player, loc("You can’t open a portal on the blue surface."), SAY_THINK)
   193 			HogSay(player, loc("You can’t open a portal on the blue surface."), SAY_THINK)
   194 		end
   194 		end
   195 
   195 
   196 		if gear == extratime then
   196 		if gear == extratime then