[solved] Using [avoid]
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.
-
- Posts: 1226
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
[solved] Using [avoid]
In the final scenario of The Beautiful Child there are several rooms. The only way to move between rooms is using stairways which are implemented via [teleport]. You cannot use the stairs if some other unit is standing on the other end of the stairs. In the final room, in some circumstances I haven't nailed down, the enemy units will swarm the bottom of the room, covering the stairs and never moving off.
I thought I could fix this using avoid, something I've never looked at. Not happening. Units from side 2 are constantly blocking 45.13. Why?
Hmm, I just found this. If I had tripped this event, does that [ai] block REPLACE what was previously set in [scenario]?
I thought I could fix this using avoid, something I've never looked at. Not happening. Units from side 2 are constantly blocking 45.13. Why?
Code: Select all
[side]
no_leader=yes
side=2
team_name=twisted_good
user_team_name=_"Twisted Good"
village_gold=2
income=0
{GOLD 500 650 800}
recruit=Royal Guard,Halberdier,Iron Mauler,Master Bowman,Cavalier
[ai]
aggression=1
[avoid]
x=28,37,33,45
y=38,21,22,13
[/avoid]
[/ai]
[/side]
Hmm, I just found this. If I had tripped this event, does that [ai] block REPLACE what was previously set in [scenario]?
Code: Select all
[event]
name=moveto
first_time_only=no
[filter]
side=1
x,y={X1},{Y1}
[/filter]
[if]
[have_unit]
side=2,3
x,y={RANGE}
[/have_unit]
[then]
[message]
[ai]
aggression=1
[/ai]
speaker=Rimaru
message=_"We can't go further with enemies behind our back!"
[/message]
[/then]
Last edited by white_haired_uncle on July 30th, 2023, 4:21 am, edited 1 time in total.
Speak softly, and carry Doombringer.
- Celtic_Minstrel
- Developer
- Posts: 2241
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Using [avoid]
I'm not quite sure what your issue is, but something to check would be to use
:inspect
to see if the avoid is really applied. (You need to also enable debug mode with :debug
before using :inspect
.)Thatwhite_haired_uncle wrote: ↑July 29th, 2023, 9:35 pm Hmm, I just found this. If I had tripped this event, does that [ai] block REPLACE what was previously set in [scenario]?
[ai]
block does nothing at all, because it's placed inside [message]
, where the game doesn't know what to do with an [ai]
block so it just ignores it.-
- Posts: 1226
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: Using [avoid]
Thanks, the inspect idea was helpful.
The leaders are spawning new units using {GENERIC_UNIT}. It seems creating a unit via [unit] does not honor [avoid].
I suppose I'll have to create an event to have them move off the hex. If I do a [move_unit] to a location that's supposed to be avoided, I wonder if it will pick another location nearby, or if specifying x.y will override the avoid (or perhaps if the unit is already at x,y it'll just ignore the move).
The leaders are spawning new units using {GENERIC_UNIT}. It seems creating a unit via [unit] does not honor [avoid].
I suppose I'll have to create an event to have them move off the hex. If I do a [move_unit] to a location that's supposed to be avoided, I wonder if it will pick another location nearby, or if specifying x.y will override the avoid (or perhaps if the unit is already at x,y it'll just ignore the move).
Speak softly, and carry Doombringer.
- Celtic_Minstrel
- Developer
- Posts: 2241
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [solved] Using [avoid]
Ah yes, that would do it –
[avoid]
is only relevant to the AI, and [unit]
is decidedly not AI.