Trigger message on attack during certain range of turns

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
User avatar
MathBrush
Posts: 222
Joined: February 12th, 2018, 10:21 pm

Trigger message on attack during certain range of turns

Post by MathBrush »

I mentioned in another thread that I had a scenario where every time someone attacks the character they insult a campaign.

I've been trying to get it to work, but I'm having difficulty. I have a variety of insults, and want them to fire in different ranges of turns.

I have this code:

Code: Select all

   [event]
        name=attack
		[filter]
			side=2
		[/filter]
   [if]
      [variable]
         name=turn_number
         greater_than=3
      [/variable]
      [then]
  		[message]
			speaker=unit
			message = _ "I hated A Fiery Birth. Boring, so boring. Boring characters, boring battles, boring maps. Why did you even bother making this? I just wasted five hours of my life on it."
		[/message]
         
      [/then]
    [/if]
   [/event]
If I get rid of the condition on the turn number, it works just fine:

Code: Select all

   
   [event]
        name=attack
		[filter]
			side=2
		[/filter]

  		[message]
			speaker=unit
			message = _ "I hated A Fiery Birth. Boring, so boring. Boring characters, boring battles, boring maps. Why did you even bother making this? I just wasted five hours of my life on it."
		[/message]
  
   [/event]
Any suggestions on how to incorporate the turn condition?
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die | Loyalist Campaign: Wesnoth Creepypasta
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Trigger message on attack during certain range of turns

Post by white_haired_uncle »

Where's your first_time_only?
Speak softly, and carry Doombringer.
User avatar
MathBrush
Posts: 222
Joined: February 12th, 2018, 10:21 pm

Re: Trigger message on attack during certain range of turns

Post by MathBrush »

I was under the impression that 'first_time_only' was set to 'yes' by default, which is what I want here. My issue is that it's not firing at all.
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die | Loyalist Campaign: Wesnoth Creepypasta
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Trigger message on attack during certain range of turns

Post by white_haired_uncle »

MathBrush wrote: May 21st, 2024, 2:35 am I was under the impression that 'first_time_only' was set to 'yes' by default, which is what I want here. My issue is that it's not firing at all.
turn_number is not a filter, so it runs once on turn 1 and then never again.
Speak softly, and carry Doombringer.
User avatar
MathBrush
Posts: 222
Joined: February 12th, 2018, 10:21 pm

Re: Trigger message on attack during certain range of turns

Post by MathBrush »

Thank you, that explains everything. Thanks for your help! I may ask again if I can't figure out how to get it to only fire once later on.
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die | Loyalist Campaign: Wesnoth Creepypasta
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Trigger message on attack during certain range of turns

Post by white_haired_uncle »

You could
Spoiler:
Speak softly, and carry Doombringer.
User avatar
MathBrush
Posts: 222
Joined: February 12th, 2018, 10:21 pm

Re: Trigger message on attack during certain range of turns

Post by MathBrush »

Thanks! This is working great now, thanks to you.
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die | Loyalist Campaign: Wesnoth Creepypasta
Post Reply