Results 1 to 2 of 2

Thread: Triggers / Scripting traits for Faction Leader not working?

  1. #1

    Default Triggers / Scripting traits for Faction Leader not working?

    I've been trying various permutations in the export_triggers.lua, scripting.lua and trait_triggers_tables, but it seems whatever I write, faction leaders (king, queen, president) never seem to gain any traits beyond what they spawn with, and the set of traits they spawn with is the generic minister set of traits that every other minister obtains.

    I found the whole IsFactionLeader and IsFactionLeaderFemale condition appears to not do anything in that regard?

    Some things I tried besides the above:
    if conditions.CharacterType("minister", context) and not conditions.CharacterMinisterialPosition("army", context) and not conditions.CharacterMinisterialPosition("finance", context) and not conditions.CharacterMinisterialPosition("navy", context) and not conditions.CharacterMinisterialPosition("justice", context) and not conditions.CharacterMinisterialPosition("head_of_government", context) and not conditions.CharacterMinisterialPosition("governor_america", context) and not conditions.CharacterMinisterialPosition("governor_india", context) and not conditions.FactionGovernmentType("gov_republic", context) then

    if conditions.CharacterHoldsPost(context) and not conditions.CharacterMinisterialPosition("army", context) and not conditions.CharacterMinisterialPosition("finance", context) and not conditions.CharacterMinisterialPosition("navy", context) and not conditions.CharacterMinisterialPosition("justice", context) and not conditions.CharacterMinisterialPosition("head_of_government", context) and not conditions.CharacterMinisterialPosition("governor_america", context) and not conditions.CharacterMinisterialPosition("governor_india", context) and not conditions.FactionGovernmentType("gov_republic", context) then

    if conditions.CharacterType("minister", context) and not conditions.CharacterHoldsPost(context) and not conditions.FactionGovernmentType("gov_republic", context) then

    However those didn't cause anything to trigger for the faction leader either (for events: Promotion, Char turn end, char creation)

    Is there something I'm missing or is it a known issue with ETW?

    P.S. Ancillaries appear to work for faction leaders as they do receive those unique to them (i.e. gardener, tiger), but adding traits into that bit of code in the export_ancillaries.lua appears to not have any effect
    Last edited by FactionHeir; October 19, 2016 at 03:26 PM.
    (M2TW Links outdated, sorry)
    Want gunpowder, mongols, and timurids to appear when YOU do?

    Click here to read the solution
    Annoyed at laggy battles? This has all you need
    Got low fps in siege battles in particular? This tutorial is for you
    Want to play M2TW as a Vanilla experience minus annoying bugs? Get VanillaMod Visit the forum Readme
    Need improved and faster 2H animations? Download this!

  2. #2

    Icon3 Re: Triggers / Scripting traits for Faction Leader not working?

    Hello!
    As far as I have observed, 'events.CharacterTurnEnd' works for faction leaders. I have put my solution for this problem on GitHub.
    Unfortunately, this means that both faction leaders and ministers will not receive their properties until the next round.
    Here is my code for kings:

    Code:
    events.CharacterTurnEnd[#events.CharacterTurnEnd+1] =
    function (context)
        if (conditions.IsFactionLeader(context) or 
    conditions.IsFactionLeaderFemale(context)) and 
    conditions.CharacterTrait("C_Leader_Clever_Stick", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Foreign_Tastes", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Intellectual_Pretensions", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Army_Buff", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Uncouth", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Witty", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Natural_King", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Dullard", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Huntin_Shootin_Fishin", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Philistine", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Debauched", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Mad", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Humanist", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Inbred", context) < 1 and 
    conditions.CharacterTrait("C_Leader_Navy_Buff", context) < 1 and 
    not conditions.CampaignName("episodic_1", context) and 
    not conditions.CampaignName("episodic_3", context) and 
    not conditions.FactionGovernmentType("gov_republic", context) and 
    not conditions.CharacterCultureType("tribal_playable", context) then
            effect.trait("C_Leader_Clever_Stick", "agent", 1, 17, context)
            effect.trait("C_Leader_Foreign_Tastes", "agent", 1, 17, context)
            effect.trait("C_Leader_Intellectual_Pretensions", "agent", 1, 8, context)
            effect.trait("C_Leader_Army_Buff", "agent", 1, 17, context)
            effect.trait("C_Leader_Uncouth", "agent", 1, 17, context)
            effect.trait("C_Leader_Witty", "agent", 1, 17, context)
            effect.trait("C_Leader_Natural_King", "agent", 1, 17, context)
            effect.trait("C_Leader_Dullard", "agent", 1, 17, context)
            effect.trait("C_Leader_Huntin_Shootin_Fishin", "agent", 1, 17, context)
            effect.trait("C_Leader_Uncouth", "agent", 2, 17, context)
            effect.trait("C_Leader_Uncouth", "agent", 3, 17, context)
            effect.trait("C_Leader_Clever_Stick", "agent", 1, 8, context)
            effect.trait("C_Leader_Dullard", "agent", 1, 17, context)
            effect.trait("C_Leader_Clever_Stick", "agent", 1, 8, context)
            effect.trait("C_Leader_Philistine", "agent", 2, 17, context)
            effect.trait("C_Leader_Huntin_Shootin_Fishin", "agent", 1, 33, context)
            effect.trait("C_Leader_Debauched", "agent", 1, 8, context)
            effect.trait("C_Leader_Witty", "agent", 1, 17, context)
            effect.trait("C_Leader_Debauched", "agent", 1, 17, context)
            effect.trait("C_Leader_Foreign_Tastes", "agent", 1, 17, context)
            effect.trait("C_Leader_Mad", "agent", 2, 10, context)
            effect.trait("C_Leader_Humanist", "agent", 1, 8, context)
            effect.trait("C_Leader_Mad", "agent", 4, 10, context)
            effect.trait("C_Leader_Huntin_Shootin_Fishin", "agent", 1, 17, context)
            effect.trait("C_Leader_Debauched", "agent", 1, 17, context)
            effect.trait("C_Leader_Debauched", "agent", 1, 17, context)
            effect.trait("C_Leader_Natural_King", "agent", 1, 17, context)
            effect.trait("C_Leader_Inbred", "agent", 1, 5, context)
            effect.trait("C_Leader_Foreign_Tastes", "agent", 1, 8, context)
            effect.trait("C_Leader_Mad", "agent", 1, 10, context)
            effect.trait("C_Leader_Dullard", "agent", 1, 17, context)
            effect.trait("C_Leader_Philistine", "agent", 1, 17, context)
            effect.trait("C_Leader_Navy_Buff", "agent", 1, 17, context)
            return true
        end
        return false
    end

Posting Permissions

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