[event] and [message]

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
absinthia
Posts: 10
Joined: June 3rd, 2021, 7:03 am

[event] and [message]

Post by absinthia »

got the unit spawning to my side, but was wondering how to make the enter hex filter better with radius. cause using all the coordinates around 9,29 where the pleasant spawns is tedious work.
second, whatever i read in the wiki, whatever i do, i cant make the pleasant give me a msg with Look at me and my pc just "listening"

Code: Select all

[event]
        name=enter_hex
            [filter]
                side=1
                x=8,9,10,10,9,8,
                y=28,28,28,29,30,29
            [/filter]
        {GENERIC_UNIT 1 "Pleasant" 9 29}
[message]
        [filter]
	type=Pleasant
	[/filter]
        message=_ "Look at me"
    [/message]
    [/event]
 
ps: is there any website/database where i can search for examples? the wiki is usefull, but its easier to understand when u see more samples
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [event] and [message]

Post by WhiteWolf »

You can use radius with [filter_location]:

Code: Select all

[filter]
    side = 1
    [filter_location]
        x,y=9,29
        radius=1
    [/filter_location]
[/filter]
[message] takes no explicit [filter] tag, you can put the filter keys directly into it instead:

Code: Select all

[message]
    type = Peasant
    message= _ "..."
[/message]
Keep in mind, that this code will make the first peasant the game finds speak, regardless of side or anything else. So it's not guaranteed to be the peasant you just spawned if there are others on the map. I recommend giving an id to the spawned peasant and then using that to filter on instead.


Best further examples to check out are the base game campaigns probably.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: [event] and [message]

Post by Elvish_Hunter »

absinthia wrote: June 7th, 2021, 3:09 am

Code: Select all

...
        {GENERIC_UNIT 1 "Pleasant" 9 29}
...
	type=Pleasant
...
Is that "Pleasant" some sort of custom unit? If you actually meant "Peasant", typos like this are enough to stop an event from working.
absinthia wrote: June 7th, 2021, 3:09 am ps: is there any website/database where i can search for examples? the wiki is usefull, but its easier to understand when u see more samples
As WhiteWolf said, we have all the mainline campaigns which can be used; if you played an add-on which does some interesting thing, you can check its code too.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Post Reply