ActivePlayerTurnStart: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Up: [[Lua Game Events]]
==Description==
==Description==
Up: [[Lua Game Events]]
This event is fired on the start of the human [[Lua Game Objects/Player|player]]'s turn (not fired for AIs).
This event is fired on the start of the human [[Lua Game Objects/Player|player]]'s turn (not fired for AIs).
Can be used to do some per turn calculations.
Can be used to do some per turn calculations.
Line 6: Line 6:
==Example==
==Example==
   function NewTurn()
   function NewTurn()
     for _, pPlayer in pairs(Players) do  --loop through all players
     for _, pPlayer in pairs([[Players]]) do  --loop through all players
       UpdateSomething(pPlayer);
       UpdateSomething(pPlayer);
     end
     end
   end
   end
   Events.ActivePlayerTurnStart.Add( NewTurn );
   Events.ActivePlayerTurnStart.Add( NewTurn );

Latest revision as of 08:57, 14 February 2012

Up: Lua Game Events

Description

This event is fired on the start of the human player's turn (not fired for AIs). Can be used to do some per turn calculations.

Example

 function NewTurn()
   for _, pPlayer in pairs(Players) do  --loop through all players
     UpdateSomething(pPlayer);
   end
 end
 Events.ActivePlayerTurnStart.Add( NewTurn );