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

Thread: Creating a script to give all the names you want to a settlement

  1. #1
    Polpolgio's Avatar Miles
    Join Date
    Jun 2008
    Location
    Barcelona, Europe
    Posts
    362

    Default Creating a script to give all the names you want to a settlement

    Well, I saw somebody asked about if is possible to make a script to give more than two names to a settlement depending who conquers it. And yes, it's possible, and there is no limit of possible settlement names. I'm proud to announce you my guide to show you how to add more than two possible names to a settlement.

    I will use an made example from my Reconquista's mod, all the possible names of Perpignan's city, depending who conquers it:

    -Catalan Domain --> Perpinyà



    -Castilian Domain --> Perpiñán



    -French Domain --> Perpignan

    -Muslim Domain --> Bârbanyân



    Spoiler Alert, click show to read: 


    Required files

    -Campaign_script.txt (found in data/world/maps/campaign/campaign_name)
    -Expanded.txt (found in data/text)

    Steps


    To start with, you should decide what names will you asign to a specific settlement, once you have decided them, open expanded.txt and write there the original settlement name placed in descr_regions (found in data/world/maps/base) and it's translation and the other names you will asign to that settlement, for example:

    Code:
    {Rosello}Perpinyà -> Original name
    {Perpinan}Perpiñan
    {Perpignan}Perpignan
    {Barbanyan}Bârbanyân
    Once you have finished this step, you should open campaign script.txt.

    Here, you will make a counter for each possible name, so I will have to make three counters in my case, for each change of name.

    Castilian type factions are Navarra (venice), Portugal (portugal), Portugal (hre), Castile (norway), León (denmark), Galicia (scotland).
    Catalan type factions are Barcelona (spain), Urgell (sicily), Aragón (milan), Tolosa (antioch), Aquitania (jerusalem).
    French type factions are France (france) and England (england).
    Muslim factions are Córdoba (moors), Zaragoza (egypt), Sevilla (turks), Granada (byzantium), Badajoz (hungary), Toledo (poland), Almería (lithuania), Dénia (russia), Almoravids (timurids) and Almohads (mongols).

    You need to create a counter first, indicating that the settlement name will be Spanish if a Castilian faction takes it, so:

    Code:
    ;;;;; Perpiñán
    
        declare_counter conquesta_de_Perpinan
        
        ;;; No Castilians conquer Perpinyà
        monitor_conditions I_SettlementOwner Rosello = norway
            and I_CompareCounter conquesta_de_Perpinan = 0
            
            set_counter conquesta_de_Perpinan 1
            change_settlement_name Rosello Perpinan
            
         end_monitor
         
        monitor_conditions I_SettlementOwner Rosello = denmark
            and I_CompareCounter conquesta_de_Perpinan = 0
            
            set_counter conquesta_de_Perpinan 1
            change_settlement_name Rosello Perpinan
            
         end_monitor
         
        monitor_conditions I_SettlementOwner Rosello = scotland
            and I_CompareCounter conquesta_de_Perpinan = 0
            
            set_counter conquesta_de_Perpinan 1
            change_settlement_name Rosello Perpinan
            
         end_monitor
         
        monitor_conditions I_SettlementOwner Rosello = venice
            and I_CompareCounter conquesta_de_Perpinan = 0
            
            set_counter conquesta_de_Perpinan 1
            change_settlement_name Rosello Perpinan
            
         end_monitor
         
        monitor_conditions I_SettlementOwner Rosello = hre
            and I_CompareCounter conquesta_de_Perpinan = 0
            
            set_counter conquesta_de_Perpinan 1
            change_settlement_name Rosello Perpinan
            
         end_monitor
    Now, you must indicate that when catalans get the settlement again, the name will be in catalan back, so you must indicate that the name will be catalan if the settlement is not had by any faction except catalan ones:

    Code:
    ;Catalans get Perpinyà again:
            
        monitor_conditions not I_SettlementOwner Rosello = scotland
                and not I_SettlementOwner Rosello = norway
                and not I_SettlementOwner Rosello = denmark
                and not I_SettlementOwner Rosello = venice
                and not I_SettlementOwner Rosello = hre
                and not I_SettlementOwner Rosello = france
                and not I_SettlementOwner Rosello = egypt
                and not I_SettlementOwner Rosello = hungary
                and not I_SettlementOwner Rosello = poland
                and not I_SettlementOwner Rosello = moors
                and not I_SettlementOwner Rosello = russia
                and not I_SettlementOwner Rosello = turks
                and not I_SettlementOwner Rosello = lithuania
                and not I_SettlementOwner Rosello = byzantium
                and not I_SettlementOwner Rosello = timurids
                and not I_SettlementOwner Rosello = mongols
                and not I_SettlementOwner Rosello = england
            and I_CompareCounter conquesta_de_Perpinan = 1
    
            set_counter conquesta_de_Perpinan 0
            change_settlement_name Rosello Rosello
    
         end_monitor
    Now, you have to indicate that the name will be French if France has that settlement, so it will not belong to the rest of factions, so you will have to indicate that the name will be French if the settlement does not belong to any faction except France:

    Code:
        ;;; If France occupies Perpinyà
        monitor_conditions not I_SettlementOwner Rosello = scotland
                and not I_SettlementOwner Rosello = norway
                and not I_SettlementOwner Rosello = denmark
                and not I_SettlementOwner Rosello = venice
                and not I_SettlementOwner Rosello = hre
                and not I_SettlementOwner Rosello = spain
                and not I_SettlementOwner Rosello = milan
                and not I_SettlementOwner Rosello = sicily
                and not I_SettlementOwner Rosello = antioch
                and not I_SettlementOwner Rosello = jerusalem
                and not I_SettlementOwner Rosello = egypt
                and not I_SettlementOwner Rosello = hungary
                and not I_SettlementOwner Rosello = poland
                and not I_SettlementOwner Rosello = moors
                and not I_SettlementOwner Rosello = russia
                and not I_SettlementOwner Rosello = turks
                and not I_SettlementOwner Rosello = lithuania
                and not I_SettlementOwner Rosello = byzantium
                and not I_SettlementOwner Rosello = timurids
                and not I_SettlementOwner Rosello = mongols
            and I_CompareCounter conquesta_de_Perpinan = 1
    
            set_counter conquesta_de_Perpinan 0
            change_settlement_name Rosello Perpignan
    
         end_monitor
    Now, you have to create another monitor conditions to indicate that the name will change to Barbanyan (muslim name) if the settlement is taken by a muslim faction, so it should belong to a muslim faction -> it should not belong to the rest of factions. If the settlement doesn't belong to any Christian faction, it will belong to a muslim faction, so you should indicate that the name will be arabian when the settlement doesn't belong to any Christian faction.

    Code:
        ;;; Muslims occupy Perpinyà
        monitor_conditions not I_SettlementOwner Rosello = scotland
                and not I_SettlementOwner Rosello = norway
                and not I_SettlementOwner Rosello = denmark
                and not I_SettlementOwner Rosello = venice
                and not I_SettlementOwner Rosello = hre
                and not I_SettlementOwner Rosello = spain
                and not I_SettlementOwner Rosello = milan
                and not I_SettlementOwner Rosello = sicily
                and not I_SettlementOwner Rosello = antioch
                and not I_SettlementOwner Rosello = jerusalem
                and not I_SettlementOwner Rosello = france
            and I_CompareCounter conquesta_de_Perpinan = 1
    
            set_counter conquesta_de_Perpinan 0
            change_settlement_name Rosello Barbanyan
    
         end_monitor

  2. #2
    Swagger's Avatar Imperial Coffee-Runner
    Join Date
    Apr 2007
    Location
    Portugal
    Posts
    12,453

    Default Re: Creating a script to give all the names you want to a settlement

    ya, but that's not anything new

    it has been in use since america's expansion
    Under the Patronage of the Dreadful cedric37!
    Ancs Guide, Emergent Factions , Yes/No Events |L'Outremer for Modders| Swagger's Skymod


  3. #3
    Polpolgio's Avatar Miles
    Join Date
    Jun 2008
    Location
    Barcelona, Europe
    Posts
    362

    Default Re: Creating a script to give all the names you want to a settlement

    Somebody asked about this, so I decided to write the tut.

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

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Creating a script to give all the names you want to a settlement

    Wouldn't it be easier to use the if condition?

    Code:
    monitor_event SettlementTurnStart SettlementName Rosella
        if I_SettlementOwner Rosello = norway
            change_settlement_name Rosello Perpinan
        end_if
        if I_SettlementOwner Rosello = denmark
            change_settlement_name Rosello Perpinan
        end_if
        ....
    end_monitor
    Last edited by Gigantus; April 11, 2010 at 12:45 PM.










  5. #5
    Polpolgio's Avatar Miles
    Join Date
    Jun 2008
    Location
    Barcelona, Europe
    Posts
    362

    Default Re: Creating a script to give all the names you want to a settlement

    It doesn't matter, beacuse using monitor conditions it works as well as using if condition, you can use simply what you prefer.

  6. #6

    Default Re: Creating a script to give all the names you want to a settlement

    I think yours is gonna cause more lag (although something that small won't cause lag), Gigantus, cause the script will check all 'if' conditions every turn, while the one in the OP will just fire whenever that condition is triggered

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

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Creating a script to give all the names you want to a settlement

    Thanks for clearing that up - will keep it in mind.










  8. #8

    Default Re: Creating a script to give all the names you want to a settlement

    sorry to sound negative~ but what is the point how does this enhance gameplay? boring~
    Boicote did this a long time ago in 1143 if you could find a way for it display the icon of owner faction than that would be something!
    Last edited by Druvatar De Bodemloze; April 12, 2010 at 04:44 AM.

  9. #9
    Polpolgio's Avatar Miles
    Join Date
    Jun 2008
    Location
    Barcelona, Europe
    Posts
    362

    Default Re: Creating a script to give all the names you want to a settlement

    Quote Originally Posted by druvatar View Post
    sorry to sound negative~ but what is the point how does this enhance gameplay? boring~
    Boicote did this a long time ago in 1143 if you could find a way for it display the icon of owner faction than that would be something!
    I know that Boicote devuted this script in 1143, but I proved that is possible to make a script to give more than two possible names to a specific settlement, in 1143 there are only two possibilities: Christian or Muslim name, here there are 4, and you could acheive 5, 6, 7, 8, 9... different names for a specific settlement, even one per faction if you want to, I have only shown how to do it

  10. #10
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Creating a script to give all the names you want to a settlement

    For the one where France owns it, it would be simpler to just use a positive check rather than a number of negative ones, I'd think:
    Code:
    monitor_conditions I_SettlementOwner Rosello = france
            and I_CompareCounter conquesta_de_Perpinan = 1
    
            set_counter conquesta_de_Perpinan 0
    end_monitor
    Quote Originally Posted by First Feef View Post
    I think yours is gonna cause more lag (although something that small won't cause lag), Gigantus, cause the script will check all 'if' conditions every turn, while the one in the OP will just fire whenever that condition is triggered
    It depends on the way the script is parsed, and I'm not entirely sure how that works, since that's the engine layer. It's just speculation unless a script which achieves the same thing in the same number of 'checks' can be looked at side by side and performance evaluated. This would require a large script tailored to this purpose. I've usually heard it the other way, which is that people have seen performance differences using monitor_conditions, which would mean the game isn't associating condition value changes with only those conditions as a separate object.

    Another way to do it would be to include a monitor to check when a settlement is captured.
    Code:
    monitor_event GeneralCaptureSettlement SettlementName Rosella
    ;if faction x1
    ;change name to y1
    ;if faction x2
    ;change name to y2
    ;etc
    end_monitor
    That monitor would only fire when a settlement changes hands, which should be fewer times than once per turn and not all at the same time during a turn sequence, so it would be seemingly 'faster' at a glance.

  11. #11

    Default Re: Creating a script to give all the names you want to a settlement

    Sorry to bump up an old thread but im curently trying to do something like this for 199 settlements.

    monitor_event GeneralCaptureSettlement SettlementName Rosella
    ;if faction x1
    ;change name to y1
    ;if faction x2
    ;change name to y2
    ;etc
    end_monitor
    Unfortunately it wont work as when the general is capturing the settlement the settlement still belongs to the previous owner (just checked it).
    However is there a way to check what faction does the general belong to ? Or what factions turn is it now ? Because using monitor_event SettlementTurnStart SettlementName = Rosella and ifs for a couple of factions and 199 settlements would probably cause huge lag.

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

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Creating a script to give all the names you want to a settlement

    'If' scripts have to have the I_ prefix in the condition.
    Why don't you simply test for ownership?

    monitor_conditions FactionTurnStart FactionIsLocal
    if I_SettlementOwner [settlement_name] = [faction1_name]
    change_settlement_name [settlement_name] [new_settlement_name1]
    end_if
    if I_SettlementOwner [settlement_name] = [faction2_name]
    change_settlement_name [settlement_name] [new_settlement_name2]
    end_if
    end_monitor
    This way you can put all instances of every settlement into a single monitor.
    I don't think you will be able to force a name change right after the occupation.










  13. #13

    Default Re: Creating a script to give all the names you want to a settlement

    Yea i know, just wanted to say that it wont work since when the event is triggered the settlement is still in enemy hands.
    FactionIsLocal causes your script to run only at the start the player factions turn ? If so then it would run 199 times x number of factions every turn. Unfortunately this could cause some serious lag.
    What im aiming for is for the script to run only when a the settlement is captured, revolts or is given to another faction (events: GeneralCaptureSettlement, CityRebels and GiveSettlement).
    But im running into some serious problems:
    1. Performance: what would cause the performance to suffer more ? Your script ? Or Or putting the same thing in the campaign script 3 times - 199 monitors x 3 types of monitors. Does just the reading of the script make the turn times go much slower ?
    2. How do i get to read this from docudeamons:
    Identifier: GiveSettlement
    Event: A settlement has been given to another faction
    Exports: faction, settlement, region_id, target_faction, target_religion
    Class: ET_GIVE_SETTLEMENT
    How can i get to information stored in exports ?
    i tried this:
    if target_faction = poland
    change_settlement_name Hrodna Hrodna-pl
    end_if
    But it doesnt work :/

  14. #14
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Creating a script to give all the names you want to a settlement

    You don't. That exports is there for the conditions to work. A condition won't work in a trigger if its requirement line is not included in the export line of the corresponding monitor/trigger.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

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

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Creating a script to give all the names you want to a settlement

    FactionIsLocal causes your script to run only at the start the player factions turn ? If so then it would run 199 times x number of factions every turn.
    If you follow my example, then it will run once at the start of the player's faction = one time per round = one monitor = no undue processing time.
    if target_faction = poland
    change_settlement_name Hrodna Hrodna-pl
    end_if
    You ignored what I said earlier:
    'If' scripts have to have the I_ prefix in the condition.










  16. #16

    Default Re: Creating a script to give all the names you want to a settlement

    You ignored what I said earlier:
    I didnt, I just didnt understand it then. I just had to do some tests on my own to understand it
    I think I'll end up using your script, thanks for that.
    But as im still not satisfied with "not doing it my way" i have one more question:
    CharFactionType - I have found it in the docudeamons, are the conditions hardcoded ? Or is there a possibility to make my own I_CharFactionType ?
    Also are "else if" and "or" conditions allowed ? I havent had the time to test it yet.
    monitor_event GeneralCaptureSettlement SettlementName Vilnius
    if I_CharFactionType poland
    change_settlement_name Vilnius Vilnius-pl
    else_if I_CharFactionType lithuania or slave
    change_settlement_name Vilnius Vilnius-li
    end_if
    end_monitor

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

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Creating a script to give all the names you want to a settlement

    There is no 'else'
    There is no 'or'
    You will have to wrap it into separate 'if'
    Every 'if' needs an 'end_if'

    monitor_event GeneralCaptureSettlement SettlementName Vilnius
    if I_CharFactionType poland
    change_settlement_name Vilnius Vilnius-pl
    else_if I_CharFactionType lithuania or slave
    change_settlement_name Vilnius Vilnius-li
    if I_CharFactionType slave
    change_settlement_name Vilnius Vilnius-li
    end_if
    end_if
    end_if
    end_monitor










  18. #18

    Default Re: Creating a script to give all the names you want to a settlement

    Ok, thanks for the tips.

  19. #19

    Default Re: Creating a script to give all the names you want to a settlement

    Quick question, does changing the name influence the referencing later in the campaign script?

    Aka if I change the name of "Antwerp" to I dunno "SomethingElse"
    and I use a monitor later with a "SettlementName Antwerp" kind of condition will it still work?

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

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Creating a script to give all the names you want to a settlement

    The settlement name is a variable here. As long as you change all instances of that variable you will be fine. This is actual called 'cloning' - using a base and changing only a variable entry.










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
  •