Argh! My code doesnt 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.
Argh! My code doesnt work!
Hi folks, Im having a bit of trouble with my WML, my code is;
I'm trying to make it so that when Flag dies he says "Dirty human..."
followed by the successful unit who killed him saying "Just die..."
At the moment only Flag's text comes up
Not sure what Im doing wrong, any help appreciated!
Rob
Code: Select all
[event]
name=die
[filter]
description=Flin the Hasty
[/filter]
[message]
description=unit
message= _ "Dirty Human! My master will turn you into wolf feed!"
[/message]
[message]
speaker=second_unit
message= _ "Just die you filthy goblin scum."
[/message]
[set_variable]
name=kill_flin
value=1
[/set_variable]
[/event]
followed by the successful unit who killed him saying "Just die..."
At the moment only Flag's text comes up
Not sure what Im doing wrong, any help appreciated!
Rob
try
istead of
Code: Select all
[message]
speaker=unit
message= _ "Dirty Human! My master will turn you into wolf feed!"
[/message]
Code: Select all
[message]
description=unit
message= _ "Dirty Human! My master will turn you into wolf feed!"
[/message]
hmm... no, still having trouble, i'v tried recoding it in different ways but all with the same result, at the moment my coding is;
General Manfell does exist and other messages from him work fine
I'm having another problem with messages in the next scenario, my code is
When playing, this event occurs with the first message "Graaa..." being spoken by a random horseman in my army-seemingly completely unrelated to the die event. Another blank message dialogue then appears from this unit and the event ends.
Im completely at a loss, anyone with any suggestions please help!
Rob
Code: Select all
[event]
name=die
[filter]
description=Flin the Hasty
[/filter]
[message]
description=Flin the Hasty
message= _ "Dirty Human! My master will turn you into wolf feed!"
[/message]
[message]
description=General Manfell
message= _ "Just die you filthy goblin scum"
[/message]
[set_variable]
name=kill_flin
value=1
[/set_variable]
[/event]
I'm having another problem with messages in the next scenario, my code is
Code: Select all
[event]
name=die
[filter]
description=Flag the Butcher
[/filter]
[message]
decription=Flag the Butcher
message= _ "Grrraa! I'll have you killed..I'll... I'll..."
[/message]
[filter_second]
[message]
message= _ "Sure you will."
[/message]
[/filter_second]
[set_variable]
name=kill_flag
value=1
[/set_variable]
[if]
[variable]
name=kill_grog
numerical_equals=1
[/variable]
[then]
[message]
description=Lieutenant White
message= _ "Excellent, the orcish vanguard has been destroyed."
[/message]
[message]
description=Prince Harold
message= _ "The fort has been evacuated, our people are safe! Lets get out of here!!"
[/message]
[endlevel]
result=victory
bonus=yes
[/endlevel]
[/then]
[else]
[/else]
[/if]
[/event]
Im completely at a loss, anyone with any suggestions please help!
Rob
You need ids for the messages....robeth wrote:hmm... no, still having trouble, i'v tried recoding it in different ways but all with the same result, at the moment my coding is;
General Manfell does exist and other messages from him work fineCode: Select all
[event] name=die [filter] description=Flin the Hasty [/filter] [message] description=Flin the Hasty message= _ "Dirty Human! My master will turn you into wolf feed!" [/message] [message] description=General Manfell message= _ "Just die you filthy goblin scum" [/message] [set_variable] name=kill_flin value=1 [/set_variable] [/event]
I'm having another problem with messages in the next scenario, my code is
When playing, this event occurs with the first message "Graaa..." being spoken by a random horseman in my army-seemingly completely unrelated to the die event. Another blank message dialogue then appears from this unit and the event ends.Code: Select all
[event] name=die [filter] description=Flag the Butcher [/filter] [message] decription=Flag the Butcher message= _ "Grrraa! I'll have you killed..I'll... I'll..." [/message] [filter_second] [message] message= _ "Sure you will." [/message] [/filter_second] [set_variable] name=kill_flag value=1 [/set_variable] [if] [variable] name=kill_grog numerical_equals=1 [/variable] [then] [message] description=Lieutenant White message= _ "Excellent, the orcish vanguard has been destroyed." [/message] [message] description=Prince Harold message= _ "The fort has been evacuated, our people are safe! Lets get out of here!!" [/message] [endlevel] result=victory bonus=yes [/endlevel] [/then] [else] [/else] [/if] [/event]
Im completely at a loss, anyone with any suggestions please help!
Rob
tomsik's suggestion worked fine for me:
So just use speaker instead of description in messages.
And then to the next one:
Replace description with speaker here as well.
If the [filter_second] here means that you want the unit killing Flag to say "Sure you will.", you just need to write:
So remove [filter_second] there. You can always use "speaker=unit" and "speaker=second_unit" in event messages, no need to try and filter the messages. The [filter] and [filter_second] only determine if the event is triggered in the first place. So if you want the event to trigger when Konrad kills Flag, just put "[filter] description=Konrad[/filter]" and "[filter_second] description=Flag[/filter_second]" inside the event. Then, in messages you can refer to the units that passed the filters' criteria by using "speaker=unit" and "speaker=second_unit".
I didn't test this latter one myself, but I think it should work. Anyway, I hope this helps.
Code: Select all
[event]
name=die
[filter]
description=Flin the Hasty
[/filter]
[message]
speaker=unit
message= _ "Dirty Human! My master will turn you into wolf feed!"
[/message]
[message]
speaker=second_unit
message= _ "Just die you filthy goblin scum."
[/message]
[set_variable]
name=kill_flin
value=1
[/set_variable]
[/event]
And then to the next one:
Code: Select all
[event]
name=die
[filter]
description=Flag the Butcher
[/filter]
[message]
decription=Flag the Butcher
message= _ "Grrraa! I'll have you killed..I'll... I'll..."
[/message]
[filter_second]
[message]
message= _ "Sure you will."
[/message]
[/filter_second]
If the [filter_second] here means that you want the unit killing Flag to say "Sure you will.", you just need to write:
Code: Select all
[message]
speaker=second_unit
message= _ "Sure you will."
[/message]
I didn't test this latter one myself, but I think it should work. Anyway, I hope this helps.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact: