• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Unit's 'what' response after selecting via trigger

Status
Not open for further replies.
Level 1
Joined
Sep 27, 2016
Messages
2
I'm using a trigger to select a unit, which works fine, however the unit does not respond as if you had clicked it with the mouse, just silence. Is there a way to force a 'what' response out of any given unit, to simulate a user click?
 
Level 1
Joined
Sep 27, 2016
Messages
2
Thanks for the response. From scanning the available GUI functions for sound, it appears that none of them are targeted at a player. I assume then both players would hear the unit response, unless there's something the GUI left out that I can take advantage of? Also, would there be a way to access the sounds without creating a variable in the Sound Editor? If I have many unit types it would be cumbersome to pull out every possible response sound and attempt to crate a random response from the sounds available, for each unit.

I was hoping there would be a way to simply access/kickoff whatever code flow happens when a user selects a unit, which would trigger both a portrait animation and a unit response under the hood. Sadly selection via triggers seems to circumvent all of that.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
A few things. Yes you can play it for only one player, as Flux said you need to use GetLocalPlayer()

You'd use custom scripts and do the following

  • Set tempPlayer = whichPlayer
  • Custom script: if GetLocalPlayer() == udg_tempPlayer then
  • your sound code
  • Custom script: endif
You can create a sound variable in the trigger editor rather than the sound editor by using any of these natives

JASS:
native CreateSound takes string fileName, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns sound
or
JASS:
native CreateSoundFromLabel takes string soundLabel, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate returns sound
or
JASS:
native CreateSoundFilenameWithLabel takes string fileName, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string SLKEntryName returns sound


This looks like it could save time if you know the names of the paths. For example
  • Set udg_mySound = Custom script: CreateSound("Units\\Human\\Footman\\FootmanWhat1.wav", false, false, false, 10, 10,"")
since we can see footman have 4 what comments we can copy and paste 3 times change FootmanWhat to the proper path.

I don't have a lot of experience doing this, but it works. You might want to research about all the quirks about sounds or maybe someone else with comment with enlightening information.

As for the portrait animation, I think you're out of luck, I don't think there is any way to do that.
 
Last edited:
Status
Not open for further replies.
Top