Delaying actions for AI purposes.

The place to post your WML questions and answers.

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.
Post Reply
BajMic
Posts: 46
Joined: January 24th, 2023, 1:22 am

Delaying actions for AI purposes.

Post by BajMic »

Hello,

I'm familiar with RCA and their implications. I can also use candidate_ca to make Micro AIs act in specific order. This is all, however, action-specific.

Is there a way to make units act in specific order (from a WML level) in such a way, that specific unit types will act first regardless of action (attack, village, etc.)? Fast attack Micro AI is not satisfactory in that regard.
User avatar
Celtic_Minstrel
Developer
Posts: 2274
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Delaying actions for AI purposes.

Post by Celtic_Minstrel »

I can think of a few ways, all of them a giant ugly mess…

Each candidate action has an optional [filter_own] tag which can restrict the units that the action is allowed to control. If you make two or more copies of each candidate action with different [filter_own] tags and different priorities, then I think it will produce the effect you want.

Or you could add two separate [stage] tags which are identical except for having different [filter_own] tags on each candidate action. Stages are run in the order they are added, so this should also produce the effect you want.

Both of these are obviously quite ugly. It would probably be a lot nicer if you could place a [filter_own] tag in the [stage], but unfortunately that's not supported.

For the record, if you need to do use one of those methods and don't want to duplicate it (with or without a macro) in every scenario, you can define a custom AI algorithm using a top-level [ai] tag, and just reference that from your scenarios using the ai_algorithm= key.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
BajMic
Posts: 46
Joined: January 24th, 2023, 1:22 am

Re: Delaying actions for AI purposes.

Post by BajMic »

Thanks, I'll try these out. It might take a while...

I understand all of this goes into the [ai] tag... ?
User avatar
Celtic_Minstrel
Developer
Posts: 2274
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Delaying actions for AI purposes.

Post by Celtic_Minstrel »

Yes.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply