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

Thread: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

  1. #1
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    With help of Serious Potato, jojo and Fynn we have been testing how to make make it possible to use forts as semi settlements to some extent, and we have indeed found a way, using mercenary mechanics.

    campaign_script:
    Code:
    monitor_event ScrollOpened ScrollOpened fort_info_scroll    ; this event fires when you click on the fort
                
            if  I_CharacterTypeNearTile milan named_character, 0 332, 194   ; thats where the fort is  - Enabled a specific recruit pool for a specific faction in a specific fort.... Not needed if you are fine with all factions having the same recruitment pool in the same fort.
                           set_event_counter fort_test_recruit1 1              ; the event allows the recruitment of a specific mercenary pool
            end_if             
    
            if  I_CharacterTypeNearTile milan named_character, 0 132, 94            ; recruitment for other fort in another region            
                            set_event_counter fort_test_recruit2 1             ; the event allows the recruitment of a specific mercenary pool
            end_if                
                .....
    
            disable_ui hire_mercenaries_button false        ; not entirely necessary, it just enables the "hire all queued units" 
    end_monitor 
    
    monitor_event ScrollClosed ScrollClosed fort_info_scroll   ; fires when you close fort sroll
             
            set_event_counter fort_test_recruit1 0 ; the event required for the merc pool is no longer true
            set_event_counter fort_test_recruit2 0
            disable_ui hire_mercenaries_button   ; not entirely necessary, it just disables the "hire all queued units" 
    end_monitor 
    
    monitor_event ScrollOpened ScrollOpened own_named_character_info_scroll       ; to make sure you cant recruit those mercenaries with a general outside of the fort. As when you dont close the fort scrolls, but click on outside character right away, the "ScrollClosed" doesnt seem to fire always.
    
           set_event_counter fort_test_recruit1 0      ; the event required for the merc pool is no longer true
           set_event_counter fort_test_recruit2 0
        disable_ui hire_mercenaries_button       ; not entirely necessary, it just disables the "hire all queued units" 
    end_monitor

    descr_mercenaries:
    Code:
    pool Danmer
        regions Vivek_Province 
        unit Danmer Mercs,                exp 0 cost 800 replenish 0.08 - 0.16 max 1 initial 1 events { fort_test_recruit1 }
    
    pool Danmer_b
        regions Other_Province 
        unit Danmer Mercs,                exp 0 cost 800 replenish 0.08 - 0.16 max 1 initial 1 events { fort_test_recruit2 }

    This creates a specific mercenary pool that you (milan) can recruit only when you open a specific fort scroll and yours (milan) general controls it. The event counter enables the recruitment reliably the moment you open the fort scroll, and the other monitor_events reliably disables the pool when the fort scroll is not open.

    As long as you have many different recruit pools for different regions it should work very reliably (so that you can recruit specific merc pool only in a specific fort). If you have two forts per region or more, and you control both, Im not sure how to stop you from bring able to recruit both pools in both forts, so I believe this method works fine for 1 fort per region (unless you wouldnt mind a shared pool for forts of one region). Also, make sure that in descr_mercenaries a region is only in one merc pool, if its in more, only one work. Its no issue, as you can have many units with different requirements in one pool. Basically, I have 200 mer pools (each for one region), including various kinds of mercs using this method and other.

    So this way, we are step closed to using forts as "semi" settlements.... combined with some other ideas, perhaps this can be improved even further in that regard

    You could also use this without specific pools, to simply allow recruitment of mercenaries only inside forts, to make the forts matter more. (so you wouldnt use I_CharacterTypeNearTile and would use the same even counter for all forts). I_CharacterTypeNearTile is generally not needed, unless you want custom mercenary pools for different factions in the same fort.

    Also, of course you can keep the original recruitment system (that you can recruit units outside), while also using this... You just need to have more mercenay pools

    ------------- Using Engine Overhaul Project, you would also be able to give governor ancillaries to general inside each fort (as in EOP you can use xy coordinates requirement for characters, to give them an anc/generally), that would take a turn (or more), so would be even better. As you could for example set the governor ancillary to be given after one turn, so you would have to wait inside the fort one turn to be able to recruit mercenaries there, instead of being able to do it the moment you enter it. You would simply use "I_WorldwideAncillaryExists" condition to check for the governor ancillary.

    ------ Bug: There is a movement bug for mercenaries recruited inside forts. They always have full movement points when hired, no matter how many movement points the general has.


    Pic:


    Tip: See the mercenary guide


    If anyone has any more cool ideas how to use this, and especially some other ideas/scripts on how to use forts as settlements, please share here, so that we can possibly find even better ways to expand the forts


    - See Callistonian's post below to see how to name your forts, and how to create income from forts.
    Last edited by Jadli; April 02, 2021 at 03:50 AM.

  2. #2

    Default Re: Recruitment Inside Forts - Forts as Semi/Minor Settlements

    I feel like the "bug" where mercs "recruited" in the fort have their full movement points is arguably a feature.

    Since this thread is potentially quite useful for anyone trying to use forts as "minor settlements", here is one way forts can be named and monetized. Most of this set up comes down to your preferences. Just as Jadli's script above repurposes the mercenaries system for "recruitment", this set up repurposes the King's Purse to represent "tax income", but you can also use add_money which will show up under "Corruption and Other". This scheme, by design, does nothing for the AI. The goal with this scheme is to make minor settlements (named forts) feel as similar as possible to regular settlements while using as few monitors (for turn times) as possible.

    Code:
    monitor_event FactionTurnStart FactionType slave
       retire_characters slave witch    ;don't let the rebel faction do anything with the witches
    end_monitor
    
    monitor_event FactionTurnEnd FactionType slave    ;this is the start of the next turn cycle, fires before the start of the first human faction's turn for as long as the slave faction exists (i.e. forever)
    
       inc_event_counter rename_forts 1   ;CALL - rename forts, we will get to this below
    
       if not I_IsFactionAIControlled england                ;assume england has no minor settlements as we count from 0 each turn
          set_kings_purse england 0
       end_if
       ;... all other factions ...
    
       ;Minor Settlement 1
       if I_FactionNearTile england 0 x, y   ;coordinates of fort, this will be true if there is a named character or any agent in the fort, you can also use I_CharacterTypeNearTile if you only want this to work for named characters
       and not I_IsFactionAIControlled england   ;this is completely optional, but in my mod, we use the king's purse to boost AI factions in script
          increment_kings_purse 200    ;this is the value of each minor settlement in "taxation" or whatever you want to call it
       end_if
       ;... all other factions ...
    
       ;Minor Settlement 2
       ;... same as above, all other minor settlements... - this will take up most of the length of your campaign_script document if you have hundreds of minor settlements, but it will not impact performance at all since it's all in a single monitor
    end_monitor
    To name the forts, we use:

    Code:
    monitor_event PreFactionTurnStart    ;name all forts start of turn 1
       inc_event_counter rename_forts 1   ;CALL - rename forts
       terminate_monitor
    end_monitor
    
    monitor_event EventCounter EventCounterType rename_forts   ;FUNCTION - rename forts
    and EventCounter > 0
       spawn_character slave, NameofMinorSettlement1, witch, age 16, x+offset, y+offset   ;a few coordinates away from the fort, or alternatively, somewhere where the spawn will never be interfered with, the witch's name must be unique, if you spawn randomly named slave female agents (princesses or witches), then this will fail and you should use a dummy faction instead of slave
       console_command move_character NameofMinorSettlement1, x, y   ;coordinates of fort
    
       ... repeat for all minor settlements ...
    end_monitor
    Set the witch's movement points to 0 in descr_character so that when named characters or agents move into the fort, the witch will die. I recommend NOPing the witch's death audio and animations so all that happens is the name on the fort disappears until the next turn. Captains will not kill the witch and do not trip I_FactionNearTile so they can't be used to get income from the minor settlements.

    A few final touches are necessary to complete the illusion. You will want to make the witch strat model invisible by assigning the slave faction a texture with nothing in it (100% transparent) and commenting out the shadow line in descr_model_strat. You don't need to do anything with the model but I suppose it might improve performance somewhat if you replace the .cas file with a blank as well. You should also be sure that the slave faction doesn't use its female names list for anything else by preventing regular spawns of princesses and witches. Princesses can be prevented by setting "can_have_princess" to "no" in descr_sm_factions. Witches can be prevented from converting regions to heretic and their spawns can be disabled using the following settings in descr_campaign_db:

    Code:
       <religion>
          <max_witches_per_region uint="0"/>
          <max_witches uint="0"/>
          <witch_conversion_rate_modifier float="0.0"/>
          <witch_conversion_rate_offset float="0.0"/>
          <witch_creation_modifier float="0.0"/>
       </religion>
    Last edited by Callistonian; April 27, 2021 at 08:03 AM.

  3. #3
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,493

    Default Re: Recruitment Inside Forts - Forts as Semi/Minor Settlements

    How the AI deals in your games with the PSFs? For me, it's always been an argument against having them, even if they'd be welcome for the other purposes.
    JoC
    Mod leader of the SSHIP: traits, ancillaries, scripts, buildings, geography, economy.
    ..............................................................................................................................................................................
    If you want to play a historical mod in the medieval setting the best are:
    Stainless Steel Historical Improvement Project and Broken Crescent.
    Recently, Tsardoms and TGC look also very good. Read my opinions on the other mods here.
    ..............................................................................................................................................................................
    Reviews of the mods (all made in 2018): SSHIP, Wrath of the Norsemen, Broken Crescent.
    Follow home rules for playing a game without exploiting the M2TW engine deficiencies.
    Hints for Medieval 2 moders: forts, merchants, AT-NGB bug, trade fleets.
    Thrones of Britannia: review, opinion on the battles, ideas for modding. Shieldwall is promising!
    Dominant strategy in Rome2, Attila, ToB and Troy: “Sniping groups of armies”. Still there, alas!

  4. #4

    Default Re: Forts as Semi/Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    The AI's attitude towards forts is controlled with merge_fort_priority_offset and defend_fortified parameters in descr_campaign_ai_db. If merge_fort_priority_offset is set to 0, the AI will behave more or less as they do in vanilla but without forts being buildable (a prerequisite for any minor settlements scheme). At -500, they become allergic to forts and never garrison, at 500 they garrison their forts almost in preference to their settlements. Somewhere in between is the sweet spot for any mod that uses minor settlements.

    That is only passive garrisoning though. It does not seem possible to make the AI actively use forts defensively or offensively. In fact, I don't think they can even see forts. If they attack a fort, it will only be because it has enemy units inside it. They will never attack empty forts even if the fort is on their territory and belongs to an enemy. They will attack empty settlements, but not empty forts. This is the biggest problem with how the AI interacts with forts, in my opinion. Because of this, there is an argument to be made for using I_CharacterTypeNearTile with named_character for the monetization script so that the AI will attack forts that are making money.

    Edit: This is apparently incorrect - the AI does sometimes attack empty enemy forts.
    Last edited by Callistonian; February 08, 2022 at 07:14 PM.

  5. #5

    Default Re: Forts as Semi/Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Nice idea with the mercenary recruitment, I will try that for sure!
    Regarding the finances, I think that if you increase the number of units with free upkeep, it already compensates the lack of money.

  6. #6
    Araval's Avatar Protector Domesticus
    Join Date
    Nov 2010
    Location
    Tartu, Estonia
    Posts
    4,754

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Interesting stuff, thanks guys!

  7. #7
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Indeed!

    BTW, careful when working with descr_mercenaries, I believe it works properly only when the same region is not referenced in different pools. If the same region is in multiple pools, it seems that only one of them work (prob the later one). But thats not really an issue, as you are using the "events" parameter for units, not the pools.

    So assuming you want to have fort recruitment in every/most province, and also keep the normal mercenaries working, you probably have to regional pools, ie one pool for every region, consisting of all the mercs.

  8. #8

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    I can confirm from testing that regions will only use one pool. If you list the region in multiple pools, the region will only use the first or last pool where it shows up and no others. This is well known and I believe Withwnar's text editor catches this error, and yet many mods still make it from what I've seen.

  9. #9

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Just a warning for everyone considering monetizing forts with the script posted above: I_FactionNearTile returns true for agents as well as named characters. This is problematic because agents will survive inside forts when they're captured by an enemy and hence this script will continue giving money to the agent's faction even though the fort no longer belongs to that faction. This can be fixed by using 'I_CharacterTypeNearTile faction_name named_character 1 x, y'. This will only fire if the faction has a general in the fort and generals will obviously be killed when the fort changes ownership.
    Last edited by Callistonian; April 25, 2021 at 12:06 PM.

  10. #10
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Nice, maybe use both?

    I_CharacterTypeNearTile faction_name named_character 1 x, y'

    and

    I_CharacterTypeNearTile faction_name merchant 1 x, y'

    to ensure there also is the merchant... (or they are "permanent" in your mod?)

  11. #11

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    I think merchants have the same problem as other agents - they survive if an enemy captures the fort.

  12. #12
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Ah, nvm I thought you mentioned somewhere that you are using merchants as "administrators"? By putting the minor settlements/forts on a trade resource, the merchant make money by sitting in the fort. Have you abandoned that idea and replaced it with king's purse? And if so, for what reason, if I may ask ... because they survive the capture of the fort?

    Also, as you say I suppose its no need to bother scripting the monetization for AI, as they get lot of other money anyways, and they kinda dont see empty forts anyway.

    But perhaps we could make the recruitment script for AI as well, for when they control the minor settlements (or ifa player doesnt control the minor settlement of the region)? That would have to be recruitable in the entire region for the AI, not inside forts, and I assume would require lot of conditions, so that the merc pool shows up during their turns, not player's turn? Worth doing?

  13. #13

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    We were using priests as "minor governors", but the fact that they survive the fort's change of ownership kills the concept. Simply put, I_FactionNearTile and I_CharacterTypeNearTile for anyone but named_character are not sufficient conditions to test who owns the fort. As far as I can tell, the only way to be sure that some faction owns the fort is if they have a named_character on the tile. Named characters can't survive the fort changing ownership. Captains (generals) don't exist inside forts (units by themselves don't even trigger I_FactionNearTile). Agents survive the ownership change.

    Using named characters to test fort ownership has the virtue that the AI can see enemy forts that are generating money, recruiting units, etc.. It has the obvious drawback that it requires spending named characters on forts which is strategically wasteful unless the forts offer significant value. And of course, the AI only incidentally leaves named characters in forts if the merge_fort_priority_offset is high enough, so this can't be used for the AI.

  14. #14

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    I was wrong about the AI not being able to see and attack empty enemy forts - they do apparently attack empty enemy forts. I saw this happen for the first time recently in EBII - they captured and immediately moved out of a fort in one of my controlled regions. It seems like their army doesn't have enough strength to attack the settlement but they're also not falling back to their defend border tiles, so they're just floating around in my region and eventually stumbled upon any empty fort and took it.

    EBII's merge_fort_priority_offset is set to -500 which explains why they popped out of the fort as soon as they captured it.

  15. #15
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Well, I think it is known, that if you set merge_fort_priority_offset to +500 or, simply above 0, they will tend to garrisson empty forts, no?

  16. #16

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Yes, merge_fort_priority_offset seems to control how many troops the AI puts in their forts, but I don't think it directly affects their proclivity to capture forts. Large negative values make them "allergic" to forts so that once they capture them they move troops out immediately and will never garrison anything in them. I've never seen large negative or positive values for that parameter change their attitude towards empty enemy forts though. Up until the other day, I thought they just ignored them completely but apparently they do eventually capture them if some mysterious conditions are met.

  17. #17

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    Quote Originally Posted by Callistonian View Post
    Yes, merge_fort_priority_offset seems to control how many troops the AI puts in their forts, but I don't think it directly affects their proclivity to capture forts. Large negative values make them "allergic" to forts so that once they capture them they move troops out immediately and will never garrison anything in them. I've never seen large negative or positive values for that parameter change their attitude towards empty enemy forts though. Up until the other day, I thought they just ignored them completely but apparently they do eventually capture them if some mysterious conditions are met.
    Is there a noticeable difference to how the AI responds to forts that can recruit troops and collect an income? Or does AI respond the same to all types of forts? I am wondering if AI is more likely to capture a fort if it can recruit/gains an income even if the fort is not garrisoned by the player or other AI factions?

  18. #18
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    100% sure the AI has no idea about the script, same basically applies to all the the scripts..

    Tho not sure if they recruit mercs while inside, I assume they can

  19. #19

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    @Despy - Forts cannot recruit troops or generate money, these scripts are using forts but don't actually change anything about how they work fundamentally. The AI doesn't know about these scripts or any others.

    @Jadli - If you're restricting mercs to only be recruited when a scroll is opened, then no, the AI can't do that. If you use separate counters so the AI can recruit mercs normally anywhere in the region, then I'm not sure they will ever recruit from inside a fort, but if they do it would be entirely coincidental.

  20. #20
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Forts as Minor Settlements - Recruitment Inside Forts - Income From Forts - Named Forts

    well, afaik I heard AI almost always recruit mercs when available... Anyway, for AI, I suppose the counters would have to different and let them recruit in the entire region

Page 1 of 2 12 LastLast

Posting Permissions

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