[Lua] Conditional Hooks?

Irkalla

ENTP POWWWEEEEEER
Joined
Sep 25, 2012
Messages
1,009
Location
Way down around Vicksburg
Wondering if there's a way that I can make a hook happen or not depending on conditions. For example, I've got some scripting behind trait pieces and some promotions.

For at least the trait pieces, I'd like to check to see if anyone has them before even hooking into stuff so to save some processor time. Promotions probably aren't feasible due to units not being present at specific times.
 
As part of the mod, add a hook that fires on player turn start. When it fires, unhook it (so it never triggers again), then test each player to see what trait they have and add the specific hooks for the trait as necessary.

If promotions are for civ specific units, you can hook them if the civ is active in the game.
 
As part of the mod, add a hook that fires on player turn start. When it fires, unhook it (so it never triggers again), then test each player to see what trait they have and add the specific hooks for the trait as necessary.

If promotions are for civ specific units, you can hook them if the civ is active in the game.

You forgot about militaristic city-states.
 
Back
Top Bottom