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. :dizzy2:
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
https://img170.imageshack.us/img170/...ruitno2.th.jpg
3 (NB, though it says will produce another unit in 2 turns, this does not actually occur)
https://img170.imageshack.us/img170/...uit2jn0.th.jpg
9
https://img170.imageshack.us/img170/...uit3xr8.th.jpg
1
https://img382.imageshack.us/img382/...uit4qm9.th.jpg
0
https://img142.imageshack.us/img142/...uit5by7.th.jpg
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.
Re: Scripted unit recruitment pool replenishment
Wow really nice, this will be infinitely useful. Especially with MA's fantasy units :)
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.
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 :no:
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.
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.
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. :2thumbsup: