Are "healing" and "retreat" valid ids for the [aspect] tag?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
Post Reply
User avatar
A Guy
Posts: 790
Joined: May 24th, 2008, 1:55 am

Are "healing" and "retreat" valid ids for the [aspect] tag?

Post by A Guy »

In [ai], I'm trying to get the AI to consider some units as completely expendable - are these ids for [aspect] the ones which control cautious behavior?
I'm just... a guy...
I'm back for now, I might get started on some work again.

mattsc
Posts: 1152
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by mattsc »

Umm, the short answer is no, but I am not entirely sure what you are asking. There's some confusion here, I'm just not sure on which side. :) There are candidate actions called "healing" and "retreat", but there are no aspects by those names (or ids). Only what's listed at those links is available. Another way to see what exists is to type :inspect in debug mode, click on any of the teams and then on 'ai config full'. That shows all the available CAs and aspects as well as their values.

Not sure if this helps ...

Wussel
Posts: 617
Joined: July 28th, 2012, 5:58 am

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by Wussel »

You want to make the ai daring? Use the caution setting. But only for a few predefined units? Use 2 AI sides with different caution settings. You want it to be on the same side? No idea. Maybe you can limit the moves for certain better units with some trickery. You can give specific caution based on time of day. Maybe you can assign a leader guard somehow? not sure about this. There is some guardian trickery, if you want to have certain points defended. Most work with move limitation. Make a clone of the unit which can only move inside castle terrain and such.

User avatar
A Guy
Posts: 790
Joined: May 24th, 2008, 1:55 am

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by A Guy »

mattsc wrote:Umm, the short answer is no, but I am not entirely sure what you are asking. There's some confusion here, I'm just not sure on which side. :) There are candidate actions called "healing" and "retreat", but there are no aspects by those names (or ids). Only what's listed at those links is available. Another way to see what exists is to type :inspect in debug mode, click on any of the teams and then on 'ai config full'. That shows all the available CAs and aspects as well as their values.

Not sure if this helps ...
That helps a lot, thank you!
Wussel wrote:You want to make the ai daring? Use the caution setting. But only for a few predefined units? Use 2 AI sides with different caution settings. You want it to be on the same side? No idea. Maybe you can limit the moves for certain better units with some trickery. You can give specific caution based on time of day. Maybe you can assign a leader guard somehow? not sure about this. There is some guardian trickery, if you want to have certain points defended. Most work with move limitation. Make a clone of the unit which can only move inside castle terrain and such.
I have two custom status effects - one which renders a unit unhealable for a number of turns, and one which causes a unit to lose 8 HP permanently each turn. I need the AI to consider units afflicted with these status effects expendable where it'd consider other units worth keeping.
I'm just... a guy...
I'm back for now, I might get started on some work again.

mattsc
Posts: 1152
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by mattsc »

A Guy wrote:I have two custom status effects - one which renders a unit unhealable for a number of turns, and one which causes a unit to lose 8 HP permanently each turn. I need the AI to consider units afflicted with these status effects expendable where it'd consider other units worth keeping.
I don't think that such a feature exists currently, but it would be pretty easy to write a custom candidate action that does an unconditional attack with certain units. In fact, I've been toying with the idea of writing a Micro AI that does pretty much that: you pass a Standard Unit Filter to it and the units which match that filter attack with the only consideration being maximum damage dealt to the enemy. All other units would follow standard behavior. Would that work for what you have in mind?

User avatar
A Guy
Posts: 790
Joined: May 24th, 2008, 1:55 am

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by A Guy »

mattsc wrote:
A Guy wrote:I have two custom status effects - one which renders a unit unhealable for a number of turns, and one which causes a unit to lose 8 HP permanently each turn. I need the AI to consider units afflicted with these status effects expendable where it'd consider other units worth keeping.
I don't think that such a feature exists currently, but it would be pretty easy to write a custom candidate action that does an unconditional attack with certain units. In fact, I've been toying with the idea of writing a Micro AI that does pretty much that: you pass a Standard Unit Filter to it and the units which match that filter attack with the only consideration being maximum damage dealt to the enemy. All other units would follow standard behavior. Would that work for what you have in mind?
Yes, that would be perfect. How would I go about writing something like that?
I'm just... a guy...
I'm back for now, I might get started on some work again.

mattsc
Posts: 1152
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by mattsc »

A Guy wrote:How would I go about writing something like that?
Well, one option would be for you to wait and I'll do it. ;) (I'll do this in any case, whether you write your own version or not.) I don't know yet exactly when I'll get around to it, but I expect it to be comparatively straightforward (at least in its first incarnation), so I should be able to get it done for the 1.11.6 release.

Otherwise, you can check out the Practical_Guide_to_Modifying_AI_Behavior and in particular the Lua_AI_Howto.

mattsc
Posts: 1152
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Are "healing" and "retreat" valid ids for the [aspect] t

Post by mattsc »

mattsc wrote:... so I should be able to get it done for the 1.11.6 release.
Well, I was gone most of the last month, so I didn't make it for the 1.11.6 release, but a new Simple Attack Micro AI is available in trunk now and will be in the 1.11.7 release.

If you want to try it before 1.11.7 comes out but don't want to compile Wesnoth, you can simply take the files from this commit and replace the respective files in your 1.11.6 Wesnoth data folder with them. You don't need to compile, just replacing the files is good enough.

Post Reply