Originally Posted by
seregavlg
Where is "scripting.AddEventCallBack("FactionTurnStart", OnFactionTurnStart)" or it TW warhammer equal
The structure of the scripts has changed a bit but you can still use the Callback like this:
Code:
function Add_Empire_Politics_Listeners()
LogPolitics("#### Adding Empire Politics Listeners ####", true, true);
cm:add_listener(
"FactionTurnStart_EP",
"FactionTurnStart",
true,
function(context) FactionTurnStart_EP(context) end,
true
);
end;
The function of course needs to be executed by the game.
Code:
cm:register_ui_created_callback(
function()
Add_Empire_Politics_Listeners()
end
);
the function defined on Faction turn start will execute now everytime
Code:
function FactionTurnStart_EP(context)
if context:faction():is_human() and context:faction():name() == "wh_main_emp_empire" then
-- DO STUFF