Event trigger: Why didn't work?
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.
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: Event trigger: Why didn't work?
You're misinterpreting what he's doing - he's making a copy of the unit that killed it, and putting that copy onto the hex that the dead unit had occupied. Of course, that unit is also already stored, but it's in second_unit, not unit.
-
- Posts: 39
- Joined: December 20th, 2007, 9:47 am
Re: Event trigger: Why didn't work?
Thank you all!
Another problem... Could you help me here?
Messages:
Full event:
Those messages simply don't appear. I already tried puting "speaker=(unit's id)", but didn't work.
Aaand:
When I use those messages wesnoth crashes like when we wrongly use a macro, simply crashes and closes.
Another problem... Could you help me here?
Messages:
Spoiler:
Spoiler:
Aaand:
Spoiler:
Re: Event trigger: Why didn't work?
the prestart event messages aren't working because when you use [message] with a filter, it checks to see if the unit exists. If the unit doesn't exist, Wesnoth assumes the unit is dead and doesn't display the message. It looks like when the code runs, side 1 doesn't have any units.
-
- Posts: 39
- Joined: December 20th, 2007, 9:47 am
Re: Event trigger: Why didn't work?
No, it's not it. I already tried with other events. Thanks anyway.melinath wrote:the prestart event messages aren't working because when you use [message] with a filter, it checks to see if the unit exists. If the unit doesn't exist, Wesnoth assumes the unit is dead and doesn't display the message. It looks like when the code runs, side 1 doesn't have any units.
Edited:
Let me try again.
Heh. Still doesn't work. I think it's something wrong with the filters.
How could I use a filter to these units:
Spoiler:
Re: Event trigger: Why didn't work?
Messages don't do anything in prestart events, because prestart events happen before anything is drawn on screen. Put everything you want to be visible to the player in a start event instead.
-
- Posts: 39
- Joined: December 20th, 2007, 9:47 am
Re: Event trigger: Why didn't work?
Here you are:
Still doesn't work. =D
Edited:
Sorry, I got an obscure error... Now it's fixed... You were right, after putting it on a start event, it worked.
Spoiler:
Edited:
Sorry, I got an obscure error... Now it's fixed... You were right, after putting it on a start event, it worked.
Re: Event trigger: Why didn't work?
The following code works inside a prestart event on my Wesnoth:zookeeper wrote:Messages don't do anything in prestart events, because prestart events happen before anything is drawn on screen. Put everything you want to be visible to the player in a start event instead.
Code: Select all
[message]
speaker=narrator
message=_"Whatever."
image=wesnoth-icon.png
[/message]
Re: Event trigger: Why didn't work?
Oh. Well, that's news to me. Maybe it was changed at some point.melinath wrote:The following code works inside a prestart event on my Wesnoth:zookeeper wrote:Messages don't do anything in prestart events, because prestart events happen before anything is drawn on screen. Put everything you want to be visible to the player in a start event instead.I find it very useful for things like emulating a storyboard. But maybe it only works with speaker=narrator.Code: Select all
[message] speaker=narrator message=_"Whatever." image=wesnoth-icon.png [/message]
-
- Posts: 39
- Joined: December 20th, 2007, 9:47 am
Re: Event trigger: Why didn't work?
Oh, and after fixing that bug, the message at prestart worked.
Everything was black, but the characters talked to each other.
Everything was black, but the characters talked to each other.
-
- Posts: 39
- Joined: December 20th, 2007, 9:47 am
Re: Event trigger: Why didn't work?
Hello!
I've got a crazy "bug", and I can't see where I went wrong...
Yes, I came here to ask for help:
First, the codes:
Event that triggers everything:
Variables:
morale(inside a prestart event):
mstatus(inside a "new turn, first_time_only=no" event):
Variable ops:
Inside a "new turn" event:
Inside die events:
Macro definition for {ACTION low}(works fine):
Macro definition for {ACTION zero}(works fine):
Translating codes:
At prestart, the morale is defined as -20(mstatus=zero).
At turn 1, before the guys do their turns and after the start events, mstatus is defined as "zero".
There are four ways to change the morale value:
A new turn(morale +1).
Killing an enemy not-zombie unit(morale +1).
Killing an enemy zombie unit(morale +0.1).
Losing an unit(morale -1).
The definitions for mstatus are:
morale<12.9, ->mstatus=high
12.9>morale<6 ->mstatus=normal
6.1>morale<0.1 ->mstatus=low
0>morale ->mstatus=zero
Like morale=-19(-20+1[new turn]), mstatus=zero
At every new turn, and after the mstatus be defined, the event that triggers everything I'm interested will be triggered, using a "macro variable", that, on this case, should be {ACTION zero}.
The problem is this one:
The macro used is {ACTION low}, instead of {ACTION zero}.
Without the first event that triggers everything, no action is triggered, with the first event, the macro used is {ACTION low}, I think the problem might be:
1: On the macros.
2: On the event.
I'm sure that the $mstatus is rightly defined.
I've got a crazy "bug", and I can't see where I went wrong...
Yes, I came here to ask for help:
First, the codes:
Event that triggers everything:
Spoiler:
morale(inside a prestart event):
Spoiler:
Spoiler:
Inside a "new turn" event:
Spoiler:
Spoiler:
Spoiler:
Spoiler:
At prestart, the morale is defined as -20(mstatus=zero).
At turn 1, before the guys do their turns and after the start events, mstatus is defined as "zero".
There are four ways to change the morale value:
A new turn(morale +1).
Killing an enemy not-zombie unit(morale +1).
Killing an enemy zombie unit(morale +0.1).
Losing an unit(morale -1).
The definitions for mstatus are:
morale<12.9, ->mstatus=high
12.9>morale<6 ->mstatus=normal
6.1>morale<0.1 ->mstatus=low
0>morale ->mstatus=zero
Like morale=-19(-20+1[new turn]), mstatus=zero
At every new turn, and after the mstatus be defined, the event that triggers everything I'm interested will be triggered, using a "macro variable", that, on this case, should be {ACTION zero}.
The problem is this one:
The macro used is {ACTION low}, instead of {ACTION zero}.
Without the first event that triggers everything, no action is triggered, with the first event, the macro used is {ACTION low}, I think the problem might be:
1: On the macros.
2: On the event.
I'm sure that the $mstatus is rightly defined.
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: Event trigger: Why didn't work?
When you define a macro, the parameters you pass are substituted into the macro wherever you put {<PARAMETER_NAME>}. Try something along these lines:
And then to use it, {MORALE_ACTION mstatus} (no $).
Code: Select all
#define MORALE_ACTION MORALE
[switch]
variable={MORALE}
[case]
value=high
...stuff to happen with high morale
[/case]
[case]
value=normal
...stuff to happen with normal morale
[/case]
[case]
value=low
...stuff to happen with low morale
[/case]
[else]
...stuff to happen with zero morale
[/else]
[/switch]
#enddef
-
- Posts: 39
- Joined: December 20th, 2007, 9:47 am
Re: Event trigger: Why didn't work?
@Exasperation:
Thank you very much! I never understood well how to use the Conditional Actions(save "if", and "then"), but now you explained everything.
Thank you very much! I never understood well how to use the Conditional Actions(save "if", and "then"), but now you explained everything.