Page 1 of 3 123 LastLast
Results 1 to 20 of 57

Thread: Creating Localised Re-Emerging Factions without using the Horde Ability

  1. #1
    TMK's Avatar BC Local Moderator
    Join Date
    Jun 2010
    Location
    England
    Posts
    1,606

    Default Creating Localised Re-Emerging Factions without using the Horde Ability

    Creating Localised Re-Emerging Factions Tutorial

    This tutorial will show you how to create a script which will allow all factions in the game to re-emerge when their previously capital settlement riots against the occupiers. It will tell you how the script works and how you can tailor it to your own needs.

    Files that need to be edited:
    campaign_script.txt
    export_descr_buildings.txt
    export_buildings.txt


    Step 1 Editing the Export_descr_buildings.txt
    Firstly, we need to create buildings that can be built via script and will reduce or increase Public Order accordingly. For this script, we only need the building that reduces Public Order but we might as well code both in for further use. Here is the code for the buildings:
    Spoiler Alert, click show to read: 
    Code:
    building ros_temp_buildings 
    levels ros_po_bonus ros_target
    {
      ros_po_bonus city requires factions {   }
       {
          capability
           {
               law_bonus bonus 20 requires not building_present_min_level ros_temp_buildings ros_target
               population_health_bonus bonus 20 requires not building_present_min_level ros_temp_buildings ros_target
               happiness_bonus bonus 20 requires not building_present_min_level ros_temp_buildings ros_target
           }
           material wooden
           construction  1
           cost  0
           settlement_min village
           upgrades
           {
               ros_target
           }
       }
       ros_target city requires factions {   }
       {
           capability
           {
               law_bonus bonus -20
               population_health_bonus bonus -20
               happiness_bonus bonus -20
           }
           material wooden
           construction  1
           cost  0
           settlement_min village
           upgrades
           {
           }
       }
    }
    plugins
    {
    }

    Basically, copy and paste into your export_descr_buildings.txt

    And here are the entries for export_buildings.txt
    Spoiler Alert, click show to read: 
    Code:
    {ros_target}Region Owner Switch Target
    {ros_target_desc}description
    {ros_target_desc_short}short description
    {ros_po_bonus}Region Owner Switch Public Order Bonus
    {ros_po_bonus_desc}description
    {ros_po_bonus_desc_short}short description


    Step 2 The Script
    Now to create a script for the Re-Emerging faction. We will be creating a script for one faction here, and you will have to duplicate it for all the factions in your mod with the required variations.

    Here is the whole script:
    Spoiler Alert, click show to read: 
    Code:
    declare_counter yemen_emerge
    set_counter yemen_emerge 0
    declare_counter sana_riot
    set_counter sana_riot 0
    declare_counter yemen_building
    set_counter yemen_building 1
    monitor_event CityRiots SettlementName Sana
    and I_NumberOfSettlements yemen = 0
    and I_IsFactionAIControlled yemen
    and not I_SettlementOwner Sana = yemen
    inc_counter yemen_emerge 1
    set_counter yemen_building 0
    end_monitor
    monitor_event FactionTurnEnd FactionType slave
    and I_CompareCounter yemen_emerge = 2
    console_command create_building Sana ros_target
    set_counter sana_riot 1
    spawn_army
    faction yemen
    character random_name, named character, age 30, x 223, y 24, family
    traits GoodCommander 4 , Energetic 1 , StrategyChivalry 4, Intelligent 1
    unit   blaba    exp 0 armour 0 weapon_lvl 0
    unit   blaba   exp 0 armour 0 weapon_lvl 0
    unit   blaba     exp 0 armour 0 weapon_lvl 0
    unit   blaba      exp 0 armour 0 weapon_lvl 0
    unit   blaba      exp 0 armour 0 weapon_lvl 0
    unit   blaba     exp 0 armour 0 weapon_lvl 0
    unit   blaba     exp 0 armour 0 weapon_lvl 0
    unit  blaba    exp 0 armour 0 weapon_lvl 0
    end
    if I_SettlementOwner Sana = egypt
    faction_emerge yemen egypt 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = scotland
    faction_emerge yemen scotland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = france
    faction_emerge yemen france 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = poland
    faction_emerge yemen poland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = denmark
    faction_emerge yemen denmark 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = turks
    faction_emerge yemen turks 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = byzantium
    faction_emerge yemen byzantium 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = england
    faction_emerge yemen england 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = portugal
    faction_emerge yemen portugal 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = russia
    faction_emerge yemen russia 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = moors
    faction_emerge yemen moors 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = spain
    faction_emerge yemen spain 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = hungary
    faction_emerge yemen hungary 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = milan
    faction_emerge yemen milan 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = venice
    faction_emerge yemen venice 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = aztecs
    faction_emerge yemen aztecs 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = sicily
    faction_emerge yemen sicily 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    historic_event yemen_emerged
    set_counter yemen_emerge 0
    set_counter sana_riot 0
    end_monitor
    monitor_event PreFactionTurnStart FactionIsLocal
    and I_CompareCounter yemen_emerge = 0
    and I_CompareCounter sana_riot = 0
    and I_CompareCounter yemen_building = 0
    and I_SettlementOwner Sana = yemen
    destroy_buildings yemen ros_temp_buildings false
    set_counter yemen_building 1
    end_monitor


    Lets break it up so its easier to understand.

    Here is the first part.

    Code:
    declare_counter yemen_emerge
    set_counter yemen_emerge 0
    declare_counter sana_riot
    set_counter sana_riot 0
    declare_counter yemen_building
    set_counter yemen_building 1
    monitor_event CityRiots SettlementName Sana
    and I_NumberOfSettlements yemen = 0
    and I_IsFactionAIControlled yemen
    and not I_SettlementOwner Sana = yemen
    inc_counter yemen_emerge 1
    set_counter yemen_building 0
    end_monitor
    The parts in green are the counters which we will need to declare and set for the script. You can name them as you wish but remember to use the same names in the script! Note: the 'yemen_building' counter has to be set as 1.
    The next part is the monitor waiting for the target settlement to riot. For example, scotland has conquered England and taken London which used to be the capital for the England faction. This will be probably have a low Public Order and when it riots, the monitor picks up the event via the CityRiots event.
    Next we need to make sure that England(or Yemen as I have used in my script) has no settlements so we make a few conditions to make sure the faction is not alive and does not have the settlement that is rioting. Since hording is not used, the I_NumberOfSettlements condition works fine.
    Lastly, increase the yemen_emerge counter to trigger the next monitor and also set the yemen_buildings to 0. - This is very important to destroy the Public Order decreasing building after the faction has re-emerged!
    Here is the next part of the script:
    Code:
    monitor_event FactionTurnEnd FactionType slave
    and I_CompareCounter yemen_emerge = 2
    console_command create_building Sana ros_target
    set_counter sana_riot 1
     
    spawn_army
     
    faction yemen
    character random_name, named character, age 30, x 223, y 24, family
    traits GoodCommander 4 , Energetic 1 , StrategyChivalry 4, Intelligent 1
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    unit blaba exp 0 armour 0 weapon_lvl 0
    end
    if I_SettlementOwner Sana = egypt
    faction_emerge yemen egypt 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = scotland
    faction_emerge yemen scotland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = france
    faction_emerge yemen france 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = poland
    faction_emerge yemen poland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = denmark
    faction_emerge yemen denmark 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = turks
    faction_emerge yemen turks 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = byzantium
    faction_emerge yemen byzantium 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = england
    faction_emerge yemen england 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = portugal
    faction_emerge yemen portugal 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = russia
    faction_emerge yemen russia 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = moors
    faction_emerge yemen moors 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = spain
    faction_emerge yemen spain 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = hungary
    faction_emerge yemen hungary 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = milan
    faction_emerge yemen milan 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = venice
    faction_emerge yemen venice 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = aztecs
    faction_emerge yemen aztecs 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Sana = sicily
    faction_emerge yemen sicily 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    historic_event yemen_emerged
    set_counter yemen_emerge 0
    set_counter sana_riot 0
    end_monitor
    Next we create a monitor that picks up the event at the end of the Rebel faction's turn so as not to disrupt natural riots and revolts. We have a condition to make sure the earlier monitor has fired. I have put it at 2 so the settlement has to riot for 2 turns for the faction to re-emerge. Now we use the create building console command to create the building in our target settlement to reduce public loads so that it is the target of the faction_emerge command which is coming next. Also we increase the sana_riot counter.
    The next bit, is when the faction really emerges. We spawn the faction leader a tile away from the target settlement with whatever traits and army you want. You can use random_name to create a bit of variety. Then we use the faction emerge command. We have if statements for all the factions in the game because the faction_emerge command requires a target faction that the re-emerging faction emerges from so it is egypt controlling Sana (the I_SettlementOwner condition) than in the faction_emerge command, the target faction is egypt. Keep the rest of it the same, we don't need to tinker about with the rest of the values.
    After that we create a historic event (you'll have to edit historic_events.txt for this) and set the yemen_emerge counter and Sana_riot counter to 0 to show that the event has finished and this will allow the process to start all over again.

    Here is the last bit of the script:
    Code:
    monitor_event PreFactionTurnStart FactionIsLocal
    and I_CompareCounter yemen_emerge = 0
    and I_CompareCounter sana_riot = 0
    and I_CompareCounter yemen_building = 0
    and I_SettlementOwner Sana = yemen
    destroy_buildings yemen ros_temp_buildings false
    set_counter yemen_building 1
    end_monitor
    This is basically the part when we destroy that Public Order decreasing building and the event here is PreFactionTurnStart for the player so before the player sees the PO decreasing building, it should already be gone. here we check that the counters are 0 for yemen_emerge and Sana_riot so that it fires after the faction has re-emerged. We check for the yemen_building counter as to stop this monitor firing every turn and to minimize bugs. Then we use the destroy buildings command to destroy the PO decreasing building. The ros_tem_buildings has to be what you destroy and not ros_target!
    We lastly increase yemen_building to stop the monitor firing every turn.


    Limitations
    1. The settlement the faction is re-emerged from is not garunteed as the public order decreasing building only makes it go so far down and if the player has another settlement with PO that is 0 then it could lead to problems.
    2. I thought of this problem but now I've forgotten....

    Final Remarks and Options
    You can tailor it to your own needs by editing this slighty. You can use some if statements and link it to chance that this faction re-emerges at different settlements but will increase the size and complexity of the script. You can also tie this in with other events. Copy and paste and change the names of the faction, settlement and counters for all the other factions and then all factions will re-emerge!

    And there we go! Localised Re-Emergant Factions. And created without using the horde ability so things don't get ugly.
    Last edited by TMK; August 02, 2012 at 09:09 AM.




  2. #2
    TMK's Avatar BC Local Moderator
    Join Date
    Jun 2010
    Location
    England
    Posts
    1,606

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    For some reason, my browser seems to be posting this wrong. Ignore this until I fix the layout.

    EDIT: I have tried with Internet Explorer and Firefox and the same layout bug happens. Is it TWC?


    EDIT2: Everything is working fine now! Feedback on the tutorial please?
    Last edited by TMK; July 31, 2012 at 06:51 PM.




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

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

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    I like the idea how you manipulated the factors for faction_emerge with the building. Essentially it's the baron's emergence at long last explained (without the shadowing). I trust it will also work with a faction that hasn't emerged yet.

    That should come handy, in fact it will solve the problem with emergent factions that we were having in 1648.










  4. #4
    TMK's Avatar BC Local Moderator
    Join Date
    Jun 2010
    Location
    England
    Posts
    1,606

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Quote Originally Posted by Gigantus View Post
    I like the idea how you manipulated the factors for faction_emerge with the building. Essentially it's the baron's emergence at long last explained (without the shadowing). I trust it will also work with a faction that hasn't emerged yet.

    That should come handy, in fact it will solve the problem with emergent factions that we were having in 1648.
    Thanks!
    It was from Withwnar that I got the building idea and code from.

    It should work with a faction that hasn't emerged yet but you just need to add conditions to make sure the faction emerged so that the script doesn't fire before the faction's even emerged yet!

    Glad to help.




  5. #5
    Vegas_Bear's Avatar Biarchus
    Join Date
    Sep 2005
    Location
    Las Vegas, NV
    Posts
    605

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    First of all, I'd like to thank you for your time and effort. +Rep. Great job on figuring it out, without using the horde aspect.

    What I am trying to do, is to limit the amount of monitor_events used. For your script, I would need 3 monitors for each settlement, 3 settlements would need 9 monitors. The one below has 4 monitors for 3 settlements. Let me know what you think. I'm also trying not to use the building aspect of it too.

    Spoiler Alert, click show to read: 
    Code:
    ;------------------- Scotland -------------------;
    declare_counter scotland_emerge
    set_counter scotland_emerge 0
    
    declare_counter scotlandEdinburgh
    set_counter scotlandEdinburgh 0
    
    declare_counter scotlandAberdeen
    set_counter scotlandAberdeen 0
    
    declare_counter scotlandInverness
    set_counter scotlandInverness 0
    
    monitor_event SettlementTurnStart SettlementName Edinburgh
            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 SettlementTurnStart SettlementName Aberdeen
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
    		set_counter scotlandAberdeen 1
    		inc_counter scotland_emerge 1
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Inverness
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
    		set_counter scotlandInverness 1
    		inc_counter scotland_emerge 1
    end_monitor
    
    monitor_event FactionTurnEnd FactionType slave
    	and I_CompareCounter scotland_emerge >= 2
    	spawn_army
    	faction scotland
    		character random_name, named character, age 30, x ??, y ??, 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
    
    if I_CompareCounter scotlandEdinburgh = 1
    	if I_SettlementOwner Edinburgh = england
    		faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = wales
    		faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = ireland
    		faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = barons_alliance
    		faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = france
    		faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
    
    if I_CompareCounter scotlandAberdeen = 1
    	if I_SettlementOwner Aberdeen = england
    		faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = wales
    		faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = ireland
    		faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = barons_alliance
    		faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = france
    		faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
    
    if I_CompareCounter scotlandInverness = 1
    	if I_SettlementOwner Inverness = england
    		faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = wales
    		faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = ireland
    		faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = barons_alliance
    		faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = france
    		faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
    
    	set_counter scotland_emerge 0
    	set_counter scotlandEdinburgh 0
    	set_counter scotlandAberdeen 0
    	set_counter scotlandInverness 0
    end_monitor

  6. #6
    TMK's Avatar BC Local Moderator
    Join Date
    Jun 2010
    Location
    England
    Posts
    1,606

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Quote Originally Posted by Vegas_Bear View Post
    First of all, I'd like to thank you for your time and effort. +Rep. Great job on figuring it out, without using the horde aspect.

    What I am trying to do, is to limit the amount of monitor_events used. For your script, I would need 3 monitors for each settlement, 3 settlements would need 9 monitors. The one below has 4 monitors for 3 settlements. Let me know what you think. I'm also trying not to use the building aspect of it too.
    Thanks for your support!

    Nice script, it reduces monitors a lot which is nice. (I actually talk about using If statements to reduce monitors for more settlemetns in the final remarks and options section.)

    Do you mind if I use your script as an example for the Tutorial for a script for multiple settlements?

    Here is your script with my additions to make it better.
    Red is needed code to make it better which is to make the army spawn near the settlement that the faction emerged from, green for my suggestion to include the buildings because without it you run the risk of the faction emerging in a different settlement.
    If you take the building suggestion, remember to code in the buildings in the EDB!
    Code:
    ;------------------- Scotland -------------------;
    declare_counter scotland_emerge
    set_counter scotland_emerge 0
     
    declare_counter scotlandEdinburgh
    set_counter scotlandEdinburgh 0
     
    declare_counter scotlandAberdeen
    set_counter scotlandAberdeen 0
     
    declare_counter scotlandInverness
    set_counter scotlandInverness 0
     
    declare_counter scotland_building
    set_counter scotland_building 1
     
    monitor_event SettlementTurnStart SettlementName Edinburgh
            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 SettlementTurnStart SettlementName Aberdeen
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
            set_counter scotlandAberdeen 1
            inc_counter scotland_emerge 1
    end_monitor
     
    monitor_event SettlementTurnStart SettlementName Inverness
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
            set_counter scotlandInverness 1
            inc_counter scotland_emerge 1
    end_monitor
     
    monitor_event FactionTurnEnd FactionType slave
        and I_CompareCounter scotland_emerge >= 2
     
    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 ??, y ??, 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
     
     if I_SettlementOwner Edinburgh = england
            faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Edinburgh = wales
            faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Edinburgh = ireland
            faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Edinburgh = barons_alliance
            faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Edinburgh = france
            faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
     
    if I_CompareCounter scotlandAberdeen = 1
    console_command create_building Aberdeen ros_target
    set_counter scotland_building 0
    spawn_army
    faction scotland
    character random_name, named character, age 30, x ??, y ??, 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
     
     if I_SettlementOwner Aberdeen = england
            faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Aberdeen = wales
            faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Aberdeen = ireland
            faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Aberdeen = barons_alliance
            faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Aberdeen = france
            faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
     
    if I_CompareCounter scotlandInverness = 1
    console_command create_building Inverness ros_target
    set_counter scotland_building 0
    spawn_army
    faction scotland
    character random_name, named character, age 30, x ??, y ??, 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
     
     if I_SettlementOwner Inverness = england
            faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Inverness = wales
            faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Inverness = ireland
            faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Inverness = barons_alliance
            faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        if I_SettlementOwner Inverness = france
            faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
        end_if
        CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
     
        set_counter scotland_emerge 0
        set_counter scotlandEdinburgh 0
        set_counter scotlandAberdeen 0
        set_counter scotlandInverness 0
    end_monitor
     
    monitor_event PreFactionTurnStart FactionIsLocal
    and I_CompareCounter scotland_building = 0
    and I_CompareCounter scotland_emerge = 0
    destroy_buildings ros_temp_buildings false
    set_counter scotland_building 1
    end_monitor
    Check my additions to the script, it might not be free from faults.
    This is just a suggestion btw.
    Last edited by TMK; August 01, 2012 at 08:41 PM.




  7. #7
    Vegas_Bear's Avatar Biarchus
    Join Date
    Sep 2005
    Location
    Las Vegas, NV
    Posts
    605

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Do you mind if I use your script as an example for the Tutorial for a script for multiple settlements?
    Not at all, go right ahead. Use whatever you would like.

    VB

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

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    It is quite likely that the ros_target building's negative bonuses won't be enough to make this settlement the one with the lowest public order. As explained here - under Public Order - the thing that really does the trick is putting the other building - ros_po_bonus - in all of the other settlements. (Actually: all of the settlements, including the target, but the conditions on the bonuses prevent them working in the target settlement.)

  9. #9
    Vegas_Bear's Avatar Biarchus
    Join Date
    Sep 2005
    Location
    Las Vegas, NV
    Posts
    605

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    I made some changes to mine. I added add_settlement_turmoil syntax and change the spawned army to be near the settlement that changes over.

    Spoiler Alert, click show to read: 
    Code:
    ;------------------- Scotland -------------------;
    declare_counter scotland_emerge
    set_counter scotland_emerge 0
    
    declare_counter scotlandEdinburgh
    set_counter scotlandEdinburgh 0
    
    declare_counter scotlandAberdeen
    set_counter scotlandAberdeen 0
    
    declare_counter scotlandInverness
    set_counter scotlandInverness 0
    
    monitor_event SettlementTurnStart SettlementName Edinburgh
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
    		set_counter scotlandEdinburgh 1
    		inc_counter scotland_emerge 1
    			if not I_SettlementOwner Edinburgh scotland
    				add_settlement_turmoil Edinburgh 15
    			end_if
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Aberdeen
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
    		set_counter scotlandAberdeen 1
    		inc_counter scotland_emerge 1
    			if not I_SettlementOwner Aberdeen scotland
    				add_settlement_turmoil Aberdeen 15
    			end_if
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Inverness
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel < loyalty_content
            and I_TurnNumber > 0
    		set_counter scotlandInverness 1
    		inc_counter scotland_emerge 1
    			if not I_SettlementOwner Inverness scotland
    				add_settlement_turmoil Inverness 15
    			end_if
    end_monitor
    
    monitor_event FactionTurnEnd FactionType slave
    	and I_CompareCounter scotland_emerge >= 2
    
    if I_CompareCounter scotlandEdinburgh = 1
    	add_settlement_turmoil Edinburgh -15
    	spawn_army
    	faction scotland
    		character random_name, named character, age 30, x ??, y ??, 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
    	if I_SettlementOwner Edinburgh = england
    		faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = wales
    		faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = ireland
    		faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = barons_alliance
    		faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Edinburgh = france
    		faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
    
    if I_CompareCounter scotlandAberdeen = 1
    	add_settlement_turmoil Aberdeen -15
    	spawn_army
    	faction scotland
    		character random_name, named character, age 30, x ??, y ??, 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
    	if I_SettlementOwner Aberdeen = england
    		faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = wales
    		faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = ireland
    		faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = barons_alliance
    		faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Aberdeen = france
    		faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
    
    if I_CompareCounter scotlandInverness = 1
    	add_settlement_turmoil Inverness -15
    	spawn_army
    	faction scotland
    		character random_name, named character, age 30, x ??, y ??, 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
    
    	if I_SettlementOwner Inverness = england
    		faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = wales
    		faction_emerge scotland wales 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = ireland
    		faction_emerge scotland ireland 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = barons_alliance
    		faction_emerge scotland barons_alliance 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	if I_SettlementOwner Inverness = france
    		faction_emerge scotland france 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    	end_if
    	CONTINUED FOR OTHER REMAINING FACTIONS...
    end_if
    
    	set_counter scotland_emerge 0
    	set_counter scotlandEdinburgh 0
    	set_counter scotlandAberdeen 0
    	set_counter scotlandInverness 0
    end_monitor


    VB

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

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    I can't remember ... is that 15% or 15x5%=75%? Even 75% might not be enough. You could easily have a situation where your intended target settlement has 160% PO and another settlement only has 80%: the other settlement would 'win' even with the turmoil penalty.

    I have a feeling I tried add_settlement_turmoil and it was no use. Something like: that amount is added to the settlement over time, not immediately.

    Any particular reason you don't wish to use the buildings VB? It was the only reliable* way to do it that I found and I spent quite a bit of time experimenting.

    * not 100%

  11. #11
    TMK's Avatar BC Local Moderator
    Join Date
    Jun 2010
    Location
    England
    Posts
    1,606

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Quote Originally Posted by Withwnar View Post
    It is quite likely that the ros_target building's negative bonuses won't be enough to make this settlement the one with the lowest public order. As explained here - under Public Order - the thing that really does the trick is putting the other building - ros_po_bonus - in all of the other settlements. (Actually: all of the settlements, including the target, but the conditions on the bonuses prevent them working in the target settlement.)
    The reason I didn't use the other building is because for my script to fire, the settlement must be rioting so its already 70% and ros_target will bring it down to 10-0%. Using the other building is tedious as you have to build it in every settlement which is long and i need this script for 18 factions so it makes larger still. I might update the tutorial to include ways to script a re-emergance when the settlement is not rioting using the other PO increasing buildings.
    Last edited by TMK; August 02, 2012 at 06:14 AM.




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

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Ah yes, already rioting. I missed that.

    However, ros_target will only reduce those three PO bonuses. There is a good chance that a settlement will only have a small amount of these bonuses to begin with, or possibly none at all. e.g. If it only has +5% Law and +5% Happiness then only 10% in total will be removed by this building, taking it from (e.g.) 70% to 60% PO. There is the risk that another settlement also has 60% due to high taxes and low garrison (etc.) in which case either of these settlements could become the emergence target. If the other settlement has less than 60% then that will definitely become the target.

    A smallish risk, perhaps, that more than one settlement has such low PO. And you have the disclaimer that this isn't guaranteed to work. If you use the other building as well then it is muuuch more guaranteed to work. As tedious as it might be; it is the nature of this scripting language's limitations sometimes.

    All you need to do is add this to your slave TurnEnd monitor, before the ros_target building line...

    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
    ;... and all other settlements on the map...
    console_command create_building Sana ros_target
    And add a destroy_building for all factions where you have the one...

    Code:
    destroy_buildings yemen ros_temp_buildings false
    destroy_buildings england ros_temp_buildings false
    destroy_buildings france ros_temp_buildings false
    destroy_buildings hre ros_temp_buildings false
    ;... and all other factions...
    And just a suggestion but you might want to layout the script to be a bit more easy to follow...

    Spoiler Alert, click show to read: 
    Code:
    declare_counter yemen_emerge
    set_counter yemen_emerge 0
    declare_counter sana_riot
    set_counter sana_riot 0
    declare_counter yemen_building
    set_counter yemen_building 1
    
    monitor_event CityRiots SettlementName Sana
      and I_NumberOfSettlements yemen = 0
      and I_IsFactionAIControlled yemen
      and not I_SettlementOwner Sana = yemen
    
      inc_counter yemen_emerge 1
      set_counter yemen_building 0
    end_monitor
    
    monitor_event FactionTurnEnd FactionType slave
      and I_CompareCounter yemen_emerge = 2
      
      console_command create_building Sana ros_target
      set_counter sana_riot 1
      
      spawn_army
        faction yemen
        character random_name, named character, age 30, x 223, y 24, family
        traits GoodCommander 4 , Energetic 1 , StrategyChivalry 4, Intelligent 1
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
        unit   blaba	exp 0 armour 0 weapon_lvl 0
      end
      
      if I_SettlementOwner Sana = egypt
        faction_emerge yemen egypt 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = scotland
        faction_emerge yemen scotland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = france
        faction_emerge yemen france 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = poland
        faction_emerge yemen poland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = denmark
        faction_emerge yemen denmark 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = turks
        faction_emerge yemen turks 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = byzantium
        faction_emerge yemen byzantium 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = england
        faction_emerge yemen england 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = portugal
        faction_emerge yemen portugal 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = russia
        faction_emerge yemen russia 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = moors
        faction_emerge yemen moors 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = spain
        faction_emerge yemen spain 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = hungary
        faction_emerge yemen hungary 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = milan
        faction_emerge yemen milan 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = venice
        faction_emerge yemen venice 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = aztecs
        faction_emerge yemen aztecs 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      if I_SettlementOwner Sana = sicily
        faction_emerge yemen sicily 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
      end_if
      
      historic_event yemen_emerged
      set_counter yemen_emerge 0
      set_counter sana_riot 0
    end_monitor
    
    monitor_event PreFactionTurnStart FactionIsLocal
      and I_CompareCounter yemen_emerge = 0
      and I_CompareCounter sana_riot = 0
      and I_CompareCounter yemen_building = 0
      and I_SettlementOwner Sana = yemen
      
      destroy_buildings yemen ros_temp_buildings false
      set_counter yemen_building 1
    end_monitor
    Last edited by Withwnar; August 03, 2012 at 05:36 AM.

  13. #13
    Vegas_Bear's Avatar Biarchus
    Join Date
    Sep 2005
    Location
    Las Vegas, NV
    Posts
    605

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Any particular reason you don't wish to use the buildings VB?
    I believe that i was close to my building tree limit on my personal mod. I will need to check the limits again and count my tree. Just takes awhile to do this and I was putting it off, tedious.

    VB

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

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

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Notepad++ can be used to count instances of individual words in a document. In this case searching for levels and selecting 'count' will give you the number of trees.










  15. #15

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    I'm trying to make a faction re-emerge on the condition that another faction's kalmar union script is accepted. Does this look right to you guys?

    Spoiler Alert, click show to read: 
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Gives AI OOG the ability to re-emerge as Angmar if it is destroyed before Arnor emerges
    ;
    declare_counter angmar_emerge
    set_counter angmar_emerge 0

    monitor_event SettlementTurnStart SettlementName Carn-Dum
    and I_NumberOfSettlements portugal < 1
    and SettlementLoyaltyLevel < loyalty_content
    and I_EventCounter union_accepted = 1
    set_counter angmar_emerge 1

    end_monitor

    monitor_event FactionTurnEnd FactionType slave
    and I_CompareCounter angmar_emerge = 1
    and I_CompareCounter witchking_returns = 0
    and I_CompareCounter witchking_returns2 = 0
    and I_CompareCounter witchking_returns3 = 0

    historic_event witchking_returns event/mordor_revived.bik

    kill_character family_mordor1

    spawn_army
    faction hungary
    character Witchking, named character, age 20, x 151, y 303, direction S, portrait nazgul1, battle_model witchking, hero_ability Terror_of_the_Witch_King
    unit mornaturi_guard_bg exp 3 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 2 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 1 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 2 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 0 armour 0 weapon_lvl 0
    unit Uruk Rangers exp 1 armour 0 weapon_lvl 0
    unit Uruk Rangers exp 0 armour 0 weapon_lvl 0
    end

    give_everything_to_faction hungary portugal false

    send_character_off_map Witchking

    spawn_army
    faction portugal
    character Witchking, named character, age 20, x 151, y 303, direction S, portrait nazgul1, battle_model witchking, hero_ability Terror_of_the_Witch_King
    unit mornaturi_guard_bg exp 3 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 2 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 1 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 2 armour 0 weapon_lvl 0
    unit Angmar Uruks exp 0 armour 0 weapon_lvl 0
    unit Angmarim exp 1 armour 0 weapon_lvl 0
    unit Rhudaur Axemen exp 0 armour 0 weapon_lvl 0
    unit Rhudaur Axemen exp 0 armour 0 weapon_lvl 0
    unit Hillmen exp 1 armour 0 weapon_lvl 0
    unit Hillmen exp 0 armour 0 weapon_lvl 0
    unit Hillmen exp 0 armour 0 weapon_lvl 0
    unit Uruk Rangers exp 1 armour 0 weapon_lvl 0
    unit Uruk Rangers exp 0 armour 0 weapon_lvl 0
    unit Mountain Trolls exp 2 armour 0 weapon_lvl 0
    unit Rhudaur Scouts exp 1 armour 0 weapon_lvl 0
    unit Rhudaur Scouts exp 0 armour 0 weapon_lvl 0
    unit Heavy Orcs exp 2 armour 0 weapon_lvl 0
    unit Heavy Orcs exp 1 armour 0 weapon_lvl 0
    unit Orc Halberd exp 2 armour 0 weapon_lvl 0
    unit Orc Halberd exp 0 armour 0 weapon_lvl 0
    end

    console_command give_trait Witchking Witchking 1
    console_command give_trait Witchking hero_ability12 1
    console_command give_trait Witchking LoyaltyStarter 1
    console_command give_trait Witchking GoodCommander 4
    console_command give_trait Witchking BattleScarred 2
    console_command give_trait Witchking BattleDread 3
    console_command give_trait Witchking CaptorDread 2
    console_command give_trait Witchking GoodAttacker 2
    console_command give_trait Witchking NightBattleCapable 1
    console_command give_ancillary Witchking ring_witchking
    console_command give_ancillary Witchking witchking_helmet
    console_command give_ancillary Witchking witchkings_flail

    if I_SettlementOwner Carn-Dum = egypt
    faction_emerge portugal egypt 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = scotland
    faction_emerge portugal scotland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = france
    faction_emerge portugal france 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = poland
    faction_emerge portugal poland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = denmark
    faction_emerge portugal denmark 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = turks
    faction_emerge portugal turks 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = byzantium
    faction_emerge portugal byzantium 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = england
    faction_emerge portugal england 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = teuronic_order
    faction_emerge portugal teuronic_order 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = russia
    faction_emerge portugal russia 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = moors
    faction_emerge portugal moors 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = spain
    faction_emerge portugal spain 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = hungary
    faction_emerge portugal hungary 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = milan
    faction_emerge portugal milan 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = venice
    faction_emerge portugal venice 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = aztecs
    faction_emerge portugal aztecs 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if
    if I_SettlementOwner Carn-Dum = sicily
    faction_emerge portugal sicily 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    end_if


    snap_strat_camera 151, 307
    set_counter witchking_returns3 1

    terminate_monitor
    end_monitor

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

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Quote Originally Posted by Spice Master View Post
    I'm trying to make a faction re-emerge on the condition that another faction's kalmar union script is accepted. Does this look right to you guys?
    The union_accepted condition is correct but there are other problems...

    You're testing that Carn-Dum has low public order in its SettlementTurnStart but there is no guarantee that this settlement has the lowest public order in the faction that owns it. Especially as the emerging is not done until the slave turn: between SettlementTurnStart of the Carn-Dum owner's turn and the slave's turn any number of things could have happened that would no longer make Carn-Dum the candidate settlement. e.g. Carn-Dum's public order could increase due to recruitment (garrison) or a governor moving in, and/or another settlement could have even lower public order due to governor/garrison moving out.

    In the emerge section you are not testing all/only relevant factions. e.g. hre is missing - Orcs of the Misty Mountains - which is a likely faction to be the current owner. Poland, Denmark, etc. are not in TATW so there is no point testing for them.

    I think that you would need to do the emerging at the same time as finding out that Carn-Dum PO is low: within that SettlementTurnStart. And use the special buildings to guarantee that it is indeed Carn-Dum that gets emerged-into.

    I take it that the spawn-sendoffmap-spawn thing is to give him a unique name and then a unique bodyguard? If you find that he has a "dead" portrait after that second spawn then you might want to move him into the settlement before sending him off map.

  17. #17

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Thanks. I'm adding in the ros buildings to make sure CD has the lowest public order now. Of course I should have remembered to include hre. D'oh.

    Yes the send_off_map part is to give unique name/BG's. Haven't had any problem with the portrait doing it this way so far.

    Thanks!

  18. #18
    w.wallace61's Avatar Civis
    Join Date
    May 2009
    Location
    Where Another Bagpipe is Being played :)
    Posts
    132

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Wow thats great I've made mod for SS but that uses hordes.. Yours is great Can I actually use anything else apart from building but just ''public order for example'' to trigger the re-emergence? And what actually these parts mean.. I'm not very much familiar with all the codes sorry Great work again +rep

    if I_SettlementOwner Sana = byzantium
    faction_emerge yemen byzantium 1 400.0 0.0 1.2 town false unused_label1 unused_name 30

  19. #19
    TMK's Avatar BC Local Moderator
    Join Date
    Jun 2010
    Location
    England
    Posts
    1,606

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    Quote Originally Posted by w.wallace61 View Post
    Wow thats great I've made mod for SS but that uses hordes.. Yours is great Can I actually use anything else apart from building but just ''public order for example'' to trigger the re-emergence? And what actually these parts mean.. I'm not very much familiar with all the codes sorry Great work again +rep
    Can you explain your question again please? I don't seem to understand.

    If you mean different commands apart from buildings than I'm not sure as Vegas Bear has already experimented and I don't it works effectively.

    Quote Originally Posted by w.wallace61 View Post

    if I_SettlementOwner Sana = byzantium
    faction_emerge yemen byzantium 1 400.0 0.0 1.2 town false unused_label1 unused_name 30
    You don't actually need to know about any of that, I don't and it works perfectly.
    I think the 400 is to do with the settlements affected by this faction re-emergance so only settlements underneath 400. The unused labels are to prevent the label already in use error.




  20. #20
    w.wallace61's Avatar Civis
    Join Date
    May 2009
    Location
    Where Another Bagpipe is Being played :)
    Posts
    132

    Default Re: Creating Localised Re-Emerging Factions without using the Horde Ability

    I mean you are using buildings to lower the loyalty of the settlement, is it necessary to use buildings. Do we have to use them. Because, I used a code like this, but didnt seem to work. Faction turns into rebel every time their army spawns. So does it anything to do with the building you create. Do they essential to make faction alive after they re-emerge. Sorry to trouble you.

    In the codes 'iskoç' means 'scotish' .
    Spoiler Alert, click show to read: 
    Code:
    declare_counter iskoç
    set_counter iskoç 0
    
    
    
    
    
    monitor_event SettlementTurnStart SettlementName Edinburgh
            and I_NumberOfSettlements scotland < 1
            and SettlementLoyaltyLevel <= loyalty_content
            and I_CompareCounter iskoç = 0
            and I_TurnNumber > 0
            
         set_counter iskoç 1
    
    end_monitor
    
    
    monitor_event FactionTurnStart FactionType slave
            and I_NumberOfSettlements scotland < 1
            and I_CompareCounter iskoç = 1
            spawn_army 
                faction scotland
                    character random_name, named character, x 50, y 248, family
    		traits MilitaryInclination 1 , Military_Edu 2 , NaturalMilitarySkill 2 , GoodCommander 1 , LoyaltyStarter 1, BattleChivalry 2 , Loyal 2 , Just 2
    		unit		NE Bodyguard                 	exp 1 armour 1 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		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		Feudal Knights                	exp 1 armour 1 weapon_lvl 0
    		unit		Highland Nobles                	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 Edinburgh = england
         set_counter iskoç 0
         faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
         end_if
    end_monitor
    Last edited by w.wallace61; August 28, 2012 at 07:49 AM.

Page 1 of 3 123 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
  •