Page 1 of 1

Playing a sound when a unit moves into a zone

PostPosted: May 19th, 2020, 5:46 pm
by ChuckS
Anyone have any idea how to make this work? So that when I unit is moved into a named zone a sound plays?

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

PostPosted: May 19th, 2020, 8:08 pm
by Cattlesquat
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.

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

PostPosted: June 12th, 2020, 6:39 pm
by ChuckS
Got it thanks!