Options
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.
Options
Hello,
I'm currently trying to make an event where when a particular unit reaches a location, the player is prompted with the ability to change the type the unit is. However, it isn't working; I was using a mainline campaign as a reference, specifically HttT's Bay of Pearls, but I don't know what I'm doing wrong. I looked here https://wiki.wesnoth.org/OptionWML , but I'm not sure if this is applicable.
Here's what I got going for me:
Thanks!
I'm currently trying to make an event where when a particular unit reaches a location, the player is prompted with the ability to change the type the unit is. However, it isn't working; I was using a mainline campaign as a reference, specifically HttT's Bay of Pearls, but I don't know what I'm doing wrong. I looked here https://wiki.wesnoth.org/OptionWML , but I'm not sure if this is applicable.
Here's what I got going for me:
Code: Select all
[event]
name=moveto
[filter]
id=Squid
[filter_location]
[filter]
id=Smith
[/filter]
radius=1
[/filter_location]
[/filter]
[message]
speaker=Squid
message= _ "Er.. I was told to come to you for some weapons?"
[/message]
[message]
speaker=Smith
message= _ "Aye, youngen. We got some armor designed for ye folk outtdere. Ancient. Can get ya some o' dat. Longbow and sword."
[/message]
[option]
label= _ "Yeah, I've always wanted to be an archer!"
[command]
[modify_unit]
id=Squid
type=Longbowman
[/modify_unit]
[message]
speaker=Squid
message= _ "Cool!"
[/message]
[/command]
[/option]
[option]
label= _ "No, I think I prefer my current fighting style."
[command]
[message]
speaker=Smith
message= _ "Suit yerself."
[/message]
[/command]
[/option]
[/event]
Re: Options
You linked to [options] that goes under [campaign], [era], [multiplayer] or [modification] tag. Not [event].
You want [option] instead https://wiki.wesnoth.org/InterfaceActio ... message.5D.
You want [option] instead https://wiki.wesnoth.org/InterfaceActio ... message.5D.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Options
Read "Notes about Radius Usage" in the Standard Location Filter. I think you are having the problem they talk about there: Your [filter] tag seems to check to make sure that the id of the moving unit is Squid, then it checks to make sure that the id of the unit on the moving unit's location is Smith. If that hex exists (which of course it can't) it finds all hexes one hex away from it. Actually though, it sounds like you could use [filter_adjacent], which is easier anyway.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Options
I'm not 100% sure, but try to change this into:tribes55 wrote: ↑July 16th, 2018, 4:25 amCode: Select all
[filter] id=Squid [filter_location] [filter] id=Smith [/filter] radius=1 [/filter_location] [/filter]
Code: Select all
[filter]
id=Squid
[filter_location]
[and]
[filter]
id=Smith
[/filter]
[/and]
radius=1
[/filter_location]
[/filter]
I think your real problem is that you have:
[event]
name=moveto
but you don't have
first_time_only=no
So your event will never work.. It filters the first moveto accurance, and then it doesnt do anythign anymore.
Re: Options
I have found the solution to my problem; [Option] is a subtag of the [message] tag and I was not using it appropriately.
Regarding first_time_only=yes, I'm glad you pointed that out! I don't want this event firing multiple times, either. That'd be strange.
Also, I will read about the radius thing, but it does seem to be working accordingly. I have had a tough time understanding some errors with filters, so I think it's about time I sit down and give it a read.
Here are the corrections I have made.
Thanks to all who helped.
Regarding first_time_only=yes, I'm glad you pointed that out! I don't want this event firing multiple times, either. That'd be strange.
Also, I will read about the radius thing, but it does seem to be working accordingly. I have had a tough time understanding some errors with filters, so I think it's about time I sit down and give it a read.
Here are the corrections I have made.
Code: Select all
event]
name=moveto
[filter]
id=Squid
[filter_location]
[filter]
id=Smith
[/filter]
radius=1
[/filter_location]
[/filter]
[message]
speaker=Squid
message= _ "Er.. I was told to come to you for some weapons?"
[/message]
[message]
speaker=Smith
message= _ "Aye, youngen. We got some armor designed for ye folk outtdere. Ancient. Can get ya some o' dat. Longbow and sword."
[option]
label= _ "Yeah, I've always wanted to be an archer!"
[command]
[modify_unit]
[filter]
id=Squid
[/filter]
type=Longbowman
[modifications]
{TRAIT_DEXTROUS}
{TRAIT_QUICK}
[/modify_unit]
[message]
speaker=Squid
message= _ "Cool!"
[/message]
[/command]
[/option]
[option]
label= _ "No, I think I prefer my current fighting style."
[command]
[message]
speaker=Smith
message= _ "Suit yerself."
[/message]
[/command]
[/option]
[/message]
[/event]
Re: Options
Ah actually you are right probably.. you need it at
yes
state.. For some reason I thought it would fire for any moveto.. but it will only fire when filter catched it.. I'm quite sure in this case you have eveything right, default is "yes" so you don't need to write first_time_only=yes
, its already assumed.. but I guess having it there doesnt hurt I misunderstood your initial question completely.. didn't read it through I thought u having problems that nothing was working at all, but now I realized it was only [option] wasnt going inside [message] tags sorry for all confusion answers glad you helped your self :DDDDDDD