Results 1 to 14 of 14

Thread: Enabling traits and ancillaries to use region label instead of region ID

  1. #1

    Default Enabling traits and ancillaries to use region label instead of region ID

    EDCT and EDA region label converter download

    As part of EBII planning to revise the map, I was made aware of a problem with traits and ancillaries. Conditions testing which region a character is in (IsRegionOneOf), unlike the campaign script, needs to reference a region ID. This ID is volatile, it can change when the map boundaries change for any reason - breaking these conditions. Depending on how widespread you are using region conditions, this can mean a lot of work fixing each time you change the map.

    The region label you define in descr_regions.txt is a constant, and therefore more suitable to reference. I have made a small conversion tool that when run, will convert region label references in EDCT and EDA to region ID using the current map.

    Java source included. Anyone can use it however you like, except copyrighting it.

    -------------

    How does it work

    I read map_regions.tga, descr_regions.txt and imperial_campaign_regions_and_settlement_names.txt in order to make a mapping of region label to region ID and province name.

    It uses Withwnar's logic for assigning region ID, IE traverse map_regions.tga from left to right, top to bottom, and assign an incrementing ID as each new colour is encountered.

    Reading the files export_descr_character_traits_regionlabels.txt and export_descr_ancillaries_regionlabels.txt, I look for references to region labels within straight brackets. Any of these are converted to the region ID, while the rest of the file contents are kept as is. The tool then writes export_descr_character_traits.txt and export_descr_ancillaries.txt with the converted region IDs. The source files remain untouched.

    The mapping of region label to region ID is also printed to the console output, to aid making the files use labels in the first place.

    -------------

    Benefits

    EDCT and EDA will no longer be impacted by any map changes short of removing a referenced region, or changing the region labels. This means map changes are less costly.

    Drawbacks
    EDCT and EDA editing can no longer happen directly in EDCT and EDA, but will need to be done in two other files as described above. These have identical structure as the original files. The tool must be run each time you have made any edit to either of those files, to make it readable by the game engine. This means another step in the workflow.

    -------------

    Setup

    1. Make a backup of EDCT and EDA. Keep these until you are certain the tool works for you.

    2. Ensure you have Java.

    3. Download the zip file at the top of this post. Unpack to anywhere you like.

    4. Edit the runConversion.bat file. You need to tell it where your mod data folder is, and which map folder to read map_regions.tga from (base, imperial_campaign or similar). The default works for EBII and looks like this:
    Code:
    set DATAFOLDER=../../../mods/EBII/data
    set MAPFOLDER=world/maps/base
    5. Copy your export_descr_character_traits.txt to export_descr_character_traits_regionlabels.txt

    6. Copy your export_descr_ancillaries.txt to export_descr_ancillaries_regionlabels.txt

    7. Run the conversion tool. It should not find any region labels to convert, but will output the mapping of region label and ID, aiding you in the one-time task of changing the IDs to labels.

    8. Change the current region IDs to region labels using the format detailed below.

    9. Run the conversion tool. Verify that the outputted EDCT and EDA becomes the same as the original files were.

    -------------

    Regular use
    After any edit of EDCT or EDA, double click runConversion.bat. Wait some seconds until complete.

    -------------

    Format of region labels
    You can find the labels for your own regions in descr_regions.txt. The bolded line contains the important bit for this tool.

    Quote Originally Posted by descr_regions.txt
    region_090 - the region label or internal name
    sett_090 - the settlement label or internal name
    f_kh - the initial faction owning the province
    Heilotes - Name of spawned armies' people
    244 13 24 - Colour code for the region in map_regions.tga (RGB)
    hr_a, hr_h, hr_i, hr_j, greek1, achaenleague - hidden resources
    5 - triumph point value (relic from RTW no doubt)
    1 - base farm income level
    religions { rel_a 0 rel_b 0 rel_c 0 rel_d 0 rel_e 0 rel_f 0 rel_g 0 rel_h 100 rel_i 0 rel_x 0 }
    The basic format to use in EDCT/EDA is flat braces with the region label inside. You can add an optional description using the equals sign after the region label, and anything from there is ignored. The description is meant to make the code more human readable than a numeric label (or ID!) can be. Valid ways to write it thus include:

    [region_090] - only the region label
    [region_090=Lakonike] - region label and province name
    [region_090=Spartan krypteia after agoge requires staying in the Lakonike region] - region label and freeform text description
    [region_148=Sakasthane] [region_065=Kushi-Yapoy] [region_150=Sakanu Kshaharae] - a set of three regions, all part of the same condition and each with their description

    An example from EBII's EDCT:
    Code:
    ;------------------------------------------
    Trigger Spartan_Krypteia_Progress
      WhenToTest CharacterTurnEnd
    
      Condition IsRegionOneOf [region_090=Lakonike]
            and Trait AgogeKrypteia = 1
    
      Affects AgogeProgressCounter  1  Chance  100
    After conversion, this turns into
    Code:
    ;------------------------------------------
    Trigger Spartan_Krypteia_Progress
      WhenToTest CharacterTurnEnd
    
      Condition IsRegionOneOf 164
            and Trait AgogeKrypteia = 1
    
      Affects AgogeProgressCounter  1  Chance  100
    Last edited by bovi; August 31, 2018 at 05:55 AM. Reason: Updated download file to TWCenter files archive

    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
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    Good stuff! Region IDs are a pain.

    By "region label" I assume you mean the internal name. So in vanilla M2TW it would be for example "Condition IsRegionOneOf [London_Province]".

    While your tool's at it, perhaps it could auto-add a comment saying what the region/settlement name/label is...

    Code:
    Condition IsRegionOneOf 12 ;London_Province, London, whatever
    It would avoid the need for the modder to go and find out what region 12 is.

  3. #3

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    That's right, I mean the internal name. The province displayed name should not be used for this purpose as it is prone to change, at least in certain mods like EBII where historians can decide the name isn't precisely right - we have had 9 such changes this year alone! The internal name has very little reason to change, so it is a far better anchor.

    Very good idea to automatically add the province name to a comment behind. I'll make that change pronto.

    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

  4. #4

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    I made that change. Turns out it doesn't like special characters in province names very well, as you can see below. But that is probably only a concern for EB I think.

    Code:
    ;------------------------------------------
    Trigger trigger_asanan_fighter
      WhenToTest CharacterTurnEndInSettlement
        Condition RemainingMPPercentage > 85
              and IsRegionOneOf 008 009 007   ; Sakasthanļæ½, Kushi-Yapoy, Sakanu Kshaharae
              and Attribute Command > 2
              and Trait AncillariesAvailable > 0
              and RandomPercent < 51
              and CultureType cul_6
              and IsGeneral
              and not HasAncType Asanan_fighter
    
      Affects AncillaryGained  1  Chance  100
      Affects Coward  1  Chance  25
      Affects Paranoia  1  Chance  25
      Affects HighPersonalSecurity  1  Chance  75
      AcquireAncillary asanan_fighter Chance  100

    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
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    Turns out it doesn't like special characters in province names very well
    EDCT and EDA are ANSI format. They don't support extended ASCII characters and probably best not to put any in there. Plenty of other mods would use extended ASCII characters in their game names, I'm sure.

    I meant the internal region and/or settlement name, not the game names. e.g. London_Province and London are both internal names. Even in EBII, region_090 can easily be looked up by the modder if they can't remember what region that is. Whereas trying to figure what region "region id X" is requires some hoop jumping.

    Alternatively, you could translate the game names into pure ASCII (ANSI). I have Java code for it you want it (PM me).

  6. #6

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    Adding internal name to that comment doesn't add anything, it would only echo what you already have in the file you should be editing in the first place. The province name in the comment adds the ability to verify (with human eyes) that the region label you wrote turned out correct.

    As described under the drawbacks heading, using this tool imposes a change in the normal workflow. In order for this tool to be used, you would have to shift over to editing the file with region labels, rather than the one with region ID that the game uses, then run the conversion each time you make a change.

    If you keep editing the regular EDCT / EDA, the one with region labels would become outdated. It would then be unusable, as once you ran the conversion again, the EDCT / EDA would be overwritten with the old code!

    It is a tradeoff. Add a few seconds (running the conversion tool) to each edit of traits and ancillaries, in exchange for never worrying about region IDs again.

    ----------

    I'll translate the game names to ANSI then I think. I'll try to find it myself and will PM you if I fail to do that easily.

    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: Enabling traits and ancillaries to use region label instead of region ID

    Turns out the special character wasn't all that special, it was an 'ę', which is perfectly fine in ANSI. Unfortunately, I was writing the file using the default character set, which seems to be UTF-8.

    I changed to write using Windows-1252 instead, that works for all I have tested with. Just in case someone uses a non-ANSI character, I also added normalization of the province names.

    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

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    Thanks for publishing your tool here - it will come handy, that's for sure.

    May I suggest to upload and link it to our download center (M2TW\tools) so the original won't get lost? It can be easily updated should it be necessary, doing away with the need to change links.
    Last edited by Gigantus; August 28, 2018 at 02:02 AM.










  9. #9

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    OK, done!

    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

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

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    just a question:

    i have created a trait called office_dux_silekias. this trait is given to a governor of a themes, which historical constist of 5-8 settlements in our map.
    the trait has 8 levels and i want to trigger one level, depending on the ownership of the region. so if 4 settlements out of 8 are in possession of the faction, the trait is at level 4. if the faction loose a settlement, he went down to 3 or vica versa.

    i“ve create a small script in campaign_script.txt that checks the ownership of the regions, but my triggers in edct will count all negatives too. so if i hold just 1 region - the level goes one up and 7 down - meaning the trait disapear from the character.

    Spoiler Alert, click show to read: 
    Code:
    ;---- next is the region test for the trait level of strategos of sicilia
    
        set_event_counter syraere 0
        set_event_counter mudiere 0
        set_event_counter ennaere 0
        set_event_counter mazzere 0
        set_event_counter paleere 0
        set_event_counter messere 0
    
    
        monitor_event FactionTurnStart FactionType byzantium
    
    
            if I_SettlementOwner Syracuse = byzantium
                set_event_counter syraere 1
            end_if
            if I_SettlementOwner Mudiqah = byzantium
                set_event_counter mudiere 1
            end_if
            if I_SettlementOwner Enna = byzantium
                set_event_counter ennaere 1
            end_if
            if I_SettlementOwner Mazzara = byzantium
                set_event_counter mazzere 1
            end_if
            if I_SettlementOwner Palermo = byzantium
                set_event_counter paleere 1
            end_if
            if I_SettlementOwner Messina = byzantium
                set_event_counter messere 1
            end_if
            if not I_SettlementOwner Syracuse = byzantium
                set_event_counter syraere 0
            end_if
            if not I_SettlementOwner Modica = byzantium
                set_event_counter mudiere 0
            end_if
            if not I_SettlementOwner Enna = byzantium
                set_event_counter ennaere 0
            end_if
            if not I_SettlementOwner Mazzara = byzantium
                set_event_counter mazzere 0
            end_if
            if not I_SettlementOwner Palermo = byzantium
                set_event_counter paleere 0
            end_if
            if not I_SettlementOwner Messina = byzantium
                set_event_counter messere 0
            end_if
    
    
        end_monitor
    Code:
    ;--------------------------
    ; -- ERE Thematic Traits
    ;--------------------------
    
    
    Trait office_dux_silekias
        Characters family
        AntiTraits Former_Strategos
    
    
        Level office_dux_silekias1
            Description office_dux_silekias1_desc
            EffectsDescription office_dux_silekias1_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  1 
    
    
            Effect PersonalSecurity  1
    
    
        Level office_dux_silekias2
            Description office_dux_silekias2_desc
            EffectsDescription office_dux_silekias2_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  2 
    
    
            Effect Authority  1
            Effect PersonalSecurity  1
            Effect Command  1
    
    
        Level office_dux_silekias3
            Description office_dux_silekias3_desc
            EffectsDescription office_dux_silekias3_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  3 
    
    
            Effect Authority  1
            Effect PersonalSecurity  1
            Effect Command  1
            Effect Influence  1
    
    
        Level office_dux_silekias4
            Description office_dux_silekias4_desc
            EffectsDescription office_dux_silekias4_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  4 
    
    
            Effect Authority  1
            Effect PersonalSecurity  1
            Effect Command  2
            Effect Influence  1
    
    
        Level office_dux_silekias5
            Description office_dux_silekias5_desc
            EffectsDescription office_dux_silekias5_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  5 
    
    
            Effect Authority  1
            Effect PersonalSecurity  2
            Effect Command  2
            Effect Influence  2
    
    
        Level office_dux_silekias6
            Description office_dux_silekias6_desc
            EffectsDescription office_dux_silekias6_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  6 
    
    
            Effect Authority  2
            Effect PersonalSecurity  2
            Effect Command  2
            Effect Influence  3
    
    
        Level office_dux_silekias7
            Description office_dux_silekias7_desc
            EffectsDescription office_dux_silekias7_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  7 
    
    
            Effect Authority  2
            Effect PersonalSecurity  2
            Effect Command  3
            Effect Influence  3
    
    
        Level office_dux_silekias8
            Description office_dux_silekias8_desc
            EffectsDescription office_dux_silekias8_effects_desc
            Epithet office_dux_silekias_epithet_desc
        Threshold  8 
    
    
            Effect Authority  2
            Effect PersonalSecurity  3
            Effect Command  3
            Effect Influence  4
    
    
    
    
    ;------------------------------------------
    Trait Former_Strategos
        Characters family
        AntiTraits office_dux_silekias
    
    
        Level Former_Strategos
            Description Former_Strategos_desc
            EffectsDescription Former_Strategos_effects_desc
            Threshold  1
    
    
    ;------------------------------------------
    ; -- ERE Thematic Traits TRIGGERS
    ;------------------------------------------
    Trigger get_office_dux_silekias_title1
        WhenToTest CharacterTurnEnd
    
    
        Condition not IsFactionAIControlled
            and IsGeneral
            and HasAncType office_dux_silekias
            and Trait office_dux_silekias = 0
            and FactionType byzantium
            and not IsFactionHeir
            and not IsFactionLeader
    
    
        Affects office_dux_silekias  1  Chance  100
        Affects ContentGeneral  1  Chance  100
    
    
    ;------------------------------------------
    Trigger get_office_dux_silekias_title2
        WhenToTest CharacterSelected
    
    
        Condition not IsFactionAIControlled
            and IsGeneral
            and I_EventCounter office_dux_silekias = 1
            and FactionType byzantium
            and not IsFactionHeir
            and not IsFactionLeader
    
    
        Affects office_dux_silekias  1  Chance  100
        Affects ContentGeneral  1  Chance  100
    
    
    ;------------------------------------------
    Trigger lose_office_dux_silekias_title1
        WhenToTest CharacterSelected
    
    
        Condition Trait office_dux_silekias > 1
            and I_EventCounter office_dux_silekias = 3
            and FactionType byzantium
            and not IsFactionAIControlled
    
    
        Affects Former_Strategos   1  Chance  100
        Affects DiscontentGeneral  1  Chance  100
    
    
    ;------------------------------------------
    Trigger lose_office_dux_silekias_title2
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait office_dux_silekias > 1
            and I_EventCounter office_dux_silekias = 4
            and FactionType byzantium
            and not IsFactionAIControlled
    
    
        Affects Former_Strategos  1  Chance  100
        Affects DiscontentGeneral  1  Chance  100
    
    
    ;------------------------------------------
    Trigger AI_get_trait_office_dux_silekias_title1
        WhenToTest CharacterTurnEnd
    
    
        Condition IsFactionAIControlled
            and HasAncType office_dux_silekias
            and Trait office_dux_silekias = 0
    
    
        Affects ContentGeneral  1  Chance  100
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncountsyracuse1
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter syraere = 1
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncountsyracuse2
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter syraere = 0
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  -1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountMessina1
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter messere = 1
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountMessina2
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter messere = 0
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  -1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountPalermo1
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter paleere = 1
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountPalermo2
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter paleere = 0
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  -1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountMazzara1
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter mazzere = 1
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountMazzara2
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter mazzere = 0
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  -1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountEnna1
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter ennaere = 1
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountEnna2
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter ennaere = 0
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  -1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountModica1
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter mudiere = 1
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  1  Chance  100
    
    
    ;------------------------------------------
    Trigger office_dux_silekias_RegioncountModica2
        WhenToTest CharacterTurnStart
    
    
        Condition I_EventCounter mudiere = 0
            and HasAncType office_dux_silekias
    
    
        Affects office_dux_silekias  -1  Chance  100


    is there a easy way to check how many regions are hold by the faction or conquered/lost and set the affect on this condition?
    I“m thinking of creating a secondary script that will check, if one of the regions is just beeing conquered - using the monitor:

    Code:
        monitor_event GeneralCaptureSettlement SettlementName Syracuse
        end_monitor
    Last edited by _Tartaros_; October 04, 2019 at 03:14 AM.

  11. #11
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    is there a easy way to check how many regions are hold by the faction or conquered/lost and set the affect on this condition?
    Assuming that you don't need event counters capturing which settlements are owned, only how many are, then one will do it...

    Code:
    monitor_event GeneralCaptureSettlement
    
      campaign_wait 0.1 ;need this to allow ownership change to take effect
      
      inc_event_counter set_ods_count 1
    
    end_monitor
    
    monitor_event GiveSettlement
      inc_event_counter set_ods_count 1
    end_monitor
    
    monitor_event PreFactionTurnStart FactionType byzantium
      inc_event_counter set_ods_count 1
    end_monitor
    
    monitor_event EventCounter EventCounterType set_ods_count
      and EventCounter > 0
    
      set_event_counter ods_count 0  
    
      if I_SettlementOwner Syracuse = byzantium
        inc_event_counter ods_count 1
      end_if
      if I_SettlementOwner Mudiqah = byzantium
        inc_event_counter ods_count 1
      end_if
      if I_SettlementOwner Enna = byzantium
        inc_event_counter ods_count 1
      end_if
      if I_SettlementOwner Mazzara = byzantium
        inc_event_counter ods_count 1
      end_if
      if I_SettlementOwner Palermo = byzantium
        inc_event_counter ods_count 1
      end_if
      if I_SettlementOwner Messina = byzantium
        inc_event_counter ods_count 1
      end_if
    
    end_monitor
    The first three monitors trigger the last one. The first two are only needed if the trait is being updated during the turn, but then you'd need some way to *make that* trait update during the turn, e.g. CharacterSelected triggers in EDCT.

    GeneralCaptureSettlement also handles the "gone rebel" case.

    but my triggers in edct will count all negatives too
    Yeah, don't do that.

    Every time the trait needs calculating, first set it back to level 0 (for anybody who as it), then set the level based on the event counter value...

    Code:
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount1
        WhenToTest CharacterTurnStart
    
        Condition Trait office_dux_silekias > 0        
    
        Affects office_dux_silekias  -999  Chance  100 ;set the level back to 0
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount2
        WhenToTest CharacterTurnStart
    
        Condition I_EventCounter ods_count = 1
            and HasAncType office_dux_silekias
    
        Affects office_dux_silekias  1  Chance  100
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount3
        WhenToTest CharacterTurnStart
    
        Condition I_EventCounter ods_count = 2
            and HasAncType office_dux_silekias
    
        Affects office_dux_silekias  2  Chance  100
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount4
        WhenToTest CharacterTurnStart
    
        Condition I_EventCounter ods_count = 3
            and HasAncType office_dux_silekias
    
        Affects office_dux_silekias  3  Chance  100
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount5
        WhenToTest CharacterTurnStart
    
        Condition I_EventCounter ods_count = 4
            and HasAncType office_dux_silekias
    
        Affects office_dux_silekias  4  Chance  100
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount6
        WhenToTest CharacterTurnStart
    
        Condition I_EventCounter ods_count = 5
            and HasAncType office_dux_silekias
    
        Affects office_dux_silekias  5  Chance  100
    
    ;------------------------------------------
    Trigger office_dux_silekias_Regioncount7
        WhenToTest CharacterTurnStart
    
        Condition I_EventCounter ods_count = 6
            and HasAncType office_dux_silekias
    
        Affects office_dux_silekias  6  Chance  100
    The first trigger works because a trait level can not go below 0. Rather than figure out what level he currently has and subtract that number from his trait, just subtract more than he could possibly have; it will result in 0.

    If you want it updated during the turn too, e.g. after capturing one of the settlements, then duplicate all of those (including the first one) and change their CharacterTurnStart to CharacterSelected.

    You have a bunch of other triggers in yours and an AntiTrait. e.g. You're setting the trait to level 1 when they have the anc, whereas your problem description is saying it should be 1 only when they own one of the regions. Plus they make use of a "office_dux_silekias" event counter. These things, and the AntiTrait, will likely prevent my triggers from working correctly.

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

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    damn - that will do it!! the "inc counter" - i was thinking to complicated
    Thank you alot for the fast responds - give it a go

    the idea behind the antitrait is, that the trait will loose all points and the character is marked with negativ affects. i“ve also resetted the traitlevels. 1 = no regions hold - but he has the ancillary, 2 = 1 Region a.s.o.
    Last edited by _Tartaros_; October 07, 2019 at 02:44 AM.

  13. #13

    Default Re: Enabling traits and ancillaries to use region label instead of region ID

    This tool has got some recent changes:

    Modified the comments put in the output file to take whatever is set after the equals sign when encountered, rather than hardcoded to use the province name. If no descriptive text is provided, the province name is still output.
    Now compiled for Java 8 rather than 1.6.
    No longer pauses indefinitely after running, but only 2 seconds.
    Special characters like 'ę' are now read correctly from the source files.
    The list of regions is no longer output as a human sentence, but rather as a code ready for pasting into your regionlabels EDCT / EDA over the region ID.

    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: Enabling traits and ancillaries to use region label instead of region ID

    How I did this setup for EB2, in case that will help others.

    Copy the current EDCT to export_descr_character_traits_regionlabels.txt.
    Copy the current EDA to export_descr_ancillaries_regionlabels.txt.

    The old EDCT and EDA are no longer to be edited, as they will be generated from the region labels versions instead.

    Run the conversion tool to get a list of what region IDs currently mean.
    Spoiler Alert, click show to read: 
    Region ID 112: [region_040=Latium(Roma)]
    Region ID 169: [region_170=Zeugitana(Qart-Hadasht)]
    Region ID 141: [region_087=Thessalia(Demetrias)]
    Region ID 134: [region_083=Epeiros(Ambrakia)]
    Region ID 151: [region_088=Attike(Athenai)]
    Region ID 147: [region_122=Mesopotamia(Seleukeia)]
    Region ID 184: [region_178=Delta Neilou(Alexandreia)]
    Region ID 065: [region_140=Baktriane(Baktria)]
    Region ID 086: [region_114=Mets Hayk(Armavir)]
    Region ID 110: [region_104=Kappadokia Pontika(Amaseia)]
    Region ID 057: [region_154=Dahyu Daha(Nisaya)]
    Region ID 050: [region_111=Talaeduoi(Bibrakte)]
    Region ID 069: [region_024=Aruernselua(Gergouia)]
    Region ID 032: [region_007=Albion(Maidunon)]
    Region ID 106: [region_010=Lusitania(Turgi)]
    Region ID 021: [region_055=Ermunahaimaz(Leufana)]
    Region ID 062: [region_077=Getia(Kapidava)]
    Region ID 196: [region_193=Saba'(Maryab)]
    Region ID 132: [region_097=Mysia(Pergamon)]
    Region ID 008: [region_148=Sakasthanę(Rudhtadarę)]
    Region ID 004: [region_158=Khsaitai Ubastra(Khsaitai Zakhtę)]
    Region ID 168: [region_167=Numidia(Kirtan)]
    Region ID 052: [region_144=Gandhara(Taksashila)]
    Region ID 049: [region_162=Bosporion Tyrranesis(Pantikapaion)]
    Region ID 031: [region_060=Widura(Lugidunon)]
    Region ID 099: [region_015=Celtiberia(Sekeiza)]
    Region ID 044: [region_054=Boiotergion(Streuinta)]
    Region ID 181: [region_189='Edum(Rekem)]
    Region ID 013: [region_001=Iuerion(Isamnion)]
    Region ID 010: [region_002=Kaledonon(Dunopalator)]
    Region ID 085: [region_003=Histria kai Liburnia(Nesakton)]
    Region ID 014: [region_004=Legambrion(Alauna)]
    Region ID 018: [region_005=Belerion(Moridunon)]
    Region ID 023: [region_006=Arduon(Pennocrugon)]
    Region ID 027: [region_008=Kantion(Durowernon)]
    Region ID 080: [region_009=Callaecia(Brigantion)]
    Region ID 127: [region_011=Baeturia(Nertobriga)]
    Region ID 137: [region_012=Turdetania-Baeturia(Gader)]
    Region ID 138: [region_013=Bastetania(Mastia)]
    Region ID 107: [region_014=Celtiberia-Carpetania(Kontrebia)]
    Region ID 084: [region_016=Asturia-Kantabria(Moroika)]
    Region ID 094: [region_017=Ilergetia(Iltirta)]
    Region ID 115: [region_018=Edetania(Arsé)]
    Region ID 108: [region_019=Lacetania(Emporion)]
    Region ID 043: [region_020=Aremorika(Kondates)]
    Region ID 059: [region_021=Kimusta Piktonis(Lemonon)]
    Region ID 074: [region_022=Akuitanon(Iliberri)]
    Region ID 082: [region_023=Kimusta Uolkias(Tolosa)]
    Region ID 055: [region_025=Uika Biturigeis(Auarikon)]
    Region ID 046: [region_026=Brogis Aulerikon(Autrikon)]
    Region ID 036: [region_027=Eturomina(Batumacos)]
    Region ID 054: [region_028=Akitosekuanoi(Uesontiu)]
    Region ID 070: [region_029=Etusenonis(Lugdunon)]
    Region ID 096: [region_030=Uika Saluuion(Massalia)]
    Region ID 075: [region_031=Insubrabrogis(Medilanon)]
    Region ID 060: [region_032=Raition(Kambodunon)]
    Region ID 048: [region_033=Dekamatoi(Tarodunon)]
    Region ID 030: [region_034=Landa Pelignon(Nemetokena)]
    Region ID 087: [region_035=Liguria(Albabagenna)]
    Region ID 076: [region_036=Venetia(Patava)]
    Region ID 088: [region_037=Konnion Boion(Felsina)]
    Region ID 100: [region_038=Etruria(Arretium)]
    Region ID 097: [region_039=Umbria(Ariminum)]
    Region ID 124: [region_041=Daunia(Arpi)]
    Region ID 128: [region_042=Campania(Capua)]
    Region ID 140: [region_043=Brettia(Rhegion)]
    Region ID 131: [region_044=Messapia(Taras)]
    Region ID 159: [region_045=Elimya(Lilubim)]
    Region ID 154: [region_046=Sicilia(Messana)]
    Region ID 167: [region_047=Trinakrie(Syrakousai)]
    Region ID 111: [region_048=Korsim(Alali)]
    Region ID 130: [region_049=Sardin(Nurri)]
    Region ID 139: [region_050=Baleares(Iboshim)]
    Region ID 047: [region_051=Herkunion(Alkimoennos)]
    Region ID 028: [region_052=Raurikon(Bogadunon)]
    Region ID 035: [region_053=Moenon(Ubioidunon)]
    Region ID 011: [region_056=Ingwingoz(Himbroburgz)]
    Region ID 001: [region_057=Skašinauja(HleifŽoz)]
    Region ID 053: [region_058=Trinakarta(Sagala)]
    Region ID 033: [region_059=Erkuni(Luppae)]
    Region ID 019: [region_061=Mateliludis(Scurgum)]
    Region ID 025: [region_062=Lugiutauta(Kalisia)]
    Region ID 041: [region_063=Kottinon(Asanka)]
    Region ID 039: [region_064=Tyragetia(Klepidava)]
    Region ID 009: [region_065=Kushi-Yapoy(Kushi)]
    Region ID 012: [region_066=Aistitrenta(Waldawa)]
    Region ID 003: [region_067=Merimekhe(Jukelitna)]
    Region ID 051: [region_068=Oxeiane(Oskobara)]
    Region ID 017: [region_069=Gelonja(Zemegordah)]
    Region ID 045: [region_070=Varustana(Skythiapolis)]
    Region ID 081: [region_071=Nantus Allobrogon(Uiennos)]
    Region ID 038: [region_072=Mediomatrebo(Diuoduron)]
    Region ID 077: [region_073=Pannonia(Segestika)]
    Region ID 066: [region_074=Etunorikoi(Noreia)]
    Region ID 063: [region_075=Eramiski(Gorsissa)]
    Region ID 061: [region_076=Daouia(Zermizegetusa)]
    Region ID 079: [region_078=Mikra Skythia kai Pentapolis(Histrie)]
    Region ID 090: [region_079=Moisia(Zikideva)]
    Region ID 078: [region_080=Landa Skordiskoi(Singidunon)]
    Region ID 095: [region_081=Delmatia(Delminion)]
    Region ID 121: [region_082=Illyria Hellenike(Dyrrachion)]
    Region ID 146: [region_084=Aitolia(Thermon)]
    Region ID 102: [region_085=Dardania kai Paionia(Dardanion)]
    Region ID 125: [region_086=Makedonia(Pella)]
    Region ID 155: [region_089=Peloponnesos(Korinthos)]
    Region ID 164: [region_090=Lakonike(Sparte)]
    Region ID 175: [region_091=Krete(Knossos)]
    Region ID 015: [region_092=Wenetwa(Gallwagardas)]
    Region ID 170: [region_093=Rhodos(Rhodos)]
    Region ID 103: [region_094=Thraike(Kabula)]
    Region ID 116: [region_095=Chersonesos Thraikike kai Bosporos Thraikios(Byzantion)]
    Region ID 117: [region_096=Bithynia(Nikaia)]
    Region ID 148: [region_098=Ionia(Ephesos)]
    Region ID 149: [region_099=Lydia(Sardis)]
    Region ID 156: [region_100=Karia(Halikarnassos)]
    Region ID 152: [region_101=Pamphylia(Side)]
    Region ID 135: [region_102=Phrygia(Ipsos)]
    Region ID 126: [region_103=Galatia(Ankyra)]
    Region ID 098: [region_105=Paphlagonia(Sinope)]
    Region ID 089: [region_106=Pontos Paralios(Trapezous)]
    Region ID 122: [region_107=Kappadokia(Mazaka)]
    Region ID 133: [region_108=Kilikia(Tarsos)]
    Region ID 101: [region_109=Pokr Hayk(Ani-Kamah)]
    Region ID 068: [region_110=Egrisi(Kutatisi)]
    Region ID 071: [region_112=Kartli(Mtskheta)]
    Region ID 064: [region_113=Aghvank(Kabalaka)]
    Region ID 091: [region_115=Adurbadegan(Ganzak)]
    Region ID 118: [region_116=Tsopk(Shamushat)]
    Region ID 161: [region_117=Kypros(Salamis)]
    Region ID 145: [region_118=Syria(Antiocheia)]
    Region ID 171: [region_119=Syria Koile(Damaskos)]
    Region ID 136: [region_120=Assyrie(Edessa)]
    Region ID 114: [region_121=Adiabene(Arbela)]
    Region ID 157: [region_123=Babylonia(Babylon)]
    Region ID 119: [region_124=Media(Ekbatana)]
    Region ID 142: [region_125=Elymais(Sousa)]
    Region ID 163: [region_126=Mesene(Antiocheia Sousianes)]
    Region ID 158: [region_127=Persis(Persepolis)]
    Region ID 129: [region_128=Gabiene(Aspadana)]
    Region ID 123: [region_129=Khoarene(Apameia)]
    Region ID 083: [region_130=Hyrkania(Zadrakarta)]
    Region ID 073: [region_131=Astauene(Asaak)]
    Region ID 092: [region_132=Parthyaia(Hekatompylos)]
    Region ID 058: [region_133=Margiane(Antiocheia Margianes)]
    Region ID 093: [region_134=Areia(Antiocheia Ariois)]
    Region ID 120: [region_135=Zarangai(Prophthasia)]
    Region ID 153: [region_136=Karmania(Alexandreia Karmania)]
    Region ID 150: [region_137=Gedrosia(Pura)]
    Region ID 113: [region_138=Rakhvad(Alexandreia Arachosias)]
    Region ID 072: [region_139=Paropamisadai(Kapisha)]
    Region ID 040: [region_141=Sogdiane(Marakanda)]
    Region ID 020: [region_142=Skythia(Alexandreia-Eschate)]
    Region ID 037: [region_143=Dahyu Haomavarga(Haomavarganu Agu)]
    Region ID 105: [region_145=Saptasindavah(Opiana)]
    Region ID 143: [region_146=Sauvira(Patala)]
    Region ID 016: [region_147=Sakanu Gara(Shahr)]
    Region ID 022: [region_149=Kangha(Chach)]
    Region ID 007: [region_150=Sakanu Kshaharae(Sakanu Agu)]
    Region ID 006: [region_151=Alantai Ubastra(Alantai Zakhtę)]
    Region ID 026: [region_152=Mazsakatai Ubastra(Bukharak)]
    Region ID 029: [region_153=Khwarazm(Khwarazm)]
    Region ID 005: [region_155=Aursatai Ubastra(Aursatai Zakhtę)]
    Region ID 144: [region_156=Saurashtra(Girnar)]
    Region ID 188: [region_157=Lihyan(Dedan)]
    Region ID 024: [region_159=Iwzagtai Ubastra(Iwzagtai Zakhtę)]
    Region ID 042: [region_160=Maiotis(Paniardis)]
    Region ID 067: [region_161=Taurike Khersonesos(Khersonesos)]
    Region ID 160: [region_163=Mauretania(Likash)]
    Region ID 109: [region_164=Illyria(Skodra)]
    Region ID 172: [region_165=Mauretania Massaesili(Sigan)]
    Region ID 165: [region_166=Mashiliem(Iykoshim)]
    Region ID 179: [region_168=Gaetulia(Tuat)]
    Region ID 166: [region_169=Atig(Atig)]
    Region ID 176: [region_171=Byzacena(Adrumet)]
    Region ID 185: [region_172=Phasania(Garama)]
    Region ID 182: [region_173=Syrthim(Lapqi)]
    Region ID 183: [region_174=Kyrenaia(Kyrene)]
    Region ID 174: [region_175=Numidia Massylii(Capsa)]
    Region ID 186: [region_176=Libye(Ammon)]
    Region ID 056: [region_177=Megale Skythia(Olbia)]
    Region ID 187: [region_179=Heptanomis(Memphis)]
    Region ID 189: [region_180=Thebais(Diospolis-Megale)]
    Region ID 034: [region_181=Khsiragatai Ubastra(Khsiragatai Zakhtę)]
    Region ID 192: [region_182=Oasis Megale(Hibis)]
    Region ID 194: [region_183=Triakontaschoinos(Pselkis)]
    Region ID 195: [region_184=Kush(Meroe)]
    Region ID 193: [region_185=Erythraia(Ptolemais Theron)]
    Region ID 198: [region_186=Di'amat(Axum)]
    Region ID 104: [region_187=Medea Rhagiana(Europos)]
    Region ID 173: [region_188=Syria kai Phoinike(Ptolemais-Akko)]
    Region ID 162: [region_190='Aram(Tadmur)]
    Region ID 177: [region_191=Hawran(Bostra)]
    Region ID 191: [region_192=Ma'in(Najran)]
    Region ID 197: [region_194=Qatabān(Timna')]
    Region ID 190: [region_195=Hadramawt(Shabwat)]
    Region ID 199: [region_196=Himyarum(Zafar)]
    Region ID 180: [region_197=Maka(Mleiha)]
    Region ID 178: [region_198=Gerrhaia Arabia(Gerrha)]
    Region ID 002: [region_199=Eremos(Terhazza)]


    In the EDCT and EDA, search for all occurrences of IsRegionOneOf. Example:
    Trigger Suren_King_In_India
    WhenToTest CharacterTurnEndInSettlement

    Condition FactionType f_parthia
    and Trait MinorKing < 2
    and not IsFactionLeader
    and Trait ParthiaSuren > 2
    and Attribute Piety > 4
    and I_FactionLeaderAttribute f_parthia Authority < 4
    and IsRegionOneOf 52 53 105 113 143 144 ;;; list of regions with "indo" hidden resource
    and GovernorBuildingExists = parth_indo

    Affects MinorKing 1 Chance 100
    For each region ID in the list, look up the ID in the list of regions (the spoiler above). Copy the stuff for the region in question and paste into the trigger code:

    and IsRegionOneOf [region_144=Gandhara(Taksashila)] 53 105 113 143 144 ;;; list of regions with "indo" hidden resource

    and IsRegionOneOf [region_144=Gandhara(Taksashila)] [region_058=Trinakarta(Sagala)] 105 113 143 144 ;;; list of regions with "indo" hidden resource

    and IsRegionOneOf [region_144=Gandhara(Taksashila)] [region_058=Trinakarta(Sagala)] [region_145=Saptasindavah(Opiana)] 113 143 144 ;;; list of regions with "indo" hidden resource

    (continue until all are replaced and it looks like this)
    Trigger Suren_King_In_India
    WhenToTest CharacterTurnEndInSettlement

    Condition FactionType f_parthia
    and Trait MinorKing < 2
    and not IsFactionLeader
    and Trait ParthiaSuren > 2
    and Attribute Piety > 4
    and I_FactionLeaderAttribute f_parthia Authority < 4
    and IsRegionOneOf [region_144=Gandhara(Taksashila)] [region_058=Trinakarta(Sagala)] [region_145=Saptasindavah(Opiana)] [region_138=Rakhvad(Alexandreia Arachosias)] [region_146=Sauvira(Patala)] [region_156=Saurashtra(Girnar)] ;;; list of regions with "indo" hidden resource
    and GovernorBuildingExists = parth_indo

    Affects MinorKing 1 Chance 100
    Run the tool. Now EDCT is overwritten and the trigger becomes like this:

    Trigger Suren_King_In_India
    WhenToTest CharacterTurnEndInSettlement

    Condition FactionType f_parthia
    and Trait MinorKing < 2
    and not IsFactionLeader
    and Trait ParthiaSuren > 2
    and Attribute Piety > 4
    and I_FactionLeaderAttribute f_parthia Authority < 4
    and IsRegionOneOf 52 53 105 113 143 144 ;;; list of regions with "indo" hidden resource; Gandhara(Taksashila), Trinakarta(Sagala), Saptasindavah(Opiana), Rakhvad(Alexandreia Arachosias), Sauvira(Patala), Saurashtra(Girnar)
    and GovernorBuildingExists = parth_indo

    Affects MinorKing 1 Chance 100
    Note that it has picked the descriptive parts of the region label references and put it in a comment at the end of the line, in addition to whatever comment was there originally.

    If the map province boundaries change, the changed IDs will be picked up on the next run of the tool, so no manual checking or updating will be necessary.

    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

Posting Permissions

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