Create unit specific ai movement goals

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
Anagkai
Posts: 58
Joined: February 12th, 2012, 10:05 am

Create unit specific ai movement goals

Post by Anagkai »

Is there a way, to define high priority movement goals for a specific type of unit?

As far as I understood the [goal] tag can not use a filter to make it unit specific. Is this true? And, if so, is there another way to achieve a similar effect.
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Create unit specific ai movement goals

Post by mattsc »

You are correct about the [goal] tag not being unit specific. What you can do is to set goto_x, goto_y for the units for which you want to achieve this. Note, however, that this is not quite the same as setting a goal, because the goto candidate action (CA) is executed before all other CAs, while the move-to-targets (goals) CA is almost the last one. Most noticeable difference is that the former is executed before attacks and the latter after. So if you do this, you might want to have an event that changes the goto_x/y values dynamically as needed.

A more flexible way would be to use the Goto Micro AI. In addition to letting you select which units it applies to, you can also set the CA score, so you can choose whether you want it executed before or after other CAs.
Post Reply