share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua
changeset 7165 aad1aea05f1e
parent 6501 4a6666deb85b
child 7827 353d90ddc188
equal deleted inserted replaced
7164:fad64b97947e 7165:aad1aea05f1e
   126 
   126 
   127 function onNewTurn()
   127 function onNewTurn()
   128 	ParseCommand( "setweap " .. string.char( amRope ) ) -- Set the default weapon to Rope
   128 	ParseCommand( "setweap " .. string.char( amRope ) ) -- Set the default weapon to Rope
   129 end
   129 end
   130 
   130 
   131 function onGameTick()
   131 function onGameTick20()
   132 	if TurnTimeLeft == 1 then -- Round starts at 0, so we check if the round is finished by using 1
   132 	if TurnTimeLeft < 40 and TurnTimeLeft > 0 then -- Round starts at 0, so we check if the round is finished by using 1
   133 		GameLost = true -- You lost the game
   133 		GameLost = true -- You lost the game
   134 		Info( "Aiming Practice", "You did not make it in time, try again!", -amSkip )
   134 		Info( "Aiming Practice", "You did not make it in time, try again!", -amSkip )
   135 		SetHealth( Player, 0 ) -- Kill the player so he can't keep moving!
   135 		SetHealth( Player, 0 ) -- Kill the player so he can't keep moving!
   136 
   136 
   137 		SetEffect( Player, heResurrectable, false )
   137 		SetEffect( Player, heResurrectable, false )
   149 			--SetEffect( Player, heResurrectable, false )
   149 			--SetEffect( Player, heResurrectable, false )
   150 			TurnTimeLeft = 1
   150 			TurnTimeLeft = 1
   151 
   151 
   152 			WaitTime = -1
   152 			WaitTime = -1
   153 		else
   153 		else
   154 			WaitTime = WaitTime - 1
   154 			WaitTime = WaitTime - 20
   155 		end
   155 		end
   156 	end
   156 	end
   157 
   157 
   158 	if FollowingGear == true then
   158 	if FollowingGear == true then
   159 		if FollowTime == 0 then
   159 		if FollowTime == 0 then
   160 			FollowingGear = false
   160 			FollowingGear = false
   161 			FollowTime = 1500
   161 			FollowTime = 1500
   162 			FollowGear( Player )
   162 			FollowGear( Player )
   163 		else
   163 		else
   164 			FollowTime = FollowTime - 1
   164 			FollowTime = FollowTime - 20
   165 		end
   165 		end
   166 	end
   166 	end
   167 
   167 
   168 	for k, v in pairs( Timers ) do
   168 	for k, v in pairs( Timers ) do
   169 		if v.End <= GetTime then
   169 		if v.End <= GetTime then
   170 			Info( "Aiming Practice", v.Message, -amRope )
   170 			Info( "Aiming Practice", v.Message, -amRope )
   171 			Timers[ k ] = nil
   171 			Timers[ k ] = nil
   172 		end
   172 		end
   173 	end
   173 	end
   174 
   174 
   175 	GetTime = GetTime + 1
   175 	GetTime = GetTime + 20
   176 
   176 
   177 	CheckPosition( Player, 70 ) -- Run the CheckPosition function to check if the player is close to a target
   177 	CheckPosition( Player, 70 ) -- Run the CheckPosition function to check if the player is close to a target
   178 end
   178 end
   179 
   179 
   180 function onAmmoStoreInit()
   180 function onAmmoStoreInit()