share/hedgewars/Data/Missions/Training/portal.lua
branch0.9.18
changeset 7904 4f338a9ea76d
child 8043 da083f8d95e6
equal deleted inserted replaced
7903:e0d21677b00f 7904:4f338a9ea76d
       
     1 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
       
     2 loadfile(GetDataPath() .. "Scripts/Utils.lua")()
       
     3 
       
     4 local MineArray = {}
       
     5 local player 
       
     6 local adviceGiven = false
       
     7 local adviceGiven2 = false
       
     8 
       
     9 function onGameInit()
       
    10 	Seed = 0 -- The base number for the random number generator
       
    11 	GameFlags = gfInfAttack +gfBorder +gfDisableWind +gfSolidLand 
       
    12 	TurnTime = 1500000 -- The time the player has to move each round (in ms)
       
    13 	CaseFreq = 0 -- The frequency of crate drops
       
    14 	MinesNum = 0 -- The number of mines being placed
       
    15 	Explosives = 0 -- The number of explosives being placed
       
    16 	Delay = 10 -- The delay between each round
       
    17 	Map = "portal" -- The map to be played
       
    18 	Theme = "Hell" -- The theme to be used
       
    19 	Goals = "use the portal to move fast and far, use it to kill, use it with caution !"  --the goal ...
       
    20 	
       
    21 	
       
    22 ----AddTeam(teamname, color, grave, fort, voicepack, flag)--
       
    23 	AddTeam("Subject", 14483406, "Simple", "Island", "Default", "cm_star")
       
    24 	player = AddHog("player", 0, 10, "Terminator_Glasses")
       
    25 
       
    26 	AddTeam("Hell Army", 1170801, "Simple", "Island", "Default", "cm_galaxy")
       
    27 	enemy1 = AddHog("Lucifer", 1, 200, "thinkingcap")
       
    28 	enemy2 = AddHog("voldemort", 1, 150, "WizardHat")
       
    29 	enemy3 = AddHog("zombi", 1, 100, "zombi")
       
    30 	enemy4 = AddHog("Predator", 1, 14, "predator")
       
    31 	enemy5 = AddHog("oneye", 1, 50, "cyclops")
       
    32 	enemy6 = AddHog("razac", 1, 50, "plaguemask")
       
    33 	enemy7 = AddHog("C-2", 1, 50, "cyborg1")
       
    34 	enemy8 = AddHog("Rider", 1, 50, "scif_SparkssHelmet")
       
    35 
       
    36 	AddTeam("badmad", 1170801, "Simple", "Island", "Default", "cm_jupiter")
       
    37 	enemy9 = AddHog("C-1", 1, 50, "cyborg2")
       
    38 	enemy10 = AddHog("hiden", 1, 40, "daftpunkguymanuel")
       
    39 	enemy11 = AddHog("ronald", 1, 70, "clown")
       
    40 	enemy12 = AddHog("phosphatoglucidique", 1, 50, "chef")
       
    41 	enemy13 = AddHog("Lestat", 1, 30, "draculakz")
       
    42 
       
    43 	SetGearPosition(player, 350, 1820)
       
    44     SetGearPosition(enemy1, 2037, 1313)
       
    45 	SetGearPosition(enemy2, 1369, 1605)
       
    46 	SetGearPosition(enemy3, 1750, 1937)
       
    47 	SetGearPosition(enemy4, 3125, 89)
       
    48 	SetGearPosition(enemy5, 743, 900)
       
    49 	SetGearPosition(enemy6, 130, 360)
       
    50 	SetGearPosition(enemy7, 1333, 640)
       
    51 	SetGearPosition(enemy8, 1355, 200)
       
    52 	SetGearPosition(enemy9, 2680, 225)
       
    53 	SetGearPosition(enemy10, 2970, 800)
       
    54 	SetGearPosition(enemy11, 4050, 1964)
       
    55 	SetGearPosition(enemy12, 2666, 950)
       
    56 	SetGearPosition(enemy13, 3306, 1205)
       
    57 
       
    58 
       
    59 
       
    60 end
       
    61 
       
    62 function onAmmoStoreInit()
       
    63 
       
    64 	SetAmmo(amFirePunch, 0,0,0,1)
       
    65 	SetAmmo(amParachute, 0, 0, 0, 2)
       
    66 	SetAmmo(amGirder, 0, 0, 0, 3)
       
    67 	SetAmmo(amTeleport, 0, 0, 0, 1)
       
    68 	SetAmmo(amLaserSight,0,0,0,1)
       
    69 	SetAmmo(amHellishBomb,0,0,0,1)
       
    70 	SetAmmo(amGrenade,0,0,0,1)
       
    71 	SetAmmo(amRope,0,0,0,1)
       
    72 	SetAmmo(amDEagle,0,0,0,1)
       
    73 	SetAmmo(amExtraTime,0,0,0,2)
       
    74 	SetAmmo(amSkip,9,0,0,0)
       
    75 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
       
    76 	SetAmmo(amPickHammer, 0, 0, 0, 1)
       
    77 	SetAmmo(amSnowball, 0, 0, 0, 1)
       
    78 
       
    79 end
       
    80 
       
    81 function onGameStart()
       
    82 
       
    83 	SetWind(100)-- SetWind(windSpeed) Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control.
       
    84                 -- -100to0 is to the left, and 0to100 is to the right  (of course more its far from 0, more the speed is high
       
    85 				--  -100.............................0..................................+100
       
    86 				-- <<<<<<<<--<<--<<<<<<<<<<<<<--<<<<<|||-->>>>>>>>-->>>>>>>>>>>>>>>-->>>>>>          =  wind direction
       
    87 
       
    88 
       
    89 	MineArray[0] = AddGear(840, 1847, gtMine, 0, 0, 0, 0)
       
    90 	MineArray[1] = AddGear(900, 1847, gtMine, 0, 0, 0, 0)
       
    91 	MineArray[2] = AddGear(1000, 1847, gtMine, 0, 0, 0, 0)
       
    92 	MineArray[3] = AddGear(1100, 1847, gtMine, 0, 0, 0, 0)
       
    93 	MineArray[4] = AddGear(1140, 1847, gtMine, 0, 0, 0, 0)
       
    94 	MineArray[5] = AddGear(1170, 1847, gtMine, 0, 0, 0, 0)
       
    95 	MineArray[6] = AddGear(1200, 1847, gtMine, 0, 0, 0, 0)
       
    96 	MineArray[7] = AddGear(1200, 1847, gtMine, 0, 0, 0, 0)
       
    97 	MineArray[8] = AddGear(1230, 1847, gtMine, 0, 0, 0, 0)
       
    98 	MineArray[9] = AddGear(1280, 1847, gtMine, 0, 0, 0, 0)
       
    99 	MineArray[10] = AddGear(1302, 1847, gtMine, 0, 0, 0, 0)
       
   100 	MineArray[11] = AddGear(1350, 1847, gtMine, 0, 0, 0, 0)
       
   101 	MineArray[12] = AddGear(1383, 1847, gtMine, 0, 0, 0, 0)
       
   102 	MineArray[13] = AddGear(1400, 1847, gtMine, 0, 0, 0, 0)
       
   103 	MineArray[14] = AddGear(1423, 1847, gtMine, 0, 0, 0, 0)
       
   104 	MineArray[15] = AddGear(1470, 1847, gtMine, 0, 0, 0, 0)
       
   105 	MineArray[16] = AddGear(1480, 1847, gtMine, 0, 0, 0, 0)
       
   106 	MineArray[17] = AddGear(1311, 1847, gtMine, 0, 0, 0, 0)
       
   107 
       
   108 	MineArray[18] = AddGear(840, 1785, gtMine, 0, 0, 0, 0)
       
   109 	MineArray[19] = AddGear(900, 1785, gtMine, 0, 0, 0, 0)
       
   110 	MineArray[20] = AddGear(1000, 1785, gtMine, 0, 0, 0, 0)
       
   111 	MineArray[21] = AddGear(1100, 1785, gtMine, 0, 0, 0, 0)
       
   112 	MineArray[22] = AddGear(1140, 1785, gtMine, 0, 0, 0, 0)
       
   113 	MineArray[23] = AddGear(1170, 1785, gtMine, 0, 0, 0, 0)
       
   114 	MineArray[24] = AddGear(1200, 1785, gtMine, 0, 0, 0, 0)
       
   115 	MineArray[25] = AddGear(1230, 1785, gtMine, 0, 0, 0, 0)
       
   116 	MineArray[26] = AddGear(1280, 1785, gtMine, 0, 0, 0, 0)
       
   117 	MineArray[27] = AddGear(1302, 1785, gtMine, 0, 0, 0, 0)
       
   118 	MineArray[28] = AddGear(1350, 1785, gtMine, 0, 0, 0, 0)
       
   119 	MineArray[29] = AddGear(1383, 1785, gtMine, 0, 0, 0, 0)
       
   120 	MineArray[30] = AddGear(1400, 1785, gtMine, 0, 0, 0, 0)
       
   121 	MineArray[31] = AddGear(1423, 1785, gtMine, 0, 0, 0, 0)
       
   122 	MineArray[32] = AddGear(1470, 1785, gtMine, 0, 0, 0, 0)
       
   123 	MineArray[33] = AddGear(1480, 1785, gtMine, 0, 0, 0, 0)
       
   124 	MineArray[34] = AddGear(1311, 1785, gtMine, 0, 0, 0, 0)
       
   125 
       
   126 	MineArray[35] = AddGear(4029, 89, gtMine, 0, 0, 0, 120)
       
   127 	--MineArray[36] = AddGear(3376, 1947, gtMine, 0, 0, 0, 10)
       
   128 
       
   129 		for i = 0,#MineArray do
       
   130 			SetTimer(MineArray[i],050)
       
   131 			SetState(MineArray[i],544)
       
   132 		end
       
   133 				--needed this MineArray cause timer didn't work, its was always 3sec, i wanna instant mines
       
   134 
       
   135 
       
   136 				--UTILITY CRATE--
       
   137 	parachute = SpawnUtilityCrate(1670, 1165, amParachute)
       
   138 	girder = SpawnUtilityCrate(2101, 1297, amGirder)
       
   139 	SpawnUtilityCrate(3965, 625, amBlowTorch)
       
   140 	SpawnUtilityCrate(2249, 93, amBlowTorch)
       
   141 	SpawnUtilityCrate(2181, 829, amBlowTorch)
       
   142 	SpawnUtilityCrate(1820, 567, amBlowTorch)
       
   143 	SpawnUtilityCrate(1375, 900, amTeleport)
       
   144 	SpawnUtilityCrate(130, 600, amPickHammer)
       
   145 	SpawnUtilityCrate(1660,1820, amLaserSight)
       
   146 	SpawnUtilityCrate(4070,1840, amLaserSight)
       
   147 	
       
   148 	
       
   149 				--AMMO CRATE--
       
   150 	portalgun = SpawnAmmoCrate(505, 1943, amPortalGun, 1000)
       
   151 	extratime = SpawnAmmoCrate(4020, 785, amExtraTime, 2)
       
   152 	SpawnAmmoCrate(425, 613, amSnowball)
       
   153 	SpawnAmmoCrate(861, 633, amHellishBomb)
       
   154 	SpawnAmmoCrate(2510, 623, amSnowball)
       
   155 	SpawnAmmoCrate(2900, 1600, amGrenade)
       
   156 	SpawnAmmoCrate(2680, 320, amGrenade)
       
   157 	SpawnAmmoCrate(2650, 80, amDEagle)
       
   158 	SpawnAmmoCrate(3000, 100, amDEagle)
       
   159 	SpawnAmmoCrate(2900, 1400, amRope)
       
   160 	SpawnAmmoCrate(4025, 1117, amFirePunch)
       
   161 
       
   162 	
       
   163 				--HEALTH CRATE--
       
   164 	SpawnHealthCrate(2000, 780)
       
   165 	
       
   166 				--GIRDER--
       
   167 	PlaceGirder(3363, 1323, 4)
       
   168 
       
   169 
       
   170 	ShowMission (loc("Portal mission"), loc("training"), "", -amPortalGun, 5000)
       
   171 	HogSay(player, "I should get myself a portal gun, maybe this crate has one", SAY_THINK)
       
   172 	
       
   173 
       
   174 
       
   175 
       
   176 end
       
   177 
       
   178 function onGameTick()
       
   179 
       
   180     if (player ~= nil)  then
       
   181 		if (gearIsInBox(player, 1650, 1907, 200, 60) and (adviceGiven == false)) then
       
   182 			adviceGiven = true
       
   183 				HogSay(player, loc("Hmmm, I'll have to find some way of moving him off this anti-portal surface..."), SAY_THINK)
       
   184 		elseif (gearIsInBox(player, 2960, 790, 200, 60) and (adviceGiven2 == false)) then
       
   185 			adviceGiven2 = true
       
   186 				HogSay(player, loc("The anti-portal zone is all over the floor, and I have nothing to kill him...Droping something could hurt him enough to kill him..."), SAY_THINK)
       
   187  end
       
   188  end
       
   189 	
       
   190 	end
       
   191 	
       
   192 
       
   193 
       
   194 
       
   195 
       
   196 function onNewturn()
       
   197 end
       
   198 
       
   199 
       
   200 function onGearAdd(gear)
       
   201 end
       
   202 
       
   203 function onGearDelete(gear)
       
   204 
       
   205 	if gear == portalgun then
       
   206 		--AddAmmo(player, amPortalGun, 10000)
       
   207 		HogSay(player, "GREAT ! Let's kill all this enemies, using portals", SAY_THINK)
       
   208 	end
       
   209 
       
   210 	if gear == girder then 
       
   211 		HogSay(player, "Will be useful if I need a new plateform or if I want to rise....", SAY_THINK)
       
   212 	end
       
   213 	
       
   214 	if gear == parachute then
       
   215 		HogSay(player, loc("You can't fire a portal on the blue surface"), SAY_THINK)
       
   216 	end
       
   217 --if you wanted to check for collection only
       
   218 --you could probably say
       
   219 --if (gear == myParachuteGear) and (band(GetGearMessage(gear), gmDestroy) ~= 0) then
       
   220 
       
   221 	if gear == extratime then
       
   222 		HogSay(player, loc(" What !! For all of this struggle i just win some ... TIME o0"), SAY_SHOUT)
       
   223 	end
       
   224 
       
   225 	
       
   226 	if gear == player then
       
   227         player = nil
       
   228     end
       
   229 end
       
   230 
       
   231 
       
   232 
       
   233 
       
   234 
       
   235