Help with sighted events
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.
Help with sighted events
I really dislike the syntax of sighted events. However, they are very useful for plot purposes, so I'm going to keep trying this.
Lets say I have a side A, and then two more sides, B and C. (There are also sides D, E and F in the scenario, but let's not worry about them). I want an event that triggers whenever a sighted event occurs between 1), A and B, 2), B and A, 3), A and C, and 4), C and A. Is there a simple way to do this? I was thinking of using the [or] tag, but apparently that only works for [if] statements, not event filters...
Also, sighted events don't seem to trigger when one side can see the hexes on a castle, but not the keep, and then the other sides recruits a unit onto the castle hex. However, this makes it so the sighted criteria (have never seen each other before that scenario) is invalidated, so no later sighteds work. Is there any way to fix this?
Lets say I have a side A, and then two more sides, B and C. (There are also sides D, E and F in the scenario, but let's not worry about them). I want an event that triggers whenever a sighted event occurs between 1), A and B, 2), B and A, 3), A and C, and 4), C and A. Is there a simple way to do this? I was thinking of using the [or] tag, but apparently that only works for [if] statements, not event filters...
Also, sighted events don't seem to trigger when one side can see the hexes on a castle, but not the keep, and then the other sides recruits a unit onto the castle hex. However, this makes it so the sighted criteria (have never seen each other before that scenario) is invalidated, so no later sighteds work. Is there any way to fix this?
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
That would most definitely not work. It would make it trigger twice, once when you see them and once when they see you.
I'm pretty sure that I've considered all of the obvious solutions, so don't post something until you're sure it works, and it isn't just a guess.
Right now, I actually don't care if it's elegant or not, just find something that works. Then I'll elegant-ize it myself.
I'm pretty sure that I've considered all of the obvious solutions, so don't post something until you're sure it works, and it isn't just a guess.
Right now, I actually don't care if it's elegant or not, just find something that works. Then I'll elegant-ize it myself.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
I'm actually not sitting in front of Wesnoth right now, so I can't test this, sorry, just throwing stuff outturin wrote:That would most definitely not work. It would make it trigger twice, once when you see them and once when they see you.
I'm pretty sure that I've considered all of the obvious solutions, so don't post something until you're sure it works, and it isn't just a guess.
Right now, I actually don't care if it's elegant or not, just find something that works. Then I'll elegant-ize it myself.
Oh, OK, so you need to set a variable.
[event]
name=start
[set_variable]
name=donesighted
value=0
[/set_variable]
[/event]
(I never remember [if] syntax right, so you may need to fine-tune this )
#define DO_SIGHTED_EVENT A B
[event]
name=sighted
[if]
[variable]
name=donesighted
not_equals=1
[/variable]
[then]
...
side=A
...
side=B
...
[set_variable]
name=donesighted
value=1
[/set_variable]
...
[/then]
[/if]
[/event]
#enddef
EDIT: Missed the #enddef
Well, it's ugly, but it willl work...
Any other ideas?
Any other ideas?
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
Re: Help with sighted events
In some cases you can use [not] to do this. Using DeMorgan's law, a or b <=> not(not a and not b). I have an example of this documented in the wiki for SUFs.turin wrote: I was thinking of using the [or] tag, but apparently that only works for [if] statements, not event filters...
See http://www.wesnoth.org/wiki/FilterWML#Filtering_Units
Here is the set-up I need:
How would I set that up using [not]s?
Code: Select all
[or]
[filter]
side=1
[/filter]
[filter_second]
side=3,4
[/filter_second]
[/or]
[or]
[filter]
side=3,4
[/filter]
[filter_second]
side=1
[/filter_second]
[/or]
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
I don't think it will work in your case because the standard unit filter and second unit filters are separate and to use the [not] idea you need to be able to not a combination of both.
If I am wrong and you can use a second unit filter inside a standard unit filter than there would be a way to do it.
If I am wrong and you can use a second unit filter inside a standard unit filter than there would be a way to do it.
OK, I'm not sure why, but this code does not work.
Suggestions?
Suggestions?
Code: Select all
[event]
name=sighted
[filter_second]
side=1
[/filter_second]
[filter]
side=3,4
[/filter]
[if]
[variable]
name=sightedyet
equals=1
[/variable]
[then]
[/then]
[else]
{BLAH}
[set_variable]
name=sightedyet
value=1
[/set_variable]
[/else]
[/if]
[/event]
[event]
name=sighted
[filter_second]
side=3,4
[/filter_second]
[filter]
side=1
[/filter]
[if]
[variable]
name=sightedyet
equals=1
[/variable]
[/or]
[then]
[/then]
[else]
{BLAH}
[set_variable]
name=sightedyet
value=1
[/set_variable]
[/else]
[/if]
[/event]
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
Well, I've decided that having it trigger when 3,4 see 1 is not really necessary... however, this code still doesnt' work.
(overlayturn was set to 0 earlier in the scenario).
Code: Select all
#seeing the trapped orcs
[event]
name=sighted
[filter_second]
side=3
[/filter_second]
[filter]
side=1
[/filter]
[if]
[variable]
name=overlayturn
equals=0
[/variable]
[then]
{STUFF}
[/then]
[/if]
[/event]
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
Well, I've simplified it a bit. I'm pretty sure that's not the problem... all I need now is for this event to actually trigger once you see a unitn from sides 3 or 4:
It doesn't. And when you take out the [filter_second], it triggers immediately upon starting the scenario, even before the start event.[/code]
Code: Select all
[event]
name=sighted
[filter_second]
side=3,4
[/filter_second]
[filter]
side=1
[/filter]
{DEBUG_MSG blah}
[/event]
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
bruno wrote:Maybe it is triggering on units spotting themselves or other units on the same side. I would expect that to happen very early on.turin wrote: It doesn't. And when you take out the [filter_second], it triggers immediately upon starting the scenario, even before the start event.
That would be odd. But, you're probably right
Well, any suggestions on how to fix it? I'm stuck.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
I think I (kind of) figured it out. Sighted events with [filter] side=1 [/filter] never work. At least, I can't get them to. Can anyone else?
With most sighted events this can be bypassed, but not really with the one I have here, so I'd like to get htis fixed... if no one can show me how to do it, I'll submit a bug report...
With most sighted events this can be bypassed, but not really with the one I have here, so I'd like to get htis fixed... if no one can show me how to do it, I'll submit a bug report...
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm