Leader unit not obeying [avoid] tag

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
quantumfleet
Posts: 38
Joined: June 17th, 2011, 1:26 am

Leader unit not obeying [avoid] tag

Post by quantumfleet »

So I've been building a scenario where, if the player makes it to an enemy leader's castle, he runs a short distance (past an easily-defended chokepoint), gets some reinforcements, and stays there for the rest of the scenario. The idea is that he stays behind the easily-defended chokepoint with his reinforcements while other events force the player to leave the area, allowing him to become a recurring villain. To keep his units behind the chokepoint, I've added an [avoid] area covering covering an area that would allow him to leave the area, and it works well. Not even a dark adept sitting in a shallow water hex can entice his units out.

The problem, however, is that the leader himself appears to be unaffected by the [avoid] tag, and instead makes a beeline for his castle keep, which is but a turn or two away. How can I fix this?
Currently working on various ideas using 1.9.8.9
User avatar
beetlenaut
Developer
Posts: 2867
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Leader unit not obeying [avoid] tag

Post by beetlenaut »

wiki wrote:[avoid]...A location for the AI to avoid moving to. The AI will never move a unit to this location except for trying to move its leader to a keep.
This sounds like a feature instead of a bug. You could use an event to remove all the leader's movement points each turn, or change the keep to a custom terrain that only looks like a keep, but doesn't work. I hope one of these solutions meets your needs because it's all I can think of.

Edit: You could also put in a feature request to add a key to [avoid] that allows you to override this behavior.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Leader unit not obeying [avoid] tag

Post by Sapient »

What exactly is the desired behavior? Should the leader contribute to opportunistic attacks or just sit there passively?

Depending on the desired behavior, one easy idea that popped into my head was setting the can_recruit to "no".
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
quantumfleet
Posts: 38
Joined: June 17th, 2011, 1:26 am

Re: Leader unit not obeying [avoid] tag

Post by quantumfleet »

beetlenaut wrote:
wiki wrote:[avoid]...A location for the AI to avoid moving to. The AI will never move a unit to this location except for trying to move its leader to a keep.

How did I miss that???? :doh:
Sapient wrote:What exactly is the desired behavior? Should the leader contribute to opportunistic attacks or just sit there passively?

Depending on the desired behavior, one easy idea that popped into my head was setting the can_recruit to "no".
I've thought about this for a while, and eventually settled on having him just sit there passively. Adding a "passive_leader=yes" worked like a charm.

Thanks for the responses.
Currently working on various ideas using 1.9.8.9
Post Reply