[scroll_to_unit] seeing side filter
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.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
[scroll_to_unit] seeing side filter
Hi
I have [scroll_to_unit], for unit vith invisible ability and I want to highlight it's action (coded teleport) but only for sides, who actually do see the unit.
How to do so?
There's [filter_side] but I can't find a way to filter for sides, which do see my unit.
Docs:
https://wiki.wesnoth.org/InterfaceActio ... to_unit.5D
https://wiki.wesnoth.org/StandardUnitFilter
Thanks
I have [scroll_to_unit], for unit vith invisible ability and I want to highlight it's action (coded teleport) but only for sides, who actually do see the unit.
How to do so?
There's [filter_side] but I can't find a way to filter for sides, which do see my unit.
Docs:
https://wiki.wesnoth.org/InterfaceActio ... to_unit.5D
https://wiki.wesnoth.org/StandardUnitFilter
Thanks
Re: [scroll_to_unit] seeing side filter
For unsynced code its bettter to use Lua. That runs on each client independently.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Oh, didn't knew that.
I do run it in Lua actually.
But I still don't know how to filter the sides for which to scroll the screen for.
Re: [scroll_to_unit] seeing side filter
You know which side is_local, and then you can check if that side can see unit.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Yrah... but how?
There's no [filter_vision] in side filter.
Re: [scroll_to_unit] seeing side filter
You filter side by is_local.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Yes and how to filter, whether my is_local side actually sees the unit?
- lhybrideur
- Posts: 454
- Joined: July 9th, 2019, 1:46 pm
Re: [scroll_to_unit] seeing side filter
Maybe [have_unit][filter_vision]
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Sadly, it states in wiki that [have_unit] automatically excludes all non side's units.
Re: [scroll_to_unit] seeing side filter
It doesnt.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Correction: [have_unit] isn't valid side filter, side filter features only [has_unit] which...
[has_unit]:
StandardUnitFilter: filter matches only if side controls a unit matched by it
Re: [scroll_to_unit] seeing side filter
You filter side by side number.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Ok, and how to find out which sides see the unit then???
Re: [scroll_to_unit] seeing side filter
With wml.tag.filter_vision{side=i}
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Ok, but used where, I kinda don't get first step, the obvious thing?