Events : unit at the right place, the right moment

The place to post your WML questions and answers.

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.
Post Reply
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Events : unit at the right place, the right moment

Post by Cluric »

EDIT : PROBLEM SOLVE.

Hi !

First excuse me for the mistakes, but im french and I dont speak english very well.

I really appreciate this game, that's while im working on my own campaign, but i have encounter a problem.

The side 1 have one unit, for example at x=1 y=1, and I want that when these unit go to an aera, it activate an event BUT only after the turn 5. This area could be for example the "square" define by the four point : (5,5), (5, 10), (10, 10) and (10, 5).

I try something like that (and variant of course !)

Code: Select all

	
[event]
	name=moveto
   [filter]
		side=1
		turn > 5   #here ">" is not an acceptable operator, but I cant imagine use something like "turn = 6 or turn = 7... turn = last turn"
			x=5, 6, 7, 8, 9, 10
			y=5, 6, 7, 8, 9, 10
	[/filter]	
	[message]
		id=person
		message= _ "Hello, world !"
	[/message]
[/event]
However i try to made it, but without succes. How can I do it ?

If you have any idea, please tell my : I would appreciate all explanation :)
Last edited by Cluric on October 6th, 2012, 9:19 pm, edited 1 time in total.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Events : unit at the right place, the right moment

Post by Crendgrim »

You can do that by creating nested events:

Code: Select all

[event]
  name=turn 5

  [event]
    name=moveto
    [filter]
      side=1
    [/filter]
    [message]
      id=person
      message= _ "Hello, world !"
    [/message]
  [/event]

[/event]
So, in turn 5 the moveto event will be registered.
UMC Story Images — Story images for your campaign!
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Events : unit at the right place, the right moment

Post by Sapient »

You want to use this:
x=5-10
y=5-10

Not this:
x=5,6,7,8,9,10
y=5,6,7,8,9,10

The first one is a square, the second one is a diagonal line from 5,5 to 10,10.

http://wiki.wesnoth.org/StandardLocatio ... nate_Usage
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Re: Events : unit at the right place, the right moment

Post by Cluric »

Thanks for the quik answer, but it's not exactly what I wanted (sorry, I probably wasn't clear)

Your code only works at the turn 5. But, I'll prefer an event in the 5th turn... and after. Must I made one imbricated event like

Code: Select all

[event]
  name=turn X
  [event]
       name=moveto
        .....
  [/event]
[/event]
[event]
       name= turn X+1
        etc...
[/event]
Well otherwise, have you some idea about a "square" zone ?


EDIT : Im just seeing your answer Sapient, thanks, it works and I'm glad because I dont read enouth WML specification ! The half of my problem is solve in 10 min only. I like this forum :)
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Events : unit at the right place, the right moment

Post by Crendgrim »

Cluric wrote:Your code only works at the turn 5.
No, the moveto event will be registered on the 5th turn; and from then on it will fire whenever the first unit from side 1 steps on it. If you want to have the event fire each time a unit steps on it, you need to put first_time_only=no in the inner event.
UMC Story Images — Story images for your campaign!
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Re: Events : unit at the right place, the right moment

Post by Cluric »

Excuse me you're right !
I was thinking I understand perfectly how the system of [event]works, but I wasn't the case. Now I understand better the things.
After testing, I confirm, It work.
Thanks, problem solve !
Post Reply