Create account / Log in

Playing a sound when a unit moves into a zone

Topics related to Vassal game modules.

Moderators: uckelman, Tim M

Playing a sound when a unit moves into a zone

Postby ChuckS » May 19th, 2020, 5:46 pm

Anyone have any idea how to make this work? So that when I unit is moved into a named zone a sound plays?
ChuckS
 
Posts: 101
Joined: August 16th, 2016, 4:37 pm

Re: Playing a sound when a unit moves into a zone

Postby Cattlesquat » May 19th, 2020, 8:08 pm

Step 1 - Go to properties for your main map and in the bottom blank (keystroke to apply on move), make sure a keystroke is being applied (I use a named keystroke "MovedOnMap")
Step 2 - In the unit (or a prototype for it), add a Play Sound trait, blank out the "Menu Text" line, and set the Key Command to something like "ZoneSound" (and set the Sound Clip to your actual sound)
Step 3 - Also in the unit (or its prototype), add a Trigger trait. In the "watch for these keystrokes" put MovedOnMap. In the "apply these keystrokes" put ZoneSound. And have your "matching expression" be CurrentZone=nameofthezone or { CurrentZone == "nameofthezone" } if you're using the beanshell.
User avatar
Cattlesquat
 
Posts: 580
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Playing a sound when a unit moves into a zone

Postby ChuckS » June 12th, 2020, 6:39 pm

Got it thanks!
ChuckS
 
Posts: 101
Joined: August 16th, 2016, 4:37 pm


Return to Module General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron