AI recruitment with persistent=yes
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.
AI recruitment with persistent=yes
I'm trying to give an AI side a recall list, and I found that it only works if I set persistent=yes in its [side] tag. However, with persistent=yes, the side does not spend all its gold recruiting (possibly saving gold for future scenarios). I'd like the side to be able to recall, but have the default recruiting behavior as well (not caring about its income). Is there any way to do this? Thanks
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Re: AI recruitment with persistent=yes
I dont know if there is a solution for your problem, but in case none provides you one, I had also a problem with AI recalling for different reasons, and did this code to hack them. May be you find something usefull in case you need a "desperate" solution
Spoiler:
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: AI recruitment with persistent=yes
You could also let the AI recruit as normal, then use a recruit event to give each unit a random number of XP, and give the AI a refund for the cost of the unit minus 20. That won't work well when the AI gets low on gold, but you might want it to just recruit a couple level-1 units at that point anyway.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: AI recruitment with persistent=yes
Hi MadMax,
Glad to see you are back.
Anyway, like you said, since BfW 1.11.7, the AI saves gold: http://forums.wesnoth.org/viewtopic.php?f=21&t=39700
It probably affects your issue, I guess.
So you probably just need:in the side.
Glad to see you are back.
Anyway, like you said, since BfW 1.11.7, the AI saves gold: http://forums.wesnoth.org/viewtopic.php?f=21&t=39700
It probably affects your issue, I guess.
So you probably just need:
Code: Select all
[ai]
[aspect]
id=recruitment_save_gold
[facet]
[value]
active=0
[/value]
[/facet]
[/aspect]
[/ai]
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
- James_The_Invisible
- Posts: 534
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: AI recruitment with persistent=yes
Actually, in the last post of the thread that you linked
so the cause of the described behavior is probably different and your code will not change anything.mattsc wrote:Another quick update: The following will be in the release notes when 1.11.9 comes out:
RCA (default) AI gold saving default is reverted back to 'off'
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: AI recruitment with persistent=yes
Uh-oh! You are right.James_The_Invisible wrote:Actually, in the last post of the thread that you linkedso the cause of the described behavior is probably different and your code will not change anything.mattsc wrote:Another quick update: The following will be in the release notes when 1.11.9 comes out:
RCA (default) AI gold saving default is reverted back to 'off'
I just have run a scenario that affects the matter without the code (removing) on 1.11.16. It is off now.
Sorry MadMax. It doesn't help at all...
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Re: AI recruitment with persistent=yes
Tested, doesn't work. I noticed though that if the recall list is empty, the AI seems to recruit normally (even with persistent=yes). Could this be a bug?SkyOne wrote:Uh-oh! You are right.
I just have run a scenario that affects the matter without the code (removing) on 1.11.16. It is off now.
Sorry MadMax. It doesn't help at all...
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Re: AI recruitment with persistent=yes
That does sound like a bug, yes. I thought that I had done something like this previously and it worked, but I haven't tried recently. Which version of Wesnoth are you using? I'll test this, but it might be a week or so before I get to it.MadMax wrote:I noticed though that if the recall list is empty, the AI seems to recruit normally (even with persistent=yes). Could this be a bug?
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
- James_The_Invisible
- Posts: 534
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: AI recruitment with persistent=yes
Why should it be a bug? What would you do if you lost all your veterans? (No matter if it is a result of a bad strategy or a decision of scenario's designer.) I believe that you would start recruiting new units.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: AI recruitment with persistent=yes
Indeed. That's not the bug. The way how I understood the question was that the previously described behavior in combination with this might be a bug: If the recall list is empty, the AI recruits. If it is not empty, it does not recruit (if there's gold left for recruiting but not for recalling). Is the latter behavior a bug given that it works when the recall list is empty?James_The_Invisible wrote:Why should it be a bug? What would you do if you lost all your veterans? (No matter if it is a result of a bad strategy or a decision of scenario's designer.) I believe that you would start recruiting new units.
However, thinking about it some more, I think that this is not actually a bug per se but rather non-perfect AI behavior. If I remember correctly, the AI always recalls all units first and only starts recruiting once it is done with that. It will recall a walking corpse for 20 gold rather than getting a new one from the recruit list. Thus, this is a "feature" (albeit admittedly not a good one) rather than a bug. (Note that I was not involved in the development of this, that was "before my time", so I'm just basing this on observations of AI behavior.)
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
- James_The_Invisible
- Posts: 534
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: AI recruitment with persistent=yes
Yes, I have observed this too. And yes, it would be better to recruit any new unit (even a wc) than recall a walking corpse for 20 gold. But I can see that this behavior comes only from macro RECALL_AI_SIDE and one can define a better one with only wml. It would not be so easy but it is possible. (I do not know what all setting persistent attribute of [side] to yes does. I have only seen that it stores side's leader, recall list and gold.)If I remember correctly,the AI always recalls all units first and only starts recruiting once it is done with that.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: AI recruitment with persistent=yes
If I remember correctly, it is needed since non-persistent sides have no recall list and persistent=no is the default for AI sides.James_The_Invisible wrote:I do not know what all setting persistent attribute of [side] to yes does.
Well, actually, no that is not what controls the default recalling, which is done from within the AI C++ code. This macro is an alternative to that, that could be used instead. Maybe it was written before the AI engine could handle recalls? Just guessing here ... But yes, this could in principle be modified to do alternative recalling. However ...James_The_Invisible wrote:But I can see that this behavior comes only from macro RECALL_AI_SIDE and one can define a better one with only wml. It would not be so easy but it is possible.
So I did some quick tests over lunch break of this using my own test scenario and Wesnoth 1.11.16 and none of those problems exist there. The AI will happily mix recalls and recruits even if the recall list is not empty yet. And it stubbornly refuses to recall walking corpses, peasants or other units it does not consider worth the gold, just as it should. This was all changed when flixx implemented the new recruitment mechanism for Wesnoth 1.11.7.
MadMax: does that mean that you are using a version earlier than 1.11.7? If so, then you can consider this fixed. If not, could you post your scenario and a start-of-scenario save so that we can figure out what's going on, as it seems to work for me.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on