Page 1 of 2 12 LastLast
Results 1 to 20 of 25

Thread: EDCT: WhenToTest BecomesFactionLeader causes crashes

  1. #1

    Default EDCT: WhenToTest BecomesFactionLeader causes crashes

    I have been investigating a crash together with Kull, where the game crashes when the faction leader gets killed in the battle where the last settlement of his faction falls, unless the rest of the family dies too. At least in EBII's case, this was narrowed down to be because of trait triggers using WhenToTest BecomesFactionLeader.

    While these triggers work perfectly fine for normal succession, they are also tested when the faction dies and crash the game if any of them get fired (they have all conditions evaluating to true).

    The workaround I found was to postpone processing of succession related triggers to the end of the turn. It introduces these traits as flags:

    Code:
    Trait NotFactionLeader
        Characters family
        Hidden
    
       Level NotFactionLeader
            Description Hidden_desc
            EffectsDescription Hidden_effects_desc
            Threshold  1
    
    
    Trait BecameFactionLeader
        Characters family
        Hidden
    
        Level BecameFactionLeader
            Description hidden_desc
            EffectsDescription hidden_effects_desc
            Threshold  1
    These triggers below must be placed before any succession triggers to set these flags - keep NotFactionLeader on all generals, and switch to BecameFactionLeader whenever the faction leader has this flag, signalling succession.

    Code:
    Trigger NotAFactionLeader
        WhenToTest CharacterTurnEnd
    
      Condition IsGeneral
            and not IsFactionLeader
            and Trait NotFactionLeader < 1
    
      Affects NotFactionLeader 1 Chance  100
    
    Trigger IsNowFactionLeader
        WhenToTest CharacterTurnEnd
    
      Condition IsGeneral
            and IsFactionLeader
            and Trait NotFactionLeader > 0
    
      Affects BecameFactionLeader 1 Chance  100
      Affects NotFactionLeader -1 Chance  100
    Each trigger currently using BecomesFactionLeader then has to change like this:

    Code:
    Trigger ArmenianBecomesLeader
      WhenToTest BecomesFactionLeader CharacterTurnEnd
    
      Condition FactionType f_hayasdan
            and Trait Arkah < 1
            and Trait BecameFactionLeader > 0
    
      Affects Arkah  1  Chance  100
    Finally, after all succession triggers, the flag that someone became faction leader must be reset to avoid them firing each turn.

    Code:
    Trigger BecomingFactionLeaderFinished
        WhenToTest CharacterTurnEnd
    
      Condition IsGeneral
            and Trait BecameFactionLeader > 0
    
      Affects BecameFactionLeader -1 Chance  100
    Last edited by bovi; September 02, 2018 at 06:55 AM. Reason: I forgot to make BecameFactionLeader hidden.

    Having problems getting EB2 to run? Try these solutions.
    ================
    I do NOT answer PM requests for help with EB. Ask in a new help thread in the tech help forum.
    ================
    I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. - Stephen Hawking

  2. #2

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    This bug is OLD, and has affected at least one other mod and goes back to vanilla M2TW:

    1) A completely different mod (Third Age CTD)

    2) Seems to be a bug present in vanilla M2TW

    So if your mod uses traits as part of the "Faction Heir to Faction Leader" transition, you probably have this bug. Fortunately, the fix is described above.
    EBII Council

  3. #3

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    great fix here!can every mod use this fix?

    edit;thank you for showing us this fix,manny times i had a ctd when last settlement was falling,now am in turn 430,but only because i had not a ctd with the last settlement of an faction getting destroyed.

    then this is a ctd too with this problem,a campaign around 380 turns;
    Code:
    14:36:36.876 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA14:36:36.910 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:36.942 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:36.979 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.024 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.081 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.143 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.199 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.263 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.330 [data.transgression] [info] Applied transgression TC_INVASION from transgressor faction 237BBCB0 against faction 237EB0BA
    14:36:37.664 [bink] [debug] [data/fmv/faction/minor_lose.bik]Pause on
    14:36:37.664 [bink] [debug] [data/fmv/faction/minor_lose.bik]Pause on
    14:36:40.979 [system.rpt] [error] Medieval 2: Total War encountered an unspecified error and will now exit.
    a great campaign but sadly ended in sorrow and pain after a ctd.
    Last edited by stevietheconquer; September 04, 2018 at 12:06 PM.

  4. #4

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Quote Originally Posted by stevietheconquer View Post
    great fix here!can every mod use this fix?
    I cannot know whether every mod will prefer stability over immediate processing of succession traits. The workaround imposes a delay in awarding traits on succession to the end of the turn, which may cause problems if the script or other trait triggers depend on them always being present on the faction leader. Possibly applying it will therefore require significant rewriting of logic elsewhere.

    But yes, the workaround I laid out here should be universally applicable. No attribution necessary.
    Last edited by bovi; September 04, 2018 at 04:20 PM.

    Having problems getting EB2 to run? Try these solutions.
    ================
    I do NOT answer PM requests for help with EB. Ask in a new help thread in the tech help forum.
    ================
    I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. - Stephen Hawking

  5. #5

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    ok,thank you for the answer,i will first test the codes in a new game and then i can see if it works good for mine little mod traits.maybe it will work in a already started campaign i will test it in campaign of already 430 turns.

  6. #6

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Quote Originally Posted by stevietheconquer View Post
    maybe it will work in a already started campaign i will test it in campaign of already 430 turns.
    No. Because it adds traits, the change is savegame incompatible, sorry.

    To clarify, it will probably allow you to bypass a faction destruction crash, but it will also make the traits saved on each character wrong. The game saves which traits a character has by a number, which corresponds to the order those traits appear in EDCT. When adding traits anywhere except the very bottom of the traits, you also change that order, and so the game will think completely different traits are on the characters.

    With all processing happening based on which traits are already on the character, you are likely to see very weird results after even just one turn, and also even if you turn back to the original EDCT after bypassing the crash.

    By the way, the easiest way for bypassing such a crash in an ongoing campaign is much simpler. Just take a backup copy of EDCT, then delete or comment out all trait triggers. Restore the original EDCT after the battle.
    Last edited by bovi; September 06, 2018 at 11:27 AM.

    Having problems getting EB2 to run? Try these solutions.
    ================
    I do NOT answer PM requests for help with EB. Ask in a new help thread in the tech help forum.
    ================
    I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. - Stephen Hawking

  7. #7

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    i could not resist to try it yesterday,it al seems to work good,there was even one faction destroyed,and if mine campaign goes wrong it is not the end of the world,then i just start a new one,am already about 10 turn further and i can see no errors,maybe the next turn it will happen.

  8. #8

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    ok i had only one problem,it was about the pope,getting the wright model strat,but as they are priest becoming pope,factionleader they never get those traits

    trigger pope was first( Whentotest becomesfactionleaderleader) so changed into like it says in the code.

    trigger now
    Code:
    ;------------------------------------------Trigger factionleader_pope
    WhenToTest CharacterTurnEnd
    
    
    Condition FactionType papal_states
    and Trait BecameFactionLeader > 0
    
    
    Affects IAmPope 1 Chance 100
    guest i just change it in this one;
    Code:
    ;------------------------------------------Trigger factionleader_pope
    WhenToTest CharacterTurnEnd
    
    
    Condition FactionType papal_states
    and IsFactionLeader 
    and not Trait IAmPope = 1
    
    
    Affects IAmPope 1 Chance 100
    and it will be good
    Last edited by stevietheconquer; September 06, 2018 at 03:59 PM.

  9. #9
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes











  10. #10
    _Tartaros_'s Avatar "Harzschütze"
    Join Date
    Aug 2009
    Location
    kvet.lɪnˌbuʁk
    Posts
    4,492

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    observed this too, when factions with only one or two regions and a small familytree got besieged and fl + fh got killed in battle the game ctd. implanted your suggested workaround.

    question:
    keep NotFactionLeader on all generals
    can i leave the rebel faction generals out in descr_strat?

  11. #11

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Quote Originally Posted by stevietheconquer View Post
    ok i had only one problem,it was about the pope
    Right. There could be a special case for that one, as in this case it is not a general becoming faction leader.
    Quote Originally Posted by stevietheconquer View Post
    guest i just change it in this one;
    Code:
    ;------------------------------------------Trigger  factionleader_pope
    WhenToTest CharacterTurnEnd
    
    Condition FactionType papal_states
    and IsFactionLeader 
    and not Trait IAmPope = 1
    
    
    Affects IAmPope 1 Chance 100
    That looks sound, yes.

    Quote Originally Posted by _Tartaros_ View Post
    can i leave the rebel faction generals out in descr_strat?
    The trait will be assigned to all non-FLs at the end of the first turn by Trigger NotAFactionLeader. There should be no need to ever put the NotFactionLeader trait on anyone in descr_strat, unless your mod specifically has a situation where a faction leader can be killed in his single settlement on the very first turn while another family member is outside of the settlement. This sounds unlikely to me.

    Having problems getting EB2 to run? Try these solutions.
    ================
    I do NOT answer PM requests for help with EB. Ask in a new help thread in the tech help forum.
    ================
    I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. - Stephen Hawking

  12. #12
    _Tartaros_'s Avatar "Harzschütze"
    Join Date
    Aug 2009
    Location
    kvet.lɪnˌbuʁk
    Posts
    4,492

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    haha, no...
    ok then - will go on to test this issue in my mod

  13. #13

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Quote Originally Posted by bovi View Post
    The trait will be assigned to all non-FLs at the end of the first turn by Trigger NotAFactionLeader. There should be no need to ever put the NotFactionLeader trait on anyone in descr_strat, unless your mod specifically has a situation where a faction leader can be killed in his single settlement on the very first turn while another family member is outside of the settlement. This sounds unlikely to me.
    Thinking about it, this was imprecise. The unhandled situation using this workaround is when a faction leader dies on the very first turn, by any cause. In that case, succession triggers will not fire as NotFactionLeader has not been set on the rest of the family yet. Still, a faction leader dying on the first turn should be a rare occurrence in any mod, I think.

    Having problems getting EB2 to run? Try these solutions.
    ================
    I do NOT answer PM requests for help with EB. Ask in a new help thread in the tech help forum.
    ================
    I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. - Stephen Hawking

  14. #14

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Quote Originally Posted by bovi View Post
    Thinking about it, this was imprecise. The unhandled situation using this workaround is when a faction leader dies on the very first turn, by any cause. In that case, succession triggers will not fire as NotFactionLeader has not been set on the rest of the family yet. Still, a faction leader dying on the first turn should be a rare occurrence in any mod, I think.
    It's a bit of a blunt workaround for this possibility and might be overkill, but you could give all the non-FL characters that NotFactionLeader trait in the descr_strat. That would mean the only character lacking it at the start of the game would be the starting FL.

  15. #15

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Quote Originally Posted by QuintusSertorius View Post
    you could give all the non-FL characters that NotFactionLeader trait in the descr_strat
    True, and this was what Tartaros was planning to do in the first place. I was arguing that the work to do so is probably not necessary, except if you foresee a faction leader dying on the first turn. I was clarifying that this concerns any FL death, not only if it happens in the last settlement as I first said.

    Having problems getting EB2 to run? Try these solutions.
    ================
    I do NOT answer PM requests for help with EB. Ask in a new help thread in the tech help forum.
    ================
    I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. - Stephen Hawking

  16. #16

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    just forget about it,thank you for this great fix and great traits!am gonna use it in mine descr_export_charater_trait file.
    and mine campaign is now in turn 475 and still is goin good,but i am a turtle player and was waiting for gunpowder event too do mine invasions.
    Attached Thumbnails Attached Thumbnails 0006.jpg  
    Last edited by stevietheconquer; September 11, 2018 at 10:21 AM.

  17. #17

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Hi all. 1 question
    In file descr_faction_standing i found this trigger:

    ;------------------------------------------
    Trigger New_Faction_Leader_trigger
    WhenToTest BecomesFactionLeader


    FactionStanding exclude_factions { slave } normalise 0.25 10
    FactionStanding global normalise 0.25 10
    Do I need to change the entry in that file as indicated here?



    If necessary, what should it look like?
    like this:?

    Trigger New_Faction_Leader_trigger
    WhenToTest CharacterTurnEnd

    Condition Trait BecameFactionLeader > 0
    FactionStanding exclude_factions { slave } normalise 0.25 10
    FactionStanding global normalise 0.25 10

    Or do I need to change nothing at all in this file?
    Thanks in advance
    Last edited by Leeekaaa; January 06, 2020 at 03:31 AM.

  18. #18

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    i think you can let it stay as i am playing with these traits a long time and got the same text in descr_faction_standing file and no ctd

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    I think the crash reason is that a trait\ancillary needs to be a applied to a character who in the time between triggering the BecomesFactionLeader event and the time of applying the effects simply vanishes.

    Faction standing does not apply anything to a character so it will be fine.










  20. #20
    Laetus
    Join Date
    Mar 2013
    Location
    Russia, Tula
    Posts
    16

    Default Re: EDCT: WhenToTest BecomesFactionLeader causes crashes

    Hello everyone!
    I was advised to look here from the topic "Crashes and how to fix them".
    I have a problem with a very specific CTD. The action of this CTD occurs after the capture of the stronghold of one faction (AI) by the army of another faction (also AI). Here are the features of the situation:
    1. The leader of the faction is in the citadel.
    2. In addition to this stronghold, the faction has another stronghold (besieged by the same enemy). This citadel houses a faction's heir and a member of the ruler's family.
    There are no more members in the ruler's family.
    3. The faction has another city without a manager, located far from the battlefield.
    4. CTD occurs exactly after the capture of the first citadel. I replayed the saves of this campaign. I provoked the storming faction into an early assault (sent my troops to the besieged settlement).
    The AI ​​started the assault 1-3 turns earlier, but the result was the same: CTD after the invaders entered the conquered settlement. In the log, I have not yet found any mention of the assault on the second citadel.
    5. The settlement has successfully participated in several dozen campaigns. There were no problems.
    6. The settlement repeatedly passed from faction to faction in various companies. There were no problems.
    7. The faction that caused me a problem when capturing a settlement successfully captured this settlement in previous campaigns, there were no problems.
    8. With the help of console cheats, I removed the commander of the attacking army. The army stormed the settlement without a commander, the result did not change: CTD after the invaders entered the conquered settlement.
    The log file notes the event "Applied TC_INVADED_SETTLEMENT violation by offender faction 1CAC094C vs faction 1CAC4404" and triggers fired: "<0101_sack_settlement_decrease_global>", "<VanquisherHeathenSackedTown2>", "VanquisherVenetianSackedTown>", "<extermination_foriegn>". This is followed by a series of lines: "[bink] [debug] [data/fmv/faction/minor_lose.bik] Pause on" and a message: "[system.rpt] [error]".
    The Fallen Citadel is not the faction's last settlement, but Tartaros's line "observed this too, when factions with only one or two regions and a small familytree got besieged and fl + fh got killed in battle the game ctd. implanted your suggested workaround." gave me hope. I disabled all "WhenToTest BecomesFactionLeader" triggers in EDCT. I started the save. The CTD happened exactly the same as before.
    I'm not good at reading logs. Perhaps I missed something or misunderstood. It's possible that STD actually takes place right after the capture of the first stronghold and has nothing to do with the current topic. Can someone help me figure this out? This is the initial crash log. This is a crash log with traits disabled in EDCT.

Page 1 of 2 12 LastLast

Posting Permissions

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