Affecting adjacent units, will this work?
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.
- Atreides
- Posts: 1075
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off
Affecting adjacent units, will this work?
Will this stop the planned moves of a unit and all units adjacent to the attacked unit? It sounds too easy...
Code: Select all
[event]
name=attack end
first_time_only=no
id=stop_train
[modify_unit]
[filter]
id=$second_unit.id
[filter_adjacent]
[/filter_adjacent]
[/filter]
goto_x=0
goto_y=0
[/modify_unit]
[/event]
Last edited by Pentarctagon on May 16th, 2021, 5:44 pm, edited 1 time in total.
Reason: [c] -> [code]
Reason: [c] -> [code]
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: Affecting adjacent units, will this work?
Not tested : I would replace the 0 by $x1 and $y1.
Maybe you need to do a store_unit and use stored_units[index].x and stored_units[index].y, instead.
Maybe you need to do a store_unit and use stored_units[index].x and stored_units[index].y, instead.
- Atreides
- Posts: 1075
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off
Re: Affecting adjacent units, will this work?
I know that the 0 works, that part has been tested. The part I am concerned with is the adjacent units. I suspect from reading that this will simply require there to be at least 1 adjacent unit for the attacked unit (only :( ) to be stopped.lhybrideur wrote: ↑May 17th, 2021, 3:45 pm Not tested : I would replace the 0 by $x1 and $y1.
Maybe you need to do a store_unit and use stored_units[index].x and stored_units[index].y, instead.
I can imagine trying something where the x,y of the attacked unit is stored in a variable and then all units that are within +/- 1 of those co-ordinates (or more as I might want to use a radius of 2 from the attacked unit) would be filtered for.
But I figured I'd ask first if filter_adjacent does work here.