• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How can I use Fade in / Fade out function only for one player?

Status
Not open for further replies.
Level 13
Joined
Feb 18, 2009
Messages
1,381
There is a JASS function. I am not aware if there is a GUI function though.
I do not remember it.
 
  • Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Transparency = 100.00
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
      • Set Transparency = 0.00
      • Custom script: endif
      • Cinematic - Fade out and back in over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with Transparency% transparency
It should be something like this.
 
The custom script takes a local player, so that the effect you want isn't applied to every player. After the equation, you define the player you want the effect to take place for. In this example, I used "GetOwningPlayer(GetTriggerUnit())" = Owner of (Triggering unit). If you choose your heroes with abilities, you will use this one. If you use arrows to select the heroes, you will use GetTriggerPlayer() instead = Triggering Player (this is the player that responds to arrows).

Now, if you use directly the action before the endif script (which means inside the 'loop'), the rest players will probably be disconnected, except for the player you want. So, to avoid that, you will instead localize the real value (Transparency) for the player, so that the effect will take place for all players (to avoid desyncs), but retain the effect you want, by applying a transparent filter to the rest players and a normal filter to the player you want.

So, this trigger will create a fade filter for the player you define and, for the rest ones, it will create a transparent filter = no filter.

Since this system applies a fade filter, which has a duration, you might also want to localize the duration. Now, create another real variable, called duration with initial value 0 and within the GetLocalPlayer() script the duration you want it to have for that specific player:
  • Set Transparency = 100.00
  • Set Duration = 0.00
  • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
  • Set Transparency = 0.00
  • Set Duration = 3.00
  • Custom script: endif
  • Cinematic - Fade out and back in over Duration seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with Transparency% transparency
This script will make a filter to last for 3 seconds for the Owner of Triggering unit and a filter with 0 duration, fully transparent for the rest players.
 
Status
Not open for further replies.
Top