ActivePlayerTurnStart: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
(Created page with "==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() ...")
 
Line 5: Line 5:
==Example==
==Example==
   function NewTurn()
   function NewTurn()
     for _, pPlayer in pairs(Players) do
     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 );

Revision as of 08:11, 14 February 2012

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 );