AI Question
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 Question
Hi,
I am new to this game and I am really loving it. But as I am trying to make my own scenario, I ran into an issue that maybe someone can help me with. I am trying to set up caution levels for individual special units (can't recruit), but it doesn't seem like the code recognizes that. Under [side], I can set a caution level for each faction, but under [unit], the ai options seem to be limited to formula ai, which I don't know how to do. What I am seeing is that sometimes, the ai would send these units into suicide moves, instead of being very cautious about movement, but I don't want to set the caution level for the entire side to something greater than 1. Does anyone know if it is even possible to set up non-leader unit individual caution levels? thanks.
I am new to this game and I am really loving it. But as I am trying to make my own scenario, I ran into an issue that maybe someone can help me with. I am trying to set up caution levels for individual special units (can't recruit), but it doesn't seem like the code recognizes that. Under [side], I can set a caution level for each faction, but under [unit], the ai options seem to be limited to formula ai, which I don't know how to do. What I am seeing is that sometimes, the ai would send these units into suicide moves, instead of being very cautious about movement, but I don't want to set the caution level for the entire side to something greater than 1. Does anyone know if it is even possible to set up non-leader unit individual caution levels? thanks.
- Chief_Chasso
- Posts: 132
- Joined: December 15th, 2012, 2:36 am
Re: AI Question
Hi jeeree, welcome to the forums.
I'm not sure about setting "caution" levels, but I'm sure there are a number of ways to accomplish what you're trying to do. Maybe try modifying the unit with the [modifications] tag and use ai_special=guardian. This would make it so the unit doesn't move until an enemy unit is within range.
Also, you might get more replies if this thread was posted in WML Workshop. Maybe this will get moved...
I'm not sure about setting "caution" levels, but I'm sure there are a number of ways to accomplish what you're trying to do. Maybe try modifying the unit with the [modifications] tag and use ai_special=guardian. This would make it so the unit doesn't move until an enemy unit is within range.
Also, you might get more replies if this thread was posted in WML Workshop. Maybe this will get moved...
SP Campaign: Rally For Roanic
Re: AI Question
Ahh, thanks, I didn't know there was a specific section for these type of questions. But back to the question, setting the ai to guardian would prevent the unit moving at all... I guess I still want the unit to move, just that they need to retreat when for example, their hp gets below 1/2 so they won't run in and suicide. I have seen too many cases where units with only single digit hp runs into a group of enemies only to be killed the next turn.
Re: AI Question
It sounds like setting the unit(s) to one of micro AI may solve the issue.
But I cannot tell exactly which one you should use until I realize exactly what you want to do. The zone guardian, maybe?
The easiest way is to install the unit(s) in a different side, though, if you don't mind.
But I cannot tell exactly which one you should use until I realize exactly what you want to do. The zone guardian, maybe?
The easiest way is to install the unit(s) in a different side, though, if you don't mind.
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
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: AI Question
Moved to the WML Workshop.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: AI Question
Thanks for the move. Anyways, it seems like I didn't quite express what I am looking for very well. Basically, I am creating "hero" units that cannot recruit (because otherwise, the ai just have them stand around the keeps and do nothing. Recruiting is done by "castle" units). The way it is set up right now, each faction has several hero units. they go out and fight with all the regular units AI builds, but when they get low on hp, they have a tendency to keep pressing forward, probably due to caution settings for the side. I am trying make these hero units retreat earlier than regular units so they don't die so easily, which I guess would mean to have a higher caution level for these specific units only. But It seems like the only [ai] recognized by [unit] tab is formula AI in accordance to the wiki, which I have no idea how to program at this point. There is also no other [filter] fuctions built into the [ai] tab either, making it impossible to assign specific ai's to specific units. Does anyone have any idea how to do this? (btw, I already have 9 sides filled up, so i don't think i can get by with putting them on separate sides)
Re: AI Question
Hi jeeree. The answer to your question, unfortunately, is that you have done all the research and that this cannot be done using existing AI parameters. You could try to exclude your hero units from attacks using the attacks aspect, but that will have other side effects that will likely make things worse. The only way to deal with this is by writing you own AI code for the units - or maybe one of the Micro AIs would do (maybe Protect Unit?), as SkyOne pointed out.jeeree wrote:But It seems like the only [ai] recognized by [unit] tab is formula AI in accordance to the wiki, which I have no idea how to program at this point. There is also no other [filter] fuctions built into the [ai] tab either, making it impossible to assign specific ai's to specific units. Does anyone have any idea how to do this? (btw, I already have 9 sides filled up, so i don't think i can get by with putting them on separate sides)
As a side note, even if you could set caution for an individual unit, it would not entirely prevent the behavior you are seeing.
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