just need a little bit of help prevent an event from firing
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.
just need a little bit of help prevent an event from firing
can someone please modify my coding so that this moveto event doesn't fire unless the lich in my scenario has been defeated already. i checked the mainline campaigns and the wml reference page and didn't fully understand how to do it. the lich's name is "Mal Addraer" Thanks in advance
Code: Select all
[event]
name=moveto
[filter]
x=24
y=33
id=Horatio
[/filter]
[message]
speaker=Horatio
message= _ "We have defeated the lich and made it to the other side of the swamp.
Onwards to the Greywoods."
[/message]
[endlevel]
result=victory
bonus=no
{NEW_GOLD_CARRYOVER 60}
[/endlevel]
[/event]
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: just need a little bit of help prevent an event from firing
I believe that what you're looking for is a nested event that looks something like this:
The outer die event adds the inner moveto event to the scenario when it's triggered, so before the die event is triggered, the moveto event isn't part of the scenario, and thus can't be triggered early.
Code: Select all
[event]
name=die
[filter]
id=Mal Addraer
[/filter]
[event]
name=moveto
[filter]
id=Horatio
[and]
x,y=24,33
[/and]
[/filter]
[message]
<put your message here>
[/message]
[endlevel]
<put your victory stuff here>
[/endlevel]
[/event]
[/event]
Re: just need a little bit of help prevent an event from firing
thank you very much for your help and for explaining it.
- CountPenguin
- Posts: 132
- Joined: May 25th, 2007, 1:13 am
- Location: USA
Re: just need a little bit of help prevent an event from firing
I don't think that will work. If it does, great! If it doesn't, here's what I think you need to do: First set a variable (let's call it lich_dead). This goes somewhere in the scenario, just on its own (not inside an event or side tag):
{VARIABLE lich_dead no}
Then change it when Mal Addraer dies:
Then you can make your moveto event only end the scenario if the lich is dead (you need first_time_only=no because otherwise if you move there while the lich is still alive, you won't be able refire the event, meaning you can't win):
I hope that works, I'm just learning WML too.
{VARIABLE lich_dead no}
Then change it when Mal Addraer dies:
Code: Select all
[event]
name=die
[filter]
id=Mal Addraer
[/filter]
[set_variable]
name=lich_dead
value=yes
[/set_variable]
[/event]
Code: Select all
[event]
name=moveto
first_time_only=no
[filter]
x,y=24,33
id=Horatio
[/filter]
[if]
[variable]
name=lich_dead
boolean_equals=yes
[/variable]
[then]
##put your message
##then your endlevel
[/then]
[/if]
[/event]
Last edited by CountPenguin on May 2nd, 2009, 9:09 pm, edited 1 time in total.
CountPenguin
Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!
Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!
Re: just need a little bit of help prevent an event from firing
I find it simpler to add first_time_only=no and put the relevant actions inside an [if][then] conditional statement. You can use the [have_unit] condition rather than setting a flag...
Code: Select all
[event]
name=moveto
first_time_only=no
[filter]
x=24
y=33
id=Horatio
[/filter]
[if]
[not]
[have_unit]
type=Lich
[/have_unit]
[/not]
[/if]
[then]
[message]
speaker=Horatio
message= _ "We have defeated the lich and made it to the other side of the swamp.
Onwards to the Greywoods."
[/message]
[endlevel]
result=victory
bonus=no
{NEW_GOLD_CARRYOVER 60}
[/endlevel]
[/then]
[/event]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- CountPenguin
- Posts: 132
- Joined: May 25th, 2007, 1:13 am
- Location: USA
Re: just need a little bit of help prevent an event from firing
ya, that probably would be simpler
CountPenguin
Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!
Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!
Re: just need a little bit of help prevent an event from firing
Thanks everyone
coded Rebellion During the Dark Age
Currently working on:
Era of the Future
Currently working on:
Era of the Future