wesnoth.get_units with radius
Moderator: Forum Moderators
wesnoth.get_units with radius
Hi,
Sorry for the newbie lua question.
I'd like to use wesnoth.get_units to get an array of a units for in an area with a given radius around a tile. Something like:
But of course radius is not in SUF, it needs to go within a [filter_location] inside the SUF. What would be the syntax to achieve this? Unfortunately I've been unable to figure it out.
Thanks!
Sorry for the newbie lua question.
I'd like to use wesnoth.get_units to get an array of a units for in an area with a given radius around a tile. Something like:
Code: Select all
local inrange = wesnoth.get_units{x=27, y=10, radius=10}
Thanks!
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: wesnoth.get_units with radius
WML tag
[a]
b=c
[/a]
is written in Lua as {"a", {b="c"}}.
[a]
b=c
[/a]
is written in Lua as {"a", {b="c"}}.
Re: wesnoth.get_units with radius
Got it, thank you!
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
- Celtic_Minstrel
- Developer
- Posts: 2290
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: wesnoth.get_units with radius
No no no no no…
Ravana is technically correct, but I don't recommend doing what he said. It's confusing.
Instead, write it like this:
It expands to the exact same thing but is easier to understand what on earth it's doing.
So, to take your example:
It's also common to shorten
Ravana is technically correct, but I don't recommend doing what he said. It's confusing.
Instead, write it like this:
Code: Select all
wml.tag.a{b = "c"}
So, to take your example:
Code: Select all
local inrange = wesnoth.get_units{x=27, y=10, wml.tag.filter_location{radius=10}}
wml.tag
to just T
by defining a local variable.