Please help me with the filter.

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: 42
Joined: January 24th, 2023, 1:22 am

Please help me with the filter.

Post by BajMic »

Hello. I'm sorry for a rather trivial question, but testing it with my current setup is particularly troublesome.

I am trying to write an [if] trigger, which triggers when there are zero units in the designated area.

I tried with [have_location], however it does not work:

Code: Select all

							[have_location]
								x=13-14,14-15
								y=24,22
								radius=1
                                                                [and]
								        [filter]
									        side=1
								        [/filter]
                                                                [/and]
								count=0
							[/have_location]
How to write it correctly? Could [have_unit] work here?
User avatar
Straff
Posts: 83
Joined: September 27th, 2020, 2:53 pm

Re: Please help me with the filter.

Post by Straff »

I would use [have_unit] with a [filter_location] inside.
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Please help me with the filter.

Post by Ravana »

Looks like confusion can happen because of radius.

For testing setup I suggest viewtopic.php?t=56440
User avatar
beetlenaut
Developer
Posts: 2813
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Please help me with the filter.

Post by beetlenaut »

The "count" above means the number of locations that must match this location filter, which is not what you want. I'm doubtful that "count=0" is even allowed. Instead, put the keys inside a [not] tag to reverse the filter.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Please help me with the filter.

Post by Ravana »

Count=0 should work still, but [not][have_unit] would reflect your intentions better.
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Please help me with the filter.

Post by Celtic_Minstrel »

BajMic wrote: June 2nd, 2023, 9:54 pm I am trying to write an [if] trigger, which triggers when there are zero units in the designated area.
The filter you wrote triggers only when there is a unit of side 1 in the designated area. The count=0 does nothing, as it only has meaning in [filter_adjacent] or [filter_adjacent_location].

I think changing the [and] to [not] and deleting side=1 should work, but I'm not quite sure how if that combines correctly with the radius.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply