Results 1 to 3 of 3

Thread: OnFactionTurnStart

  1. #1
    Foederatus
    Join Date
    Apr 2010
    Location
    Russia, Volgograd
    Posts
    27

    Default OnFactionTurnStart

    Where is "scripting.AddEventCallBack("FactionTurnStart", OnFactionTurnStart)" or it TW warhammer equal

  2. #2
    Bruno_Magno's Avatar Foederatus
    Join Date
    Oct 2013
    Location
    Brazil
    Posts
    48

    Default Re: OnFactionTurnStart

    Any luck with it?

  3. #3
    Litharion's Avatar Artifex
    Join Date
    Sep 2013
    Location
    Germany
    Posts
    2,622

    Default Re: OnFactionTurnStart

    Quote Originally Posted by seregavlg View Post
    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
    Last edited by Litharion; August 13, 2017 at 11:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •