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

Thread: Making Form/Break Alliance into a trait trigger

  1. #1

    Default Making Form/Break Alliance into a trait trigger

    Hello.

    I have been wondering for some time now. Is there any conceivable way that has ever been tested by other modders to apply the monitors "FactionAllianceDeclared" and "FactionBreakAlliance" to the triggers section in export_descr_character_traits? I have discussed this here once, but it's the first time I make a whole topic about it. I find it very off-turning and immersion-breaking that faction leaders do not lose any chivalry for betraying their allies during the campaign, but gain chivalry from trivial things such as charging low taxes.

    I have reworked the entire chain of chivalry/dread traits to make their attribution more logical, but this part which I consider the most important is exactly the one that I could not address. I wonder if anyone has ever tried to give traits based on forming or breaking alliances.
    Last edited by es157; June 11, 2021 at 02:53 PM.

  2. #2

    Default Re: Making Form/Break Alliance into a trait trigger

    I think you already asked this.

  3. #3

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    I think you already asked this.
    How odd. Sorry. I could swear I had only briefly talked about this with someone in an unrelated post. But then, I've asked so many questions recently that I forgot about this one. I just thought about it again when I revisited the issue in my mod and found it was still without solution.

    Now I don't know if I should continue this here or there. See, I could use FactionBreakAlliance as a monitor in script to give me a counter number. Then I use this counter number on EDCT to give StrategyDread trait points to the faction leader in question. In abstract, does this sound possible or am I taking steps too far? I've never used counters in EDCT, but I saw somewhere that it's possible.

    I started making some drafts based on what you said in the other post. I figured I would need to do faction by faction.

    Does this make sense?

    In the script:

    monitor_event FactionBreakAlliance FactionType venice
    and I_CompareCounter cersei_breaks_alliance = 0
    set_counter cersei_breaks_alliance 1
    end_monitor
    In EDCT:


    Trigger cersei_breaks_alliance
    WhenToTest CharacterTurnEnd


    Condition FactionType venice
    and IsFactionLeader
    and I_Counter cersei_breaks_alliance > 0

    Affects StrategyDread 1 Chance 100
    I just wonder what sorts of circumstances constitute breaking alliance. Whether it is only attacking an ally, or ending the alliance through diplomacy as well. Or even breaking it passively by simply refusing to join an ally in war.
    Last edited by es157; June 11, 2021 at 06:42 PM.

  4. #4
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,313
    Blog Entries
    28

    Default Re: Making Form/Break Alliance into a trait trigger

    The condition is I_CompareCounter = other then that it should be fine.

    I would think the 'how' is inconsequential when it comes to breaking an alliance where the event is concerned. Only that it got broken. You could however add a faction standing condition in connection with a target faction condition to establish whether war has broken out as consequence of the breaking.
    Last edited by Gigantus; June 11, 2021 at 11:36 PM.




  5. #5

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Gigantus View Post
    The condition is I_CompareCounter = other then that it should be fine.

    I would think the 'how' is inconsequential when it comes to breaking an alliance where the event is concerned. Only that it got broken. You could however add a faction standing condition in connection with a target faction condition to establish whether war has broken out as consequence of the breaking.
    I feared so.

    Thinking broadly, I expect it to take lots of extra work to match each faction to all the others, resulting in hundreds of monitors. Contrast this to the ease with which I came so far lol.

    Another problem apparently is that the dread trait only triggers after the turn ends, rather than immediately after the alliance is broken.

    This doesn't concern me much, however. One thing that does concern me is the following: does the faction that got betrayed also gain dread from the breaking of the alliance?

  6. #6
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,313
    Blog Entries
    28

    Default Re: Making Form/Break Alliance into a trait trigger

    Unlikely that the betrayed gets a malus from the breaking of the alliance other then a faction standing decline towards the betrayer.

    Something on the side: if you use regular counters instead of event counters then you need to declare them (once only) in the script.

    Code:
    declare_counter cersei_breaks_alliance
    monitor_event FactionBreakAlliance FactionType venice
       and I_CompareCounter cersei_breaks_alliance = 0    
       set_counter cersei_breaks_alliance 1
    end_monitor




  7. #7

    Default Re: Making Form/Break Alliance into a trait trigger

    I don't see any mechanism for setting the cersei_breaks_alliance counter back to 0, so this will only fire once - the first time venice breaks an alliance. I'm assuming this is unintentional since you're not terminating the monitor. If you do want this process to loop, you need to pick a suitable event for setting the counter back to 0 which makes sense given the trigger event you're using. You could use FactionTurnEnd as that event happens after CharacterTurnEnd.

    I doubt that FactionBreakAlliance fires for the target faction since this event exports 'faction' and 'target_faction', but you may want to test this. If you want to narrow the conditions for how exactly the alliance was broken, you can use the Transgression event with transgression types such as TC_BROKE_ALLIANCE, TC_NULLIFIED_ALLIANCE, etc. I'm not entire sure what most of these transgression types actually mean as there is no comprehensive list on TWC and they're not in the docudemons. But it may be worth looking into since you're going to be using a bunch of monitors anyway - you could even tie other non-alliance breaking transgression types (blockade, diplomatic insult, bribery, etc.) to traits.

  8. #8

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Gigantus View Post
    Unlikely that the betrayed gets a malus from the breaking of the alliance other then a faction standing decline towards the betrayer.

    Something on the side: if you use regular counters instead of event counters then you need to declare them (once only) in the script.

    Code:
    declare_counter cersei_breaks_alliance
    monitor_event FactionBreakAlliance FactionType venice
       and I_CompareCounter cersei_breaks_alliance = 0    
       set_counter cersei_breaks_alliance 1
    end_monitor
    Oh yes, I'm aware of this, but thanks for the reminder.

  9. #9

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    I don't see any mechanism for setting the cersei_breaks_alliance counter back to 0, so this will only fire once - the first time venice breaks an alliance. I'm assuming this is unintentional since you're not terminating the monitor. If you do want this process to loop, you need to pick a suitable event for setting the counter back to 0 which makes sense given the trigger event you're using. You could use FactionTurnEnd as that event happens after CharacterTurnEnd.

    I doubt that FactionBreakAlliance fires for the target faction since this event exports 'faction' and 'target_faction', but you may want to test this. If you want to narrow the conditions for how exactly the alliance was broken, you can use the Transgression event with transgression types such as TC_BROKE_ALLIANCE, TC_NULLIFIED_ALLIANCE, etc. I'm not entire sure what most of these transgression types actually mean as there is no comprehensive list on TWC and they're not in the docudemons. But it may be worth looking into since you're going to be using a bunch of monitors anyway - you could even tie other non-alliance breaking transgression types (blockade, diplomatic insult, bribery, etc.) to traits.
    Actually I did make a monitor to throw the counter back to zero upon turn end.

    If I had not, I assume the effect would be that the dread trait would be incresed every turn, no? Rather than only once.

    I'll do some testing with all my options, but worst case scenario I'll just assign the same amount of dread regardless of whether the alliance was betrayed or just dissolved. Not ideal, I know, but much easier. I'm still not sure how to proceed with differentiating backstabbings from formal dissolutions.
    Last edited by es157; June 12, 2021 at 08:22 AM.

  10. #10

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by es157 View Post
    If I had not, I assume the effect would be that the dread trait would be incresed every turn, no? Rather than only once.
    Yes, the trigger conditions will always be true so it will increase the trait level every CharacterTurnEnd, but the FactionBreakAlliance monitor, which has a condition that the counter == 0, will only fire once for the first faction that venice breaks an alliance with.

    I suspect that TC_NULLIFIED_ALLIANCE is for when you end an alliance via diplomacy whereas TC_BROKE_ALLIANCE and FactionBrokeAlliance cover everything else (including diplomacy), but this is just an untested guess based on the names.

  11. #11

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    Yes, the trigger conditions will always be true so it will increase the trait level every CharacterTurnEnd, but the FactionBreakAlliance monitor, which has a condition that the counter == 0, will only fire once for the first faction that venice breaks an alliance with.

    I suspect that TC_NULLIFIED_ALLIANCE is for when you end an alliance via diplomacy whereas TC_BROKE_ALLIANCE and FactionBrokeAlliance cover everything else (including diplomacy), but this is just an untested guess based on the names.
    What exactly is this TC_NULLIFIED_ALLIANCE you are talking about? It doesn't look like a monitor condition at all.

  12. #12

    Default Re: Making Form/Break Alliance into a trait trigger

    It's a transgression type.

    Code:
    monitor_event Transgression TransgressionName TC_NULLIFIED_ALLIANCE
    and FactionType venice
    ...
    end_monitor

  13. #13

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    It's a transgression type.

    Code:
    monitor_event Transgression TransgressionName TC_NULLIFIED_ALLIANCE
    and FactionType venice
    ...
    end_monitor
    This looks promising. I had never seen such monitor.

    An update, my efforts have resulted in a crash upon turn end, presumably at the moment when the dread trait was supposed to be assigned. I got the generic error box saying an unspecified error has occurred, which is the most annoying case because it doesn't give an error message in the log.

    This is my full script (I'm doing tests with venice first):

    declare_counter cersei_breaks_alliance

    monitor_event FactionBreakAlliance FactionType venice
    and I_CompareCounter cersei_breaks_alliance = 0
    inc_counter cersei_breaks_alliance 1
    end_monitor


    monitor_event FactionTurnStart FactionType venice
    and I_CompareCounter cersei_breaks_alliance = 1
    set_counter cersei_breaks_alliance 0
    end_monitor
    And this is my entry in EDCT:

    Trigger cersei_breaks_alliance WhenToTest CharacterTurnEnd


    Condition FactionType venice
    and IsFactionLeader
    and I_CompareCounter cersei_breaks_alliance > 0


    Affects StrategyDread 1 Chance 100
    I have a vague suspicion that this could be part of a broader graphic error that keeps tormenting me ever since I installed this game. I have seen several players reporting this problem all over the internet, but no definitive solution was ever found as far as I know.
    Last edited by es157; June 13, 2021 at 09:23 AM.

  14. #14

    Default Re: Making Form/Break Alliance into a trait trigger

    The "unspecified error" crashes usually are in your log if you know what to look for. Other than your WhenToTest event being on the same line as the Trigger name (which I assume was just a formatting accident in your post), I don't see anything that would cause a crash. You can determine if it's this script or something else by simply removing the script and seeing if it still crashes.

  15. #15

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    The "unspecified error" crashes usually are in your log if you know what to look for. Other than your WhenToTest event being on the same line as the Trigger name (which I assume was just a formatting accident in your post), I don't see anything that would cause a crash. You can determine if it's this script or something else by simply removing the script and seeing if it still crashes.
    If you don't see anything wrong with those scripts (neither do I), this increases the likelihood of it being one of those random crashes.

    I will need to address this in a different post in a different section. I suppose Mod Workshop won't be the right place once I start getting into it. My game suffers from an instability problem that people insist can be fixed with Large Address Aware, but either they are wrong or I'm using the LAA the wrong way. I know this is vague but so is the crash I'm getting.

  16. #16

    Default Re: Making Form/Break Alliance into a trait trigger

    That we don't see anything wrong with the script at a glance doesn't really tell us anything about the nature of the crash and shouldn't be used to rule anything out. You need to check your log, change the log settings in the config as needed, and not just assume it will be useless because of the unspecified error report. Post the log here if you want. If the log really doesn't have anything useful, then the next step is to cut your script and see if that resolves the crash. You should be testing every change you make so that when you do encounter crashes with nothing in the log, you will know where to look.

    LAA is a patch for Medieval II's executable, not your mod's data, so your users can apply it to their own game without you having to do anything. All it does is change a single tag to allow a 32-bit program to use 4GB of memory instead of 2GB on a 64-bit OS. This is useful for extending play sessions if your mod has lots of high-detail assets, but it won't fix 99% of the crashes your users are likely to encounter which are actually the result of modder error. I can guarantee that a crash you're seeing on turn 1 as a result of a new trait script is not going to be fixed by LAA. Since DAC and other big mods started including LAA patchers in their downloads, the community has been blindly singing its praises often to the detriment of legitimate bug hunting. LAA is great, but it's not on any list of diagnostic steps.

  17. #17

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    That we don't see anything wrong with the script at a glance doesn't really tell us anything about the nature of the crash and shouldn't be used to rule anything out. You need to check your log, change the log settings in the config as needed, and not just assume it will be useless because of the unspecified error report. Post the log here if you want. If the log really doesn't have anything useful, then the next step is to cut your script and see if that resolves the crash. You should be testing every change you make so that when you do encounter crashes with nothing in the log, you will know where to look.

    LAA is a patch for Medieval II's executable, not your mod's data, so your users can apply it to their own game without you having to do anything. All it does is change a single tag to allow a 32-bit program to use 4GB of memory instead of 2GB on a 64-bit OS. This is useful for extending play sessions if your mod has lots of high-detail assets, but it won't fix 99% of the crashes your users are likely to encounter which are actually the result of modder error. I can guarantee that a crash you're seeing on turn 1 as a result of a new trait script is not going to be fixed by LAA. Since DAC and other big mods started including LAA patchers in their downloads, the community has been blindly singing its praises often to the detriment of legitimate bug hunting. LAA is great, but it's not on any list of diagnostic steps.
    I removed my codes bit by bit and filtered the findings until I came to a conclusion. The line that causes the crash is in EDCT and is the following:

    Trigger cersei_breaks_alliance

    WhenToTest CharacterTurnEnd

    Condition FactionType venice
    and IsFactionLeader
    and I_CompareCounter cersei_breaks_alliance > 0

    Affects StrategyDread 1 Chance 100
    If I add a ; before that line, everything goes back to normal.

    At the very end of my error log, I got these two lines:

    18:06:35.795 [game.script] [error] Script error: internal error : counters stack is empty
    18:06:38.826 [system.rpt] [error] Medieval 2: Total War encountered an unspecified error and will now exit.
    Does that help? I can't figure what an empty stack of counters means, since I have declared the counter in the script.

    I assumed LAA had something to do with it because the error message is the same and because both seem beyond explanation. I guess I've grown a short patience for crashes, because I get them randomly such as when a faction that has too many cities dies out all at once and when I click on too many faction icons one after another in the faction selection menu. I assume those are all due to graphic reasons. Somehow I associated those crashes with the one I'm having now, but seems this one has a different source.
    Last edited by es157; June 13, 2021 at 04:15 PM.

  18. #18

    Default Re: Making Form/Break Alliance into a trait trigger

    Regular counters don't work in other files such as EDCT. If you want to communicate information between CS and any other file, you must use event counters with I_EventCounter (or event_counter in EDB).

    I have always used event counters for communicating with other files, in light of Gigantus' comment above, I figured this was only necessary for EDB and I was just doing it as a convention/preference for the other files. No, turns out it is absolutely necessary. I said before that all the conditions that work in CS also work in EDCT and other trigger files, and this may still be true, but those files cannot 'read' regular counters, only event counters. A Google search for the text of your log error confirms this. When you get a weird error like that, it's usually a good idea to google it with some other key words like "twcenter", "medieval 2" (as TWC's in house search bar is totally useless).

    You haven't provided enough information on the "too many cities" crash to even speculate on. Usually when factions die "unexpectedly" it's because all of their family members died - which can sometimes happen even if the faction has tons of settlements. Here's a likely candidate for an accompanying crash that seems to afflict most mods.

    The menu crash is well known. It's a memory leak related to loading UI elements in the menu. You can induce it regardless of how many elements you have (i.e. how many faction icons). My guess is that a single button in the menu would be enough to cause this crash if you click it furiously enough for a long enough period of time. If you have close to 31 factions and tons of custom battle maps, it will crash immediately switching between those menus and the solution is to use a single image for all of your generic custom battle maps.
    Last edited by Callistonian; June 13, 2021 at 10:51 PM.

  19. #19
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,313
    Blog Entries
    28

    Default Re: Making Form/Break Alliance into a trait trigger

    Personally I prefer event counters as well (slipped up there, can't recall when last I used a counter in EDCT or EDA), afaik the only place where they don't work is battle scripts. Also does away with declaring.

    The menu crash has been circumvented by using faction select screen layouts like the one in my Rise of Kingdoms - essentially using map_fe instead of individual map_[faction] graphics.

    Spoiler for rotk menu laytou




  20. #20

    Default Re: Making Form/Break Alliance into a trait trigger

    Quote Originally Posted by Callistonian View Post
    Regular counters don't work in other files such as EDCT. If you want to communicate information between CS and any other file, you must use event counters with I_EventCounter (or event_counter in EDB).

    I have always used event counters for communicating with other files, in light of Gigantus' comment above, I figured this was only necessary for EDB and I was just doing it as a convention/preference for the other files. No, turns out it is absolutely necessary. I said before that all the conditions that work in CS also work in EDCT and other trigger files, and this may still be true, but those files cannot 'read' regular counters, only event counters. A Google search for the text of your log error confirms this. When you get a weird error like that, it's usually a good idea to google it with some other key words like "twcenter", "medieval 2" (as TWC's in house search bar is totally useless).

    You haven't provided enough information on the "too many cities" crash to even speculate on. Usually when factions die "unexpectedly" it's because all of their family members died - which can sometimes happen even if the faction has tons of settlements. Here's a likely candidate for an accompanying crash that seems to afflict most mods.

    The menu crash is well known. It's a memory leak related to loading UI elements in the menu. You can induce it regardless of how many elements you have (i.e. how many faction icons). My guess is that a single button in the menu would be enough to cause this crash if you click it furiously enough for a long enough period of time. If you have close to 31 factions and tons of custom battle maps, it will crash immediately switching between those menus and the solution is to use a single image for all of your generic custom battle maps.
    This other crash I talked about will soon become a topic of my next posts. I think others may benefit from hearing the solutions. So far, I assume it is graphics related just like the UI switching crash, because it only happens if the faction that dies has a large enough number of settlements to turn rebel at once. I encounter this problem often because my mod has scripts that kill off factions once they run out of generals with the necessary surname. I.e. House Lannister will die out if all generals with the surname Lannister die.

    On the topic at hand, what exactly is the difference between normal counters and event counters? Can I always use event counters in the place of normal counters without the need to adjust anything else?

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
  •