[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.
Re: [scroll_to_unit] seeing side filter
For each side that is local, check if it can see unit. Then decide if you want all or any local side see unit.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
But, to the very question of this post... How do I do that?
Re: [scroll_to_unit] seeing side filter
Too unspecific.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
How fo check for whether side can see unit?
Re: [scroll_to_unit] seeing side filter
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
Could you tell me the whole condition that returns true only if side 1 sees my unit?
I can't drop out filter_vision out of nowhere, the standalone tag makes no sence.
Where should it be used? (Presumably in unit filter, but where tge hell to use the whole filter? And what the hell has to be in unit filter, that returns unit)
Re: [scroll_to_unit] seeing side filter
If unit filter returns 1 unit, then side can see the unit. If unit filter returns 0 units, then side cant see the unit.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Ok, dumb me (this really makes sense to do with the local side )...
Is it absolutelly bug free and does it not bring any syncing issues/ problems with replay?
Re: [scroll_to_unit] seeing side filter
If you do anything that needs sync it obviously breaks.
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
Still, this is f*cking complicated, why does [filter_side] has to have that stupid [has_unit] tag which does nothing new, only restricts existing tag???
Aaand I can't find a way to do this simply... how should I do it? (First iterate through sides and then iterate through units, time is even worse as when I would just iterate all sides for one unit (which would also achieve more work))
Aaand I can't find a way to do this simply... how should I do it? (First iterate through sides and then iterate through units, time is even worse as when I would just iterate all sides for one unit (which would also achieve more work))
- ZombieKnight
- Posts: 371
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: [scroll_to_unit] seeing side filter
How the hell is that supposed to shrink the f*cking side list?
Code: Select all
$ wesnoth.sides.find({is_local=true})
{side: <1 Bandits>,side: <2 Humans>,side: <3 Wenrys>,side: <4 Dwarves>,side: <5 Dwarves>,side: <6 Dwarves>,side: <7 Nagas>,side: <8 Wild>,side: <9 Wild>,side: <10 Wild>}
Re: [scroll_to_unit] seeing side filter
It is not part of SSF. is_local is only provided in side proxy.
wesnoth.require("functional").map(wesnoth.sides.find{}, function (s) return s.is_local end)
wesnoth.require("functional").map(wesnoth.sides.find{}, function (s) return s.is_local end)