How to "Blacklist" a unit from being the speaker in the message tag ?

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
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

How to "Blacklist" a unit from being the speaker in the message tag ?

Post by nexusrebirth »

Hello everyone, i'm trying to write dialogue and i want any unit from the given side to speak EXCEPT for the leaders.
The scenario has 2 player controlled sides so i want units from both side 1 and side 2 to be able to trigger the dialogue. However i don't want the leaders to speak, for exemple :

Code: Select all

[message]
			side=1
			message=_ "Masters, i sense the presence of dwarves. We are not strong enough to take their forteress yet, we should try to sneak past them to find another exit"
		[/message]
		[message]
			side=2
			message=_ "Yes, dwarves were always a problem even for the previous master..."
		[/message]
		[message]
			speaker=Vlad_Overlord
			message=_ "Allright, let's head for that tunnel over there !"
		[/message]
		[scroll_to]
			x,y=21,3
		[/scroll_to]
		[message]
			speaker=narrator
			message=_ ""
		[/message]
		[message]
			speaker=Talzin_Overlord
			message=_ "Yes! I wonder if these old stories about abandonned mining tunnel were true... I heard a lot were sealed poorly, maybe there's something to be done with them..."
		[/message]
I know this code doesn't xork as the leaders pass the side standard unit filter so i tried a bunch of stuff (use of the [not] tag, flagging the leaders with [filter_second] and putting speaker=unit so that the "primary" unit would speak i combined a bunch of things and can only have 2 results :
-the message doesn't show up
-the leaders speak

Same thing wiith a sighted event where the sighted ennemy is the one speaking :|
So my question is, how do i "blacklist" a specific unit id, side, unit type and others from speaking ?
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2361
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: How to "Blacklist" a unit from being the speaker in the message tag ?

Post by Lord-Knightmare »

any unit from the given side to speak EXCEPT for the leaders.

Code: Select all

                [message]
			side=2
                         #do not allow leaders to speak this message
                        canrecruit=no 
			message=_ "Yes, dwarves were always a problem even for the previous master..."
		[/message]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

Re: How to "Blacklist" a unit from being the speaker in the message tag ?

Post by nexusrebirth »

Lord-Knightmare wrote: June 6th, 2022, 3:05 pm

Code: Select all

                [message]
			side=2
                         #do not allow leaders to speak this message
                        canrecruit=no 
			message=_ "Yes, dwarves were always a problem even for the previous master..."
		[/message]
Worked like a charm, thank you !
Post Reply