[avoid] clarification

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
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

[avoid] clarification

Post by Spannerbag »

Hi,
Here's a grab of the bottom right part of the map of a scenario I'm playtesting:
mapchunk.jpg
In the south west area of forest I randomly scatter side 7's units with this [avoid] clause:

Code: Select all

    side=7
    no_leader=yes
    controller=ai
    recruit=
    [ai]
      aggression=0.9
      caution=0.1
      [avoid]
        terrain=W*^*
      [/avoid]
    [/ai]
This avoid clause is intended to force these units to stay in that lower right quadrant.
Yet one side 7 unit crossed the water and headed north (I can't see exactly what happened because these units have the [ambush] ability).
Before I start digging further, am I doing anything stupid here?
This side doesn't use any [micro_ai]s tho' a lot of others do.

I've used avoid terrain before, but only without wildcards as far as I can recall.

As the terrain to avoid is only 1 hex deep I'm wondering if the ai only looks at start and end hexes when considering whether to avoid somewhere and these units can cross the avoided terrain in one move (i.e. they start and end in allowed terrain even tho' they traverse terrain they should avoid)?
Any thoughts/comments greatly appreciated.

Cheers!
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [avoid] clarification

Post by Ravana »

Correct, avoid is only about stopping there.
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [avoid] clarification

Post by white_haired_uncle »

Spannerbag wrote: July 1st, 2024, 10:28 pm (I can't see exactly what happened because these units have the [ambush] ability).

Code: Select all

wesnoth --log-info=ai/ca/move_to_targets
Would probably show you exactly what's going on, though if they are moving to attack you might need ai/attack. You could see both with

Code: Select all

wesnoth --log-info=ai/ca/move_to_targets,ai/attack

Code: Select all

wesnoth --logdomains
or

Code: Select all

wesnoth --logdomains ai/
will show all the nice things you can log. --log-debug= would give you a lot more (too much?) detail

Code: Select all

wesnoth --log-info=ai/*
will show you everything ai

Oh, and in recent versions you can add --no-log-to-file if you want the messages to go to the console and not a file.
Speak softly, and carry Doombringer.
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [avoid] clarification

Post by Spannerbag »

Ravana wrote: July 1st, 2024, 10:37 pm Correct, avoid is only about stopping there.
Thanks for the explanantion, very helpful.
A quick unit could traverse 7 forest hexes in one move, so one way, I guess, to prevent them crossing water is:

Code: Select all

     [avoid]
        terrain=W*^*
        radius=3
      [/avoid]
As this makes a "barrier" 7 hexes wide?

Thanks again for your help, much appreciated.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [avoid] clarification

Post by Spannerbag »

white_haired_uncle wrote: July 1st, 2024, 11:55 pm

Code: Select all

wesnoth --log-info=ai/ca/move_to_targets
Would probably show you exactly what's going on...
Thanks for all the advice, hopefully I won't need to dig that deep in this case but good to know if I do.

Your time and trouble are much appreciated.

Cheer!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply