How to do event that spawns units and then units speak?

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
alluton
Posts: 420
Joined: June 26th, 2010, 6:49 pm
Location: Finland

How to do event that spawns units and then units speak?

Post by alluton »

okey so lets say two peasant spawn to the game and then they say something and then my leader answers to them.

So how to do it?

ps. i tried to copy somekind of thing from under burning sun but cannot make it work:(
"This game cured me of my real life addiction."
-Flameslash
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: How to do event that spawns units and then units speak?

Post by Dixie »

Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
alluton
Posts: 420
Joined: June 26th, 2010, 6:49 pm
Location: Finland

Re: How to do event that spawns units and then units speak?

Post by alluton »

[event]
name=turn 4
[fire_event]
name=Peasants
[/fire_event]
[/event]

[event]
name=Peasants
type=Peasant
side=1
x,y=1,1
experience=15
[/event]

what goes wrong whit this one?
"This game cured me of my real life addiction."
-Flameslash
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: How to do event that spawns units and then units speak?

Post by Ken_Oh »

Most of those tags in the second event don't go inside of [event]. You want [unit], which is in the first link Dixie gave.
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: How to do event that spawns units and then units speak?

Post by Dixie »

Yeah, basically you use an event to create the units (which are defined into an [unit] tag), and then, in the same event, you can make them speak with Interface Actions. You can make them move about and stuff too if you look at Direct Actions WML in the wiki.

And by the way, you probably don't need that fire event stuff. Just put everything into your "name=turn 4" event.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: How to do event that spawns units and then units speak?

Post by monochromatic »

Code: Select all

[event]
    name=turn 4
    {NAMED_GENERIC_UNIT 1 (Peasant) 1 1 (Peasants) ( _ "Peasants")}
    [message]
        speaker=Peasants
        message= _ "The macro above explained: NAMED_GENERIC_UNIT side (type) x y (id) ( _ 'name')"
    [/message]
[/event]
Another way :P
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: How to do event that spawns units and then units speak?

Post by Dixie »

elvish_sovereign wrote:

Code: Select all

[event]
    name=turn 4
    {NAMED_GENERIC_UNIT 1 (Peasant) 1 1 (Peasants) ( _ "Peasants")}
    [message]
        speaker=Peasants
        message= _ "The macro above explained: NAMED_GENERIC_UNIT side (type) x y (id) ( _ 'name')"
    [/message]
[/event]
Another way :P
Well, of course there's that macro, but I think it's more profitable for him to do it the longer way, so he learns WML a bit. It's always helpful to know what is thw whole spectrum of your options, not just the simplified macros ;)
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
alluton
Posts: 420
Joined: June 26th, 2010, 6:49 pm
Location: Finland

Re: How to do event that spawns units and then units speak?

Post by alluton »

Well thank you you both. Hopefully soveireign macro does it:D
ps. thnx for trying to teach me dixie:D

actually unit spawsn right but i dont see it says any message
"This game cured me of my real life addiction."
-Flameslash
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: How to do event that spawns units and then units speak?

Post by Dixie »

Done the interface action right? Read it carefully, it's pretty straightforward and understandable.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Post Reply