Results 1 to 10 of 10

Thread: Creating a World - The Recruit Limit Script

  1. #1
    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 Creating a World - The Recruit Limit Script

    IntroductionThis script attempts to stop the AI from spamming endless stacks of low level units instead of using funds to develop settlements. Theoretically it would be a simple script if the developers in their wisdom had given us a script condition to count a faction’s number of unit on the map. As this is not the case a rather elaborated way of establishing a value to trigger a recruitment stop for individual factions is the base of this script. It still has a short coming where the battle loss of units is concerned, as this can’t be ascertained either via script, this has been addressed via the ‘re-imbursement’ script part where a ‘credit’ is issued according to the total military size of a faction.

    This script has been originally developed and written by me for EBII where it has been in use satisfactorily for quite a while now. The length of the script is a staggering 219.000 lines, but it contains only 37 monitors (excluding the faction turn log script part) which means there is hardly any impact on processing times, considering that the whole EBII script has slightly more than 1.000 monitors.

    If it hasn’t become clear by now, let me state the obvious: this is not a script for beginners.
    DownloadLink for the supporting files and an extensive manual in PDF format on how to proceed. Simply extract on your desktop (7Zip is freeware).

    Spoiler for teaser
    Last edited by Gigantus; June 20, 2018 at 07:27 AM.










  2. #2

    Default Re: Creating a World - The Recruit Limit Script

    I downloaded the earliest shape when the thread was still locked, and it gave me some interesting ideas to pursue. I don't think I will be using your method as is, it seem too nerfing for some game situations, for the ai especially, and the way the faction_size is based on walls levels isn't too much to my liking.
    I already have my share of long scripts too, so I think I will make a lighter thing somehow, both in gameplay and scripting as I am not looking for a hard level of recruitment limit.

    Thanks for the inspiration, Giganfus my old friend. I will post my results if you, or anyone is interested. (maybe even if nobody is)

  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 a World - The Recruit Limit Script

    Would be interesting to see what approach you take. Seeing that you can't count units on the map it's a scripting mess anyhow, regardless from which angle you look at it.
    I thought one stack per large settlement\castle (large stone wall\fortress) should keep things still rolling nicely.










  4. #4

    Default Re: Creating a World - The Recruit Limit Script

    I am a king among morons, I write while wanting to break my head in a wall... Really, I once knew the script replicator tool, but somewhere between my first attempts where I didn't really need it and the time it took to become good enough at scripting, I had completely forgot this tool!!! Thinking of who know how many time I wasted in the last two years or so in manually replicating some loooong scripts really make the wall tempting...

    Well, it's not too late to use it and catch up on other scripts I never finished to replicate (what a...)

    To get back on track, I am still in early thinking of how to exactly proceed but I am not looking so much at setting a hard limit on all units types rather than limiting some of them when they are useless and cost money for nothing on the ai, I wrote simple start like this to inspire myself for later:
    Code:
    declare_counter ship_number_aksum
    
    monitor_event CharacterTurnStart Treasury >= 10000
    and FactionIncome >= 2000
    
    
    if I_EventCounter aksum_turn > 0
    
    
    if I_NumberOfSettlements aksum < 6
    and I_CompareCounter ship_number_aksum > 5
    
    
    set_event_counter ship_limit_aksum 1
    end_if
    
    
    if I_NumberOfSettlements aksum < 6
    and I_CompareCounter ship_number_aksum < 6
    
    
    set_event_counter ship_limit_aksum 0
    end_if
    ;;;; next
    end_if
    ;;;; next faction turn
    ;;;
    end_monitor
    
    ;;;; similar CharacterTurnStart but only for setting the limit event_counter when there is not enough finances
        
    
    monitor_event UnitTrained TrainedUnitCategory ship
    
    
        if I_EventCounter aksum_turn > 0
            inc_counter ship_number_aksum 1
        end_if
    ;;;;
    end_monitor
    Then proceed with the set/inc_recruit_pool according to who own what settlement on one Settlement/FactionTurnStart, the huge part that was hugely annoying me to think about but the script replicator should greatly help there.
    Since I am not looking for a real count of units, rather a estimation based on the factions means of spending and staying on float, finding the right balanced number of treasury and faction income versus the cost of some units types in my mod, then maybe something with the number of settlements, should make things simpler than counting a faction size by value of units and core walls. Though I expect it won't be exactly like above which just a little thinking ahead.
    Last edited by selv; June 21, 2018 at 07:07 PM.

  5. #5
    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 a World - The Recruit Limit Script

    Unless I am missing something you never increase the aksum_turn counter which means the script won't progress.
    The CharacterTurnStart event fires an extended number of times per turn and faction which might slow down processing time, rather use FactionTurnStart\End










  6. #6

    Default Re: Creating a World - The Recruit Limit Script

    I already have factions turn event_counters implemented in my mod, you gave me the tip, remember?
    The above script start isn't even in my c_s yet, just in my notes for later, so I will see about deciding which final events I choose when I get to implementation, I know FactionTurnStart appear better, but I wanted to try something not directly related and CharacterTurnStart ended in my reminder notes.

  7. #7
    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 a World - The Recruit Limit Script

    Ah yes, the ever helpful faction turn script










  8. #8

    Default Re: Creating a World - The Recruit Limit Script

    Shh, I have a problem. Well it's the same as yours, the one where you can't count battle destroyed units, making the whole idea of setting a approximative max number of units even more dangerous than before to my mind, regardless of the approach taken, and I can't think of anything after a thousandth trip in the docudemon.

    At least this trial gave me the idea of stopping/increasing the region/faction recruitment based of some very specific units types, it seem to actually solve some problems with specific things that are hard to push forward in my cai factions labels.

    The rest of the idea isn't suited for me it seem. Maybe a other time.
    Out of curiosity, does the ai really manage well with your recruitment limit in EB2, or a other mod you are using it with?
    For some reasons, I keep picturing problems with ai not being able of taking advantages of opportunities, or unable to defend themself in nasty situations, because for all it's merit the script is just freezing/unfreezing pools on estimations/chances, without knowing what else is really going on?

  9. #9
    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 a World - The Recruit Limit Script

    It's been working pretty well with the current values - certainly a vast improvement from the numerous stacks wandering the land and underdeveloped cities.










  10. #10
    Aneirin's Avatar of flowing verse
    Join Date
    Nov 2012
    Location
    Gododdin
    Posts
    2,734

    Default Re: Creating a World - The Recruit Limit Script

    Hello Gig,
    just following your tutorial step by step, what isn't clear to me is 4b_capturechecks.
    What do you mean by increasing the value 1,2,3 etc.?


    Edit:

    Also, I don't get what do you mean by matching the regions from the descr_regions?
    Especially the counter region_001_frozen?

    Code:
            if not I_IsFactionAIControlled [faction]
                terminate_monitor                                   ; terminate monitor if faction is player controlled
            end_if
            if I_SettlementOwner [settlement] = [faction]           ; does this faction own this settlement
                and I_CompareCounter exceedlimit_[faction] > 0      ; has this faction exceeded the upkeep limit
                and I_CompareCounter region_001_frozen < 1          ; is this pool NOT frozen
                freeze_recruit_pool region_001 true                 ; freeze the regional recruit pool
                set_counter [region]_frozen 1                       ; set the 'region' counter true
            end_if
            if I_SettlementOwner [settlement] = [faction]
                and I_CompareCounter exceedlimit_[faction] < 1      ; is this faction below the upkeep limit
                and I_CompareCounter region_001_frozen > 0          ; is this pool frozen
                freeze_recruit_pool region_001 false                ; unfreeze the pool
                set_counter [region]_frozen 0                       ; set the 'region' counter false
            end_if
    Last edited by Aneirin; September 06, 2019 at 04:57 AM.
    Proud son of Aikanár and brother of Iskar

Tags for this Thread

Posting Permissions

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