Results 1 to 7 of 7

Thread: Scripted unit recruitment pool replenishment

  1. #1

    Default Scripted unit recruitment pool replenishment

    'Scuse my excitement about this one - I got into the modding game to mess around with recruitment so this - along with the other new additions to edb - make my head spin with the possibilities.


    This is all about three scripting commands which give us a great deal of control over the size of recruitment pools for special cases which can't be covered by the standard refresh rates in edb.

    The three commands are these (examples from the Norman prologue campaign script):

    freeze_recruit_pool all true (also uses region_name as well as all)
    - this prevents all unit recruitment (not agent recruitment) from occurring in the settlement.

    set_recruit_pool region_name value unit_name
    - this sets the number of the pool for this unit
    For example:
    set_recruit_pool London_Province 3 Spear Militia

    inc_recruit_pool region_name value unit_name
    - this increments the amount in the pool for this unit by this amount, can also be negative



    For testing and results see the bottom of this thread.

    The possibilities
    Fundamentally, this gives us the power through the scripts alone - and using all the conditionals we're used to in scripts - to determine on a unit and province basis what troops are available to be recruited.

    Major reforms, big events like gunpowder, stuff like that is better determined through event conditions in edb - but think of the smaller scale...

    - you gain an alliance with another power and that grants you a recruitment pool of a new unit in a settlement of yours near to them

    - cities recently conquered are unable to produce troops for a certain number of turns

    - the death of a king might stop recruitment across a whole empire

    - capturing a settlement suddenly allow (or prevent) recruitment of a troop type

    - 1 off unique units!

    - pools based on the happiness level and taxation of settlements

    - a special event or a date or even enemy proximity would grant you a new pool you could recruit from

    Fundamentally, any convergence of events you can script can now provide a recruitment pool effect.



    Testing and results

    Here's the section of script I used:


    Code:
    freeze_recruit_pool London_Province true
    
    
    	monitor_event FactionTurnStart FactionIsLocal
    and I_TurnNumber = 4
    		set_recruit_pool London_Province 3 Spear Militia
                 	terminate_monitor
    	end_monitor
    
    	monitor_event FactionTurnStart FactionIsLocal
    and I_TurnNumber = 5
    		set_recruit_pool London_Province 9 Spear Militia
                 	terminate_monitor
    	end_monitor
    
    	monitor_event FactionTurnStart FactionIsLocal
    and I_TurnNumber = 6
    		set_recruit_pool London_Province 1 Spear Militia
                 	terminate_monitor
    	end_monitor
    
    	monitor_event FactionTurnStart FactionIsLocal
    and I_TurnNumber = 7
    		inc_recruit_pool London_Province -2 Spear Militia
                 	terminate_monitor
    	end_monitor
    So, the number in the pool should go 0 -> 3 -> 9 -> 1 -> 0 (-1)

    0


    3 (NB, though it says will produce another unit in 2 turns, this does not actually occur)


    9


    1


    0


    Of course, you don't have to freeze recruitment to use this - it can continue to replenish normally, just leave out the freeze line above.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Scripted unit recruitment pool replenishment

    Wow really nice, this will be infinitely useful. Especially with MA's fantasy units :)

  3. #3

    Default Re: Scripted unit recruitment pool replenishment

    ER do we get command to monitor current recruitment pool?
    What i mean is can we tell when X number of units can be recruited in province Y?

    Something like
    Code:
    if recruit_pool region_name unit_name = X
    
    end_if
    You will rule now in Tutorial section o great one.
    Last edited by LorDBulA; 11-14-2006 at 22:34.

  4. #4

    Default Re: Scripted unit recruitment pool replenishment

    Quote Originally Posted by LorDBulA
    ER do we get command to monitor current recruitment pool?
    Nothing I can see
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  5. #5

    Default Re: Scripted unit recruitment pool replenishment

    Interesting stuff Epistolary Richard - thank you for your efforts. I am personally interested to see how we can spawn local armies for a faction if it is close to be defeated by the player or any other sistem we can make to do life more difficult for the player in a sort of realistic way.

    I mean what sorts of scripts define events for being defeated as a faction so we can link those to an army spawning. Plus avoiding CTDs ;)

    Also I'm interested how I can unfreeze the mongol AI once I freezed it. That's mostly because the invasion get's freezed too. I can use the aztec way but it seems to prefer a clear place in the original mongol script. You can't stick unfreeze_AI_bla_bla :) everywere.... so if you have a suggestion I will appreciate it.
    Last edited by Callatian; 11-26-2006 at 13:09.
    Modding Arts Inc.
    Lead Producer for :
    EAW Warlord Demo Mod - 2489 downloads
    SWR ProtectorateTSB TC, SWR AN II,III Series - 20.340 total downloads

  6. #6
    "'elp! I'm bein' repressed!" Senior Member Aenlic's Avatar
    Join Date
    Jul 2005
    Location
    The live music capital of the world.
    Posts
    1,583

    Default Re: Scripted unit recruitment pool replenishment

    Wow, thanks Epistolary Richard!

    I hope Wes is doing OK and out there somewhere reading this. Such a capability ties in very nicely with his original M:TW Medmod ideas about limiting factions' unit recruitments to basic "homelands" areas. It never really made sense to me that faction specific troops could be recruited in far off lands once conquered, as long as the proper buildings were built.
    "Dee dee dee!" - Annoymous (the "differently challenged" and much funnier twin of Anonymous)

  7. #7

    Default Re: Scripted unit recruitment pool replenishment

    Quote Originally Posted by Aenlic
    Wow, thanks Epistolary Richard!

    I hope Wes is doing OK and out there somewhere reading this. Such a capability ties in very nicely with his original M:TW Medmod ideas about limiting factions' unit recruitments to basic "homelands" areas. It never really made sense to me that faction specific troops could be recruited in far off lands once conquered, as long as the proper buildings were built.
    Yes this could make regional recruiting MUCH easier than in RTW, where you had to make all sorts of custom buildings to limit/enable recruitments. Here you just run a script, and for all of your faction's native regions the pools are fine (or augmented), while they are perpetually empty in far off lands. In this way, an English longbow unit will still appear for recruitment while in Turkey, but he will be greyed out and his pool forever set to 0.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO