AI recruitment query
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
AI recruitment query
Hi,
I'm balancing a scenario (v1.16.10 on Windows 11) and would like to tweak the AI recruitment but can't get the exact behaviour I'd like.
I have an AI that has a fairly extensive recuit list but I really want 2 types to be favoured (i.e. have more of them being recruited).
I've tried
The frequency of the specified units doesn't seem to change?
The units are minor variants of the normal unit type with an extra possible trait: weak-willed.
Then I thought I'd try ai recruitment using
That is have this:
Where <anything> is the wildcard so the AI recruits any unit from the recruit list (so not a specific level or usage etc.).
I tried using an asterisk (*) and nothing at all between the commas but in both cases the AI ignored those entries and only recruited Xbows and pillagers.
So, if anyone can advise me if:
cheers!
-- Spannerbag
I'm balancing a scenario (v1.16.10 on Windows 11) and would like to tweak the AI recruitment but can't get the exact behaviour I'd like.
I have an AI that has a fairly extensive recuit list but I really want 2 types to be favoured (i.e. have more of them being recruited).
I've tried
recruitment_more
but even with the code below it doesn't seem to have any effect?The frequency of the specified units doesn't seem to change?
The units are minor variants of the normal unit type with an extra possible trait: weak-willed.
Code: Select all
[side]
...
recruit=Novice Orcish Shaman,lsb_Orcish Archer,lsb_Orcish Assassin,lsb_Orcish Grunt,lsb_Orcish Crossbowman,lsb_Orcish Slayer,lsb_Orcish Warrior,lsb_Wolf Rider,lsb_Goblin Pillager,lsb_Goblin Knight,lsb_Orcish Leader,lsb_Orcish Ruler,lsb_Goblin Spearman,lsb_Goblin Impaler,lsb_Goblin Rouser
...
[ai] # Default aggression (0.4) and caution (0.25) always
grouping=offensive
recruitment_more="lsb_Orcish Crossbowman,lsb_Orcish Crossbowman,lsb_Orcish Crossbowman,lsb_Orcish Crossbowman,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager"
...
pattern=yes
but what I'd ideally like to be able to do is specify a "wildcard" type so that most of the recruits are a spread of the recruit list but then bump up the frequency of a few by specifying their type a few times - but I can't seem to do that?That is have this:
Code: Select all
[aspect]
id=recruitment_instructions
[facet]
turns=""
[value]
[recruit] # More pillagers (recruitment_more didn't make enough of a difference)
pattern=yes
type=",<anything>,<anything>,<anything>,<anything>,<anything>,lsb_Orcish Crossbowman,lsb_Goblin Pillager,lsb_Goblin Pillager"
[/recruit]
[/value]
[/facet]
[/aspect]
I tried using an asterisk (*) and nothing at all between the commas but in both cases the AI ignored those entries and only recruited Xbows and pillagers.
So, if anyone can advise me if:
- There is a wildcard character for "any unit" in the
type=
key and if so what it is, and - if not, is there another way to do this?
(For example changing the unit type's score directly in WML?)
cheers!
-- Spannerbag
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: AI recruitment query - update
Tried various options without any success.
Then tried using composite format and specifying all values.
I'm not certain but the AI did seem to recruit more of the preferred unit types, but I'm thinking I might use
Anyway, as I say, this seemed to work:
Maybe changing the
Might try the original (simple) syntax again, it could be I was just unlucky - even with the multiple pillager entries above the ai seems to recruit only slightly more pillagers and Xbows (and not significantly more pillagers than Xbows).
Or, maybe,the ai just decided to recruit these units purely by chance.
I'll run a few more turns and see what happens.
Cheers!
-- Spannerbag
Then tried using composite format and specifying all values.
I'm not certain but the AI did seem to recruit more of the preferred unit types, but I'm thinking I might use
total
instead.Anyway, as I say, this seemed to work:
Code: Select all
[aspect]
id=recruitment_more
invalidate_on_gamestate_change=no
invalidate_on_minor_gamestate_change=no
invalidate_on_tod_change_change=no
invalidate_on_turn_start=no
name=composite_aspect
[facet]
engine=cpp
# id= # Not needed
invalidate_on_gamestate_change=no
invalidate_on_minor_gamestate_change=no
invalidate_on_tod_change_change=no
invalidate_on_turn_start=no
name=standard_aspect
time_of_day=dawn,morning,midday,afternoon,dusk,midnight
turns=""
value="lsb_Orcish Crossbowman,lsb_Orcish Crossbowman,lsb_Orcish Crossbowman,lsb_Orcish Crossbowman,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager,lsb_Goblin Pillager"
[/facet]
[/aspect]
invalidate_on_...
keys helped?Might try the original (simple) syntax again, it could be I was just unlucky - even with the multiple pillager entries above the ai seems to recruit only slightly more pillagers and Xbows (and not significantly more pillagers than Xbows).
Or, maybe,the ai just decided to recruit these units purely by chance.
I'll run a few more turns and see what happens.
Cheers!
-- Spannerbag
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: AI recruitment query - update 2
Hmmm... having run more turns I don't think the above code is doing anything after all.
Oh well, might try
Cheers!
-- Spannerbag
Oh well, might try
total
instead.Cheers!
-- Spannerbag
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: AI recruitment query alternative solution
Tried the following:
It worked rather well
Would still like to know if I used
Cheers!
-- Spannerbag
Code: Select all
[ai]
...
recruitment_pattern="archer,fighter,fighter,mixed fighter,scout,lsb_Orcish Crossbowman,lsb_Goblin Pillager"
...
Would still like to know if I used
recruitment_more
correctly and if there's a wildcard character for type=
in [recruit]
(I suspect not).Cheers!
-- Spannerbag
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: AI recruitment query
As far as I can tell, you used
There is no wildcard character for types in the recruitment instructions. I believe there's actually an open issue for that on GitHub.
recruitment_more
correctly and it should have caused the AI to heavily favour recruiting the two unit types listed. That said, I don't fully understand how the type score for a unit is calculated, so it's possible that there are circumstances where adding 100 or 250 to that score isn't all that significant? I'd have to look into the recruitment algorithm in more detail.There is no wildcard character for types in the recruitment instructions. I believe there's actually an open issue for that on GitHub.
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: AI recruitment query
However, Spannerbag mentioned that using two consecutive commas with nothing between them didn't have any effect, so it's likely that the empty strings are stripped out when splitting the list. That would mean the empty string only works as a wildcard when it's the only entry.