A lone unit.
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.
A lone unit.
Hi, I need to double check something with you. I am just writing a Lurker Micro AI that takes around 70 lines and my brain starts tripping.
If I want to say "only approach this unit if it is alone, i.e., has no buddies in the radius of 5", would that be correct? Or would it catch the approached (lone) unit in question?
If I want to say "only approach this unit if it is alone, i.e., has no buddies in the radius of 5", would that be correct? Or would it catch the approached (lone) unit in question?
Code: Select all
[filter_location]
x=30
y=26
[filter_adjacent_location]
adjacent=s
[filter]
side=1
[filter_location]
[not]
[filter]
side=1
[/filter]
radius=5
[/not]
[/filter_location]
[/filter]
[/filter_adjacent_location]
[/filter_location]
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: A lone unit.
My brain is jello atm, and I hate nested filters, but a couple thoughts:
1) adjacent=s looks odd. You really only want to look at one hex?
2) You might want to look at [have_unit] which has a 'count' if you want to make sure that exactly one unit from side 1 is <somewhere>
1) adjacent=s looks odd. You really only want to look at one hex?
2) You might want to look at [have_unit] which has a 'count' if you want to make sure that exactly one unit from side 1 is <somewhere>
Speak softly, and carry Doombringer.
Re: A lone unit.
Thanks.
1) The "s" direction is dictated by the shape of the map. There is a unit zoc-blocking a 3-hex wide entrance (according to a set of rules), but there is a nook on the southern side. The unit is supposed to engage only if there are no other enemy units to bypass it nearby.
2) Yes. If easier solution fails, I will just make two separate micro_ai's dependent on the conditional tags.
1) The "s" direction is dictated by the shape of the map. There is a unit zoc-blocking a 3-hex wide entrance (according to a set of rules), but there is a nook on the southern side. The unit is supposed to engage only if there are no other enemy units to bypass it nearby.
2) Yes. If easier solution fails, I will just make two separate micro_ai's dependent on the conditional tags.
- Celtic_Minstrel
- Developer
- Posts: 2371
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: A lone unit.
Code: Select all
[filter_location]
x=30
y=26
[filter_adjacent_location]
adjacent=s
Code: Select all
[filter_location]
x=30
y=27
Code: Select all
[filter]
side=1
[filter_location]
[not]
[filter]
side=1
[/filter]
radius=5
[/not]
[/filter_location]
[/filter]
and
at the same level as the filter.