• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How do you play Music to a single player?

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
Exactly as the title asks,
How do you play Music to a single player?

Also, how do you initiate a fade filter to a single player as well?
 
You have to use GetLocalPlayer().

  • Set MyPlayerVar = Player 1 (Red)
  • Custom script: if GetLocalPlayer() == udg_MyPlayerVar then
  • Sound - Play asdfjkl.wav
  • Custom script: endif
Where MyPlayerVar points to the player that you want to perform the action for. However, this is prone to desyncs if not used properly.

For fade filters:
http://www.hiveworkshop.com/forums/cinematics-268/tips-tricks-cinema-39854/#F
 
Level 8
Joined
Jul 17, 2004
Messages
283
Okay, here are my triggers. Are these both leakless and won't cause desyncs?

Also, when the fade filter is executed, I noticed health bars for units owned by players not doing the fade filter vanish, and come back once the fade filter is over. Is there any way to keep health bars shown while a fade filter is executed?

  • MusicToSinglePlayer
    • Events
      • Unit - A unit enters Music <gen>
    • Conditions
    • Actions
      • Set MyPlayerVar[1] = (Owner of (Entering unit))
      • Custom script: if GetLocalPlayer() == udg_MyPlayerVar[1] then
      • Sound - Play War2IntroMusic <gen>
      • Custom script: endif
  • FadeToSinglePlayer
    • Events
      • Unit - A unit enters Fade <gen>
    • Conditions
    • Actions
      • Set MyPlayerVar[2] = (Owner of (Entering unit))
      • Set AlphaReal = 0.00
      • Custom script: if GetLocalPlayer() != udg_MyPlayerVar[2] then
      • Set AlphaReal = 100.00
      • Custom script: endif
      • Cinematic - Fade out and back in over 2.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with AlphaReal% transparency
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
You do not have to send me anymore pms or visitor messages, the thread is subscribed to.

You do not create anything in these two triggers, so no, it does not leak. It also does not desync unless you read the AlphaReal variable elsewhere before resetting it. The fade filter is done for everyone, only that it is completely transparent to others. The deactivation of health bars and tooltips is part of the disablement of the user interface this Fade Filter action contains. You may use the Advanced Filter or activate it again via call EnableUserUI(true) (use Custom Script action to implement jass lines in GUI triggers).
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You do not need to make your Player variable an array.
Also, you do not need to make Player[1] for trigger 1 and Player[2] for trigger 2.

Warcraft III uses a single-threaded which if you have triggers that have instant effect, you should just name it TempVariableName - Temp stands for Temporary (if you're planning to share that variable with other trigger).

Change your Player variable and name it TempPlayer no array.
And try to use it in both trigger, it would work well.
 
Status
Not open for further replies.
Top