Results 1 to 14 of 14

Thread: Help with faction emerge script

  1. #1
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Help with faction emerge script

    Hello everyone,

    I am stuck in creating a faction emerge script. I read the threads, I tried several variants, but it seems that I could not get it to work.

    Code:
    ;Faction EMERGE TEST variant
        
        declare_counter scotland_emerge
        set_counter scotland_emerge 0
        
        declare_counter scotlandEdinburgh
        set_counter scotlandEdinburgh 0
        
        monitor_event SettlementTurnStart SettlementName London
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
            set_counter scotlandEdinburgh 1
            inc_counter scotland_emerge 1
        end_monitor
        
        monitor_event FactionTurnEnd FactionType slave
        and I_CompareCounter scotland_emerge >= 1
        
        if I_CompareCounter scotlandEdinburgh >= 1
        ;console_command create_building Edinburgh ros_target
        ;set_counter scotland_building 0
        
        
        spawn_army
        faction scotland
        character random_name, named character, age 30, x 107, y 164, family
        traits ReligionStarter 1, LoyaltyStarter 1, NaturalMilitarySkill 2, GoodCommander 2, BattleChivalry 2, Loyal 2, Just 2
        unit NE Bodyguard exp 1 armour 1 weapon_lvl 0
        unit Feudal Knights exp 1 armour 0 weapon_lvl 0
        ;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
        ;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
        unit Highland Nobles exp 1 armour 1 weapon_lvl 0
        unit Highland Nobles exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Spear Militia exp 1 armour 1 weapon_lvl 0
        unit Spear Militia exp 1 armour 1 weapon_lvl 0
        unit Spear Militia exp 1 armour 1 weapon_lvl 0
        unit Noble Highland Archers exp 1 armour 1 weapon_lvl 0
        unit Highland Archers exp 1 armour 1 weapon_lvl 0
        unit Highland Archers exp 1 armour 1 weapon_lvl 0
        end
        
        end_if
     
        if I_SettlementOwner London = england
            faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
    
        set_counter scotland_emerge 0
        set_counter scotlandEdinburgh 0
        
    end_monitor
    Code:
    ;Faction EMERGE TEST variant 2
        
        declare_counter scotland_emerge
        set_counter scotland_emerge 0
        
        declare_counter scotlandEdinburgh
        set_counter scotlandEdinburgh 0
        
        monitor_event SettlementTurnStart SettlementName London
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
            set_counter scotlandEdinburgh 1
            inc_counter scotland_emerge 1
        end_monitor
        
        monitor_event FactionTurnEnd FactionType slave
        and I_CompareCounter scotland_emerge >= 1
        
        if I_CompareCounter scotlandEdinburgh >= 1
        ;console_command create_building Edinburgh ros_target
        ;set_counter scotland_building 0
        
        
        if I_SettlementOwner London = england
            faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        
        spawn_army
        faction scotland
        character random_name, named character, age 30, x 107, y 164, family
        traits ReligionStarter 1, LoyaltyStarter 1, NaturalMilitarySkill 2, GoodCommander 2, BattleChivalry 2, Loyal 2, Just 2
        unit NE Bodyguard exp 1 armour 1 weapon_lvl 0
        unit Feudal Knights exp 1 armour 0 weapon_lvl 0
        ;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
        ;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
        unit Highland Nobles exp 1 armour 1 weapon_lvl 0
        unit Highland Nobles exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Highlanders exp 1 armour 1 weapon_lvl 0
        unit Spear Militia exp 1 armour 1 weapon_lvl 0
        unit Spear Militia exp 1 armour 1 weapon_lvl 0
        unit Spear Militia exp 1 armour 1 weapon_lvl 0
        unit Noble Highland Archers exp 1 armour 1 weapon_lvl 0
        unit Highland Archers exp 1 armour 1 weapon_lvl 0
        unit Highland Archers exp 1 armour 1 weapon_lvl 0
        end
        
        end_if
     
        set_counter scotland_emerge 0
        set_counter scotlandEdinburgh 0
        
    end_monitor
    In my test I start a grand campaign, surrender_regions scotland, then evacuate London and let it riot for 2 or more turns.
    Scotland should emerge now in London, or at least in some England owned settlement, as far as I have understood this.

    But nothing happens. No army spawns (as it should regarding the script) nor does scotland emerge.

    I have tried several variants of code (the above one is the last iteration).
    I do not know where my mistake lies.

    I have 31 factions in my mod. Maybe I would need a free faction slot for a successful emergence?

    Help would be much appreciated.

    cheers
    zumi
    Last edited by 4zumi; April 01, 2018 at 02:54 AM.
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

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

    Default Re: Help with faction emerge script

    Any errors in the log?

  3. #3
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Re: Help with faction emerge script

    No errors in the standard log.
    I looked at the trace log, but honestly i do not know what to look for in there.
    I searched for the specific trigger, but could not find it or anything else.
    So i have no real clue here.
    if you have any advice what i could look for in the trace log, i will do it.
    thanks
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

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

    Default Re: Help with faction emerge script

    I tried your first script and got a log error about unknown unit. I can't remember the exact message but the problem was a space instead of a tab between the unit type and the "exp" of all of those unit lines.

    Once I fixed that it worked. Scotland turned up but it took a few goes - there was a fine line between London being "< content" and turning rebel itself before Scotland had a chance to appear.

  5. #5
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Re: Help with faction emerge script

    Thanks, i will look after that.
    Could i use cityriots instead of the loyalty level?
    So i save one monitor and say :
    If settlement riots emerge faction and spawn army.

    I am on mobile right now, so sorry for formating and thelike.
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

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

    Default Re: Help with faction emerge script

    The CityRiots event or the IsSettlementRioting condition. Perhaps, not familiar with them myself.

    Something I noticed in your script: if england doesn't own London then you're spawning the scotland army but not doing the faction_emerge, so the army will have no settlements and go rebel.

  7. #7
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Re: Help with faction emerge script

    Ok, thanks. I will try these out too.

    Yeah, it is just a test to see if it works. The final script will have a condition including every faction in the game.
    Then the correct settlement (Edinburgh) will be in there too. London was just for testing convenience.
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

  8. #8
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Re: Help with faction emerge script

    I made a short testrun with a new compressed script and it seems to work quiet well.
    Thanks again Withwnar for spotting the error.

    Here is the script I use for now
    (If this settlement riots, the faction will emerge)

    Code:
    monitor_event SettlementTurnStart SettlementName London
            and I_NumberOfSettlements scotland < 1
            and IsSettlementRioting
            
            console_command create_building London ros_target
            
            spawn_army
        faction scotland
        character random_name, named character, age 30, x 107, y 164, family
        traits ReligionStarter 1, LoyaltyStarter 1, NaturalMilitarySkill 2, GoodCommander 2, BattleChivalry 2, Loyal 2, Just 2
        unit NE Bodyguard    exp 1 armour 1 weapon_lvl 0
        unit Feudal Knights    exp 1 armour 0 weapon_lvl 0
        unit Highland Nobles    exp 1 armour 1 weapon_lvl 0
        unit Highland Nobles    exp 1 armour 1 weapon_lvl 0
        unit Highlanders    exp 1 armour 1 weapon_lvl 0
        unit Highlanders    exp 1 armour 1 weapon_lvl 0
        unit Highlanders    exp 1 armour 1 weapon_lvl 0
        unit Highlanders    exp 1 armour 1 weapon_lvl 0
        unit Highlanders    exp 1 armour 1 weapon_lvl 0
        unit Highlanders    exp 1 armour 1 weapon_lvl 0
        unit Spear Militia    exp 1 armour 1 weapon_lvl 0
        unit Spear Militia    exp 1 armour 1 weapon_lvl 0
        unit Spear Militia    exp 1 armour 1 weapon_lvl 0
        unit Noble Highland Archers    exp 1 armour 1 weapon_lvl 0
        unit Highland Archers    exp 1 armour 1 weapon_lvl 0
        unit Highland Archers    exp 1 armour 1 weapon_lvl 0
        end
        
        if I_SettlementOwner London = england
            faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        
        INSERT ALL THE OTHER FACTIONS HERE
    
            
        destroy_buildings scotland ros_temp_buildings false    
            
        end_monitor
    Last edited by 4zumi; April 01, 2018 at 08:29 AM.
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

  9. #9

    Default Re: Help with faction emerge script

    You've got to get up early in the morning to beat Withwnar to the answer!

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

    Default Re: Help with faction emerge script

    On a bit of a roll today, for sure.

    Quote Originally Posted by 4zumi View Post
    Code:
        console_command create_building London ros_target
            
            ...
            
        destroy_buildings scotland ros_temp_buildings false
    If a settlement other than London becomes the emerged-into one then that building won't be destroyed in London because scotland don't own it. It would be safer to have one of those destroy_buildings lines for scotland and every faction who could possibly own it.

    Also, it's quite likely that the ros_target building won't do much to make London the desired target. The real strength of ROS is the other building that gives a huge public order boost to all of the other settlements.

  11. #11
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Re: Help with faction emerge script

    Thanks for pointing this out.

    Before I get to the other stuff, is there a command where I can destroy a building in a certain settlement
    "destroy_building London ros_target" or can i just destroy buildings factionwide?


    Naturally I want to avoid the tedious work of making the script for giving 198 settlements the "+ Public Order ROS building" and destroying them afterwards.

    So maybe I could make another approach at a small cost. I have read some threads about the emerge faction thing here, so I know there is a small chance it might fail to work correct.
    If I add settlement_turmoil the the settlement, were I want to emerge a faction I could theoretically bring it down to 0% PO, by adding settlement turmoil for 14 turns (-70% po).
    My trigger only fires, if the settlement in question is already rioting (so it is at its highest at 65% po). The added unrest will bring it down to 0%.

    If I am correct (the emergence will happen at the settlement with the lowest PO), there would have to be a highly unlikely incident of another settlement, that I or the faction the emerge happens from, owns, that has to be also at 0% PO.
    So it is highly likely, that the emerge will happen at the desired settlement, at the cost of a small uncertainty and residing settlement turmoil for the newly emerged faction.

    As it is the capital of that faction (and I suppose the capital gets special PO boni; it seemed so, as I tested it with London and only needed 1 or 2 units of garrison to counter the 80% unrest.) the newly emerged faction is most likely able to handle the unrest for the remaining turns until it normalizes.

    Another question would be, if there is a command like "remove_settlement_turmoil"? I suppose there is no such thing. Otherwise I would have read about it here in the forum most likely.

    Thanks for your help
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

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

    Default Re: Help with faction emerge script

    is there a command where I can destroy a building in a certain settlement "destroy_building London ros_target" or can i just destroy buildings factionwide?
    Only factionwide.

    If I add settlement_turmoil the the settlement...
    I don't have experience with turmoil.

    Naturally I want to avoid the tedious work of making the script for giving 198 settlements the "+ Public Order ROS building" and destroying them afterwards.
    Your script will already be destroying all of them, once you expand it to do it for all factions.

    ROS has a tool that generates script. You could use that, telling it you want it for all regions, then find the part of the generated script that is creating the buildings and copy-paste into yours. It literally took me about two minutes to do that to get this...

    Code:
        console_command create_building Acre ros_po_bonus
        console_command create_building Adana ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Aleppo ros_po_bonus
        console_command create_building Alexandria ros_po_bonus
        console_command create_building Algiers ros_po_bonus
        console_command create_building Angers ros_po_bonus
        console_command create_building Antioch ros_po_bonus
        console_command create_building Antwerp ros_po_bonus
        console_command create_building Arguin ros_po_bonus
        console_command create_building Arhus ros_po_bonus
        console_command create_building Baghdad ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Bordeaux ros_po_bonus
        console_command create_building Bran ros_po_bonus
        console_command create_building Breslau ros_po_bonus
        console_command create_building Bruges ros_po_bonus
        console_command create_building Bucharest ros_po_bonus
        console_command create_building Budapest ros_po_bonus
        console_command create_building Bulgar ros_po_bonus
        console_command create_building Caen ros_po_bonus
        console_command create_building Caernarvon ros_po_bonus
        console_command create_building Caesarea ros_po_bonus
        console_command create_building Caffa ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Cairo ros_po_bonus
        console_command create_building Caribbean ros_po_bonus
        console_command create_building Cholula ros_po_bonus
        console_command create_building Constantinople ros_po_bonus
        console_command create_building Cordoba ros_po_bonus
        console_command create_building Corinth ros_po_bonus
        console_command create_building Cracow ros_po_bonus
        console_command create_building Damascus ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Dongola ros_po_bonus
        console_command create_building Dublin ros_po_bonus
        console_command create_building Durazzo ros_po_bonus
        console_command create_building Edessa ros_po_bonus
        console_command create_building Edinburgh ros_po_bonus
        console_command create_building Florence ros_po_bonus
        console_command create_building Fortaleza ros_po_bonus
        console_command create_building Frankfurt ros_po_bonus
        console_command create_building Gaza ros_po_bonus
        console_command create_building Genoa ros_po_bonus
        console_command create_building Granada ros_po_bonus
        console_command create_building Halych ros_po_bonus
        console_command create_building Hamburg ros_po_bonus
        console_command create_building Helsinki ros_po_bonus
        console_command create_building Hohenstauffen ros_po_bonus
        console_command create_building Iasi ros_po_bonus
        console_command create_building Iconium ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Inverness ros_po_bonus
        console_command create_building Iraklion ros_po_bonus
        console_command create_building Jedda ros_po_bonus
        console_command create_building Jerusalem ros_po_bonus
        console_command create_building Kiev ros_po_bonus
        console_command create_building Leon ros_po_bonus
        console_command create_building Lisbon ros_po_bonus
        console_command create_building London ros_po_bonus
        console_command create_building Magdeburg ros_po_bonus
        console_command create_building Marrakesh ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Metz ros_po_bonus
        console_command create_building Miccosukee ros_po_bonus
        console_command create_building Milan ros_po_bonus
        console_command create_building Moscow ros_po_bonus
        console_command create_building Mosul ros_po_bonus
        console_command create_building Naples ros_po_bonus
        console_command create_building Nicaea ros_po_bonus
        console_command create_building Nicosia ros_po_bonus
        console_command create_building Nottingham ros_po_bonus
        console_command create_building Novgorod ros_po_bonus
        console_command create_building Nuremburg ros_po_bonus
        console_command create_building Oslo ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Pamplona ros_po_bonus
        console_command create_building Paris ros_po_bonus
        console_command create_building Prague ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Rennes ros_po_bonus
        console_command create_building Rheims ros_po_bonus
        console_command create_building Rhodes ros_po_bonus
        console_command create_building Riga ros_po_bonus
        console_command create_building Rome ros_po_bonus
        console_command create_building Ryazan ros_po_bonus
        console_command create_building Sarkel ros_po_bonus
        console_command create_building Smolensk ros_po_bonus
        console_command create_building Smyrna ros_po_bonus
        console_command create_building Sofia ros_po_bonus
        console_command create_building Stettin ros_po_bonus
        console_command create_building Stockholm ros_po_bonus
        console_command create_building Tbilisi ros_po_bonus
        console_command create_building Tenochtitlan ros_po_bonus
        console_command create_building Thessalonica ros_po_bonus
        console_command create_building Thorn ros_po_bonus
        console_command create_building Timbuktu ros_po_bonus
        console_command create_building Tlaxcala ros_po_bonus
        console_command create_building Toledo ros_po_bonus
        console_command create_building Toulouse ros_po_bonus
        console_command create_building Trebizond ros_po_bonus
        console_command create_building Tripoli ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Valencia ros_po_bonus
        console_command create_building Venice ros_po_bonus
        console_command create_building Vienna ros_po_bonus
        console_command create_building Vilnius ros_po_bonus
        console_command create_building Yerevan ros_po_bonus
        console_command create_building York ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Zaragoza ros_po_bonus
    Even making the list by hand may turn out to be less tedious than trying to get the turmoil thing working correctly.

  13. #13
    4zumi's Avatar This one sparks joy
    Join Date
    Feb 2015
    Location
    HRE - Aquis Mattiacis
    Posts
    1,239

    Default Re: Help with faction emerge script

    Ok, thank you very much and for the advice.

    I will see, where I go from here
    Proudly under the patronage of King Athelstan of the Imperial House of Hader

    Author of
    Total Vanilla Beyond mod for Medieval 2 - Kingdoms &
    Developer of
    Total Bananas mod for Medieval 2 - Kingdoms (beta)

    Steam Workshop Mods for Rome 2, Warhammer, Warhammer 2

    Discord: zumi's cookie corner
    Fighting for launch of "Cookie Friday" and "No Pants Saturday"

  14. #14

    Default Re: Help with faction emerge script

    Ako by teda mal tento skript vyzerať vo finálnej verzii?

Posting Permissions

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