share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
changeset 5362 5f0c46e78e50
parent 5277 09beef0752ab
child 5382 d5321b22aed2
equal deleted inserted replaced
5360:d47b8833284c 5362:5f0c46e78e50
     1 ----------------------------------
     1 ----------------------------------
     2 -- THE SPECIALISTS MODE 0.2
     2 -- THE SPECIALISTS MODE 0.3
     3 -- by mikade
     3 -- by mikade
     4 ----------------------------------
     4 ----------------------------------
     5 
     5 
     6 -- version history
     6 -- version history
     7 -----------------
     7 -----------------
    14 ----------------
    14 ----------------
    15 -- added gfRandomOrder to gameflags
    15 -- added gfRandomOrder to gameflags
    16 -- removed some deprecated variables/methods
    16 -- removed some deprecated variables/methods
    17 -- fixed lack of portal reset
    17 -- fixed lack of portal reset
    18 
    18 
       
    19 ----------------
       
    20 -- version 0.3
       
    21 ----------------
       
    22 -- added switching on start
       
    23 -- removed switch from engineer weaponset
       
    24 
    19 --------------------
    25 --------------------
    20 --TO DO
    26 --TO DO
    21 --------------------
    27 --------------------
    22 
    28 
    23 -- add proper gameflag checking, maybe
    29 -- add proper gameflag checking, maybe
    24 -- set crate drops etc.
    30 -- set crate drops etc.
    25 -- assuming place hog mode + gfinfattack doesn't get the fix: somehow end turn after teleport
    31 -- add alternative switch
    26 
    32 
    27 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
    33 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
    28 
    34 
    29 local numhhs = 0 
    35 local numhhs = 0 
    30 local hhs = {} 
    36 local hhs = {} 
    31 
    37 
    32 local currName 
    38 local currName 
    33 local lastName
    39 local lastName
       
    40 local started = false
       
    41 local switchStage = 0
    34 
    42 
    35 function CreateTeam()
    43 function CreateTeam()
    36 
    44 
    37 	currTeam = ""
    45 	currTeam = ""
    38 	lastTeam = ""
    46 	lastTeam = ""
   153 		AddAmmo(CurrentHedgehog, amShotgun,1)
   161 		AddAmmo(CurrentHedgehog, amShotgun,1)
   154 	elseif n == "Engineer" then
   162 	elseif n == "Engineer" then
   155 		AddAmmo(CurrentHedgehog, amGirder, 2)
   163 		AddAmmo(CurrentHedgehog, amGirder, 2)
   156 		AddAmmo(CurrentHedgehog, amBlowTorch, 1)
   164 		AddAmmo(CurrentHedgehog, amBlowTorch, 1)
   157 		AddAmmo(CurrentHedgehog, amPickHammer, 1)	
   165 		AddAmmo(CurrentHedgehog, amPickHammer, 1)	
   158 		AddAmmo(CurrentHedgehog, amSwitch, 2)	
   166 		--AddAmmo(CurrentHedgehog, amSwitch, 2)	
   159 	elseif n == "Ninja" then
   167 	elseif n == "Ninja" then
   160 		AddAmmo(CurrentHedgehog, amRope, 100)
   168 		AddAmmo(CurrentHedgehog, amRope, 100)
   161 		AddAmmo(CurrentHedgehog, amParachute, 100)
   169 		AddAmmo(CurrentHedgehog, amParachute, 100)
   162 		AddAmmo(CurrentHedgehog, amFirePunch, 1)
   170 		AddAmmo(CurrentHedgehog, amFirePunch, 1)
   163 	elseif n == "Demo" then
   171 	elseif n == "Demo" then
   213 
   221 
   214 function onNewTurn()
   222 function onNewTurn()
   215 	currName = GetHogName(CurrentHedgehog)
   223 	currName = GetHogName(CurrentHedgehog)
   216 	lastName = GetHogName(CurrentHedgehog)
   224 	lastName = GetHogName(CurrentHedgehog)
   217 	AssignAmmo()
   225 	AssignAmmo()
   218 	AddAmmo(CurrentHedgehog, amSwitch, 1)
   226 	
       
   227 	--AddAmmo(CurrentHedgehog, amSwitch, 1)
       
   228 	---------------
       
   229 	--switch	
       
   230 	started = false
       
   231 	switchStage = 0
       
   232 	---------------
   219 end
   233 end
   220 
   234 
   221 function onGameTick()
   235 function onGameTick()
   222 
   236 
   223 	if (CurrentHedgehog ~= nil) then
   237 	if (CurrentHedgehog ~= nil) then
   226 		
   240 		
   227 		if currName ~= lastName then
   241 		if currName ~= lastName then
   228 			AddCaption(loc("Switched to ") .. currName .. "!")
   242 			AddCaption(loc("Switched to ") .. currName .. "!")
   229 			AssignAmmo()		
   243 			AssignAmmo()		
   230 		end
   244 		end
       
   245 
       
   246 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then			
       
   247 			
       
   248 			switchStage = switchStage + 1	
       
   249 			
       
   250 			if switchStage == 10 then
       
   251 				AddAmmo(CurrentHedgehog, amSwitch, 1)
       
   252 			elseif switchStage == 20 then
       
   253 				ParseCommand("setweap " .. string.char(amSwitch))
       
   254 			elseif switchStage == 30 then
       
   255 				SetGearMessage(CurrentHedgehog,gmAttack) 
       
   256 				switchStage = 110
       
   257 			end
       
   258 		end		
       
   259 		
       
   260 		--------------------------------------------------------------------------------------
   231 
   261 
   232 		lastName = currName
   262 		lastName = currName
   233 
   263 
   234 	end
   264 	end
   235 
   265 
   247 function onGearDelete(gear)
   277 function onGearDelete(gear)
   248 --
   278 --
   249 end
   279 end
   250 
   280 
   251 function onAmmoStoreInit()
   281 function onAmmoStoreInit()
   252 
   282 --
   253 end
   283 end
   254 
   284 
   255 
   285 
   256 
   286