How to play sound on advancement for a specific unit?

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
Splizard
Posts: 4
Joined: December 9th, 2010, 5:21 am

How to play sound on advancement for a specific unit?

Post by Splizard »

I am trying to play a sound on/during/after an advancement for a specific unit.
The sound plays without filters but for some reason the sound will not play when I try to use a filter to specify the particular unit.

Code: Select all

         [event]
		id=creatureadvance
		name=advance
		first_time_only=no

		[filter]
			id=creature
		[/filter]
		
		[sound]
			name=sound.ogg
		[/sound]
	[/event]
The event is inside a unit definition.
This does not work, why would that be?
I am using wesnoth 1.12 on Ubuntu.
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to play sound on advancement for a specific unit?

Post by Ravana »

Therefore your unit does not match this filter.
Splizard
Posts: 4
Joined: December 9th, 2010, 5:21 am

Re: How to play sound on advancement for a specific unit?

Post by Splizard »

so it is a bug? I have triple checked the unit ID and it is correct, I have been testing on the Survival map and the sound is not played, I would imagine the 2p survival map doesn't disable unit events.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: How to play sound on advancement for a specific unit?

Post by zookeeper »

It doesn't make any sense to use a unit type event for an event that is supposed to only trigger when a specific single unit advances. If your event filter was intended to make the event trigger whenever any unit of a given type advances, then it would make sense.
Splizard
Posts: 4
Joined: December 9th, 2010, 5:21 am

Re: How to play sound on advancement for a specific unit?

Post by Splizard »

yes it is meant to play a sound when any instance of the unit type advances. It doesn't work, I had it working without the filter but it would trigger on any unit, not just the specific unit type.
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to play sound on advancement for a specific unit?

Post by Ravana »

Then you should filter it by unit type, not id.
Splizard
Posts: 4
Joined: December 9th, 2010, 5:21 am

Re: How to play sound on advancement for a specific unit?

Post by Splizard »

thanks :D
Post Reply