It is possible to do this although I think you'll need to use the Custom Script value when passing the parameter to the Play Sound function. You see the sound link is actually a string already but the Trigger Editor doesn't let you pass in String variables (it just lets you select a sound from the list).
Remember the String's variable name. Say, if the name is "SoundStr" then the script variable is "lv_SoundStr".
Go the play sound function and for the sound, hit Custom Script and type in lv_SoundStr.
Note, I don't have the editor here so I can't test it but I'm sure it's possible along those lines.
if what Klishu says doesn't work then you'll need to create your own function: StringToSoundLink, set as return value the type you want to return, as parameter something like "soundstring" with the type String.
then add just 1 general action to it, which is General - return, and as return value you click on the "custom code" bullet and enter there "lp_soundstring" or whatever the value of the string parameter is set to.
now use this function as the conversion from string to sound link.
I want to play a unit's Ready sound on a certain trigger (the unit can be any unit).
I've been unable to mesh together a construction that does this with Play Sound; am I missing something?
Example of what I want:
A unit enters a region.
Unit enters region trigger.
Sound plays for a specific player only, as per Play Sound, so not centered, just a sound played.
This sound has to be the Sound that's connected to the triggering unit's Ready sound.
Example:
SCV enters the region:
"SCV ready to go" on the speakers of player 1, regardless of where player 1 is.
You can use a trigger to play your sound on an event. For example Molsterr helped me with this.
What this does is when a Unit enters a region it gets teleported to a point. At the point he has an effect played for him and a sound.
Events
Unit - Any Unit Enters within 2.0 of tele team 1
Action
Unit - Move (Triggering unit) instantly to tele arrive team 1 (Blend)
Actor - Create actor model Mothership Teleport In at point tele arrive team 1
Sound - Play WarpGate_TrainFinish for (All players) at tele arrive team 1 with Z offset 40.0 (at 115.0% volume, skip the first 0.0 seconds)
There is a few more triggers, But this is the basics. All you need to do is set the event of your unit or building, For example You build an scv, then use an action to play the sound.
You can use a trigger to play your sound on an event. For example Molsterr helped me with this.
What this does is when a Unit enters a region it gets teleported to a point. At the point he has an effect played for him and a sound.
Events
Unit - Any Unit Enters within 2.0 of tele team 1
Action
Unit - Move (Triggering unit) instantly to tele arrive team 1 (Blend)
Actor - Create actor model Mothership Teleport In at point tele arrive team 1
Sound - Play WarpGate_TrainFinish for (All players) at tele arrive team 1 with Z offset 40.0 (at 115.0% volume, skip the first 0.0 seconds)
There is a few more triggers, But this is the basics. All you need to do is set the event of your unit or building, For example You build an scv, then use an action to play the sound.
This is not what I intent to do though. I have a region for instance, and whenever any unit enters that region, I want a trigger to play that unit's ready sound. :) And I've had problems finding a way to do this with Play Sound, since I couldn't find a way to convert the unit sounds into sound links, but lets see what the other guy wrote up for me.
You want the sound to play for a different unit than the owner?
I can think of a couple of ways to do that but it depends largely on the circumstances of your map. For example you could change the unit's sound actor (default is Unit Sound which filters out everything except the player) to one which doesn't filter out non-players. Or you could create a separate actor for each sound and use actor signals to play it. Or you could use catalog functions to extract the sound asset at runtime (not 100% sure this is possible, but probably is.)
I do yes, the owner of the unit is neutral after all.
Some kind of cataloging function to extract the ready sounds runtime would be best, since it would mean the trigger could run independantly of the unit there and if any changes are later required, nothing else will have to be changed.
Current status: Resolved
(From http://forums.sc2mapster.com/development/map-development/9861-string-to-sound-link-conversion/)
How to Play a specific unit sound (e.g. Ready)?
I want to play a unit's Ready sound on a certain trigger (the unit can be any unit).
I've been unable to mesh together a construction that does this with Play Sound; am I missing something?
Example of what I want:
A unit enters a region. Unit enters region trigger. Sound plays for a specific player only, as per Play Sound, so not centered, just a sound played. This sound has to be the Sound that's connected to the triggering unit's Ready sound.
Example: SCV enters the region: "SCV ready to go" on the speakers of player 1, regardless of where player 1 is.
Unit - Any Unit Enters within 2.0 of tele team 1 Action
Unit - Move (Triggering unit) instantly to tele arrive team 1 (Blend)
Actor - Create actor model Mothership Teleport In at point tele arrive team 1
Sound - Play WarpGate_TrainFinish for (All players) at tele arrive team 1 with Z offset 40.0 (at 115.0% volume, skip the first 0.0 seconds) There is a few more triggers, But this is the basics. All you need to do is set the event of your unit or building, For example You build an scv, then use an action to play the sound.
Send actor message, Play Unit Sound.
Yesssss, responses!
Now I have you I'm not letting you go that easily! Any of you have a solution for: http://forums.sc2mapster.com/development/map-development/8949-how-to-add-a-charge-to-a-research-through-a-trigger/ ?
This is not what I intent to do though. I have a region for instance, and whenever any unit enters that region, I want a trigger to play that unit's ready sound. :) And I've had problems finding a way to do this with Play Sound, since I couldn't find a way to convert the unit sounds into sound links, but lets see what the other guy wrote up for me.
Actor - Send message "PlayUnitSound Ready" to actor (Actor for (Triggering unit))
Looks promising, thanks Riley!
Although one thing, I want this sound to play for the player, unlocalized. Won't this just make the triggering unit play the sound?
Event - Unit enter region
Action - Play sound
Actor - Send message "PlayUnitSound Ready" to actor (Actor for (Triggering unit))
Why make easy things difficult?!
@iMisu: Go
Well, I need the sound to play for a specific player, as per Play Sound. The actor message doesn't seem to do that.
@Siaon: Go
Nope, none of your proposed solutions achieved this purpose.
Surely there is a way to convert these actor thingies to a regular soundlink somehow?
You want the sound to play for a different unit than the owner?
I can think of a couple of ways to do that but it depends largely on the circumstances of your map. For example you could change the unit's sound actor (default is Unit Sound which filters out everything except the player) to one which doesn't filter out non-players. Or you could create a separate actor for each sound and use actor signals to play it. Or you could use catalog functions to extract the sound asset at runtime (not 100% sure this is possible, but probably is.)
@RileyStarcraft: Go
I do yes, the owner of the unit is neutral after all.
Some kind of cataloging function to extract the ready sounds runtime would be best, since it would mean the trigger could run independantly of the unit there and if any changes are later required, nothing else will have to be changed.
Still failing to accomplish this, is there anyone out there with an example perhaps?