share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
changeset 5827 a416f1070fdf
parent 5817 70208e400a59
child 6747 3f85b103f29f
equal deleted inserted replaced
5825:a6eab1b7c00d 5827:a416f1070fdf
   257 function onGameTick()
   257 function onGameTick()
   258 
   258 
   259 	if (CurrentHedgehog ~= nil) then
   259 	if (CurrentHedgehog ~= nil) then
   260 
   260 
   261 		currName = GetHogName(CurrentHedgehog)
   261 		currName = GetHogName(CurrentHedgehog)
   262 		
   262 
   263 		if (currName ~= lastName) and (switchStage > 100) then
   263 		if (currName ~= lastName) and (switchStage > 100) then
   264 			AddCaption(loc("Switched to ") .. currName .. "!")
   264 			AddCaption(loc("Switched to ") .. currName .. "!")
   265 			AssignAmmo()		
   265 			AssignAmmo()
   266 		end
   266 		end
   267 
   267 
   268 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then			
   268 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then
   269 			
   269 
   270 			AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") 
   270 			AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!")
   271 
   271 
   272 			hogCounter = 0
   272 			hogCounter = 0
   273 			runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
   273 			runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
   274 
   274 
   275 			if hogCounter > 1 then
   275 			if hogCounter > 1 then
   276 
   276 
   277 				switchStage = switchStage + 1	
   277 				switchStage = switchStage + 1
   278 			
   278 
   279 				if switchStage == 1 then
   279 				if switchStage == 1 then
   280 					AddAmmo(CurrentHedgehog, amSwitch, 1)
   280 					AddAmmo(CurrentHedgehog, amSwitch, 1)
   281 				
   281 
   282 				elseif switchStage == 2 then
   282 				elseif switchStage == 2 then
   283 					ParseCommand("setweap " .. string.char(amSwitch))
   283 					ParseCommand("setweap " .. string.char(amSwitch))
   284 				elseif switchStage == 3 then
   284 				elseif switchStage == 3 then
   285 					SetGearMessage(CurrentHedgehog,gmAttack) 
   285 					SetGearMessage(CurrentHedgehog,gmAttack)
   286 				elseif switchStage == 4 then
   286 				elseif switchStage == 4 then
   287 					switchStage = 110
   287 					switchStage = 110
   288 					AddAmmo(CurrentHedgehog, amSwitch, 0)
   288 					AddAmmo(CurrentHedgehog, amSwitch, 0)
   289 				end
   289 				end
   290 			
   290 
   291 			else
   291 			else
   292 				switchStage = 110
   292 				switchStage = 110
   293 			end
   293 			end
   294 
   294 
   295 
   295 
   296 		end		
   296 		end
   297 		
   297 
   298 		lastName = currName
   298 		lastName = currName
   299 
   299 
   300 	end
   300 	end
   301 
   301 
   302 end
   302 end
   305 
   305 
   306         if GetGearType(gear) == gtHedgehog then
   306         if GetGearType(gear) == gtHedgehog then
   307                 hhs[numhhs] = gear
   307                 hhs[numhhs] = gear
   308                 numhhs = numhhs + 1
   308                 numhhs = numhhs + 1
   309         elseif (GetGearType(gear) == gtMine) and (started == true) then
   309         elseif (GetGearType(gear) == gtMine) and (started == true) then
   310 		SetTimer(gear,5000)	
   310 		SetTimer(gear,5000)
   311 	end
   311 	end
   312 	
   312 
   313 	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
   313 	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
   314 		trackGear(gear)
   314 		trackGear(gear)
   315 	end 
   315 	end
   316 
   316 
   317 
   317 
   318 end
   318 end
   319 
   319 
   320 function onGearDelete(gear)
   320 function onGearDelete(gear)
   321 	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
   321 	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
   322 		trackDeletion(gear)
   322 		trackDeletion(gear)
   323 	end 
   323 	end
   324 end
   324 end
   325 
   325 
   326 function onAmmoStoreInit()
   326 function onAmmoStoreInit()
   327 --
   327 --
   328 end
   328 end