• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Trigger With Local Player Doesn't Work

Level 12
Joined
Jul 21, 2015
Messages
271
  • MushroomAffects
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
    • Actions
      • Set VariableSet PlayerGroupMushroom = (Player group((Owner of (Hero manipulating item))))
      • -------- Red Spotted Mushroom --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerRedMush Equal to 2
            • Then - Actions
              • Cinematic - Clear the screen of text messages for PlayerGroupMushroom.
              • Game - Display to PlayerGroupMushroom the text: |cffff0000Red Mushr...
              • Camera - Lock camera target for (Owner of (Hero manipulating item)) to (Hero manipulating item), offset by (0.00, 0.00) using Default rotation
              • Set VariableSet PlayerMushroom = (Owner of (Hero manipulating item))
              • Unit - Change ownership of (Hero manipulating item) to Player 11 (Dark Green) and Retain color
              • Unit - Order (Hero manipulating item) to Move To (Random point in (Playable map area))
              • Selection - Add (Hero manipulating item) to selection for PlayerMushroom
              • Wait 10.00 seconds
              • Custom script: local player p=GetOwningPlayer(GetManipulatingUnit())
              • Custom script: if GetLocalPlayer()==p then
              • Custom script: call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
              • Custom script: call SetCineFilterStartColor(0,0,0,0)
              • Custom script: call SetCineFilterEndColor(0,0,0,255)
              • Custom script: call SetCineFilterDuration(2) // fades within 2 seconds
              • Custom script: call DisplayCineFilter(true)
              • Custom script: endif
              • Wait 2.00 seconds
              • Custom script: if GetLocalPlayer()==p then
              • Custom script: call SetCineFilterStartColor(0,0,0,255)
              • Custom script: call SetCineFilterEndColor(0,0,0,0)
              • Custom script: call SetCineFilterDuration(2)
              • Custom script: call DisplayCineFilter(true)
              • Custom script: endif
              • Custom script: set p=null
              • Wait 5.00 seconds
              • Unit - Move (Hero manipulating item) instantly to (Random point in (Playable map area))
              • Camera - Reset camera for (Owner of (Hero manipulating item)) to standard game-view over 0.00 seconds
              • Camera - Pan camera for PlayerMushroom to (Position of (Hero manipulating item)) over 0.00 seconds
              • Selection - Add (Hero manipulating item) to selection for PlayerMushroom
              • Unit - Change ownership of (Hero manipulating item) to PlayerMushroom and Retain color
              • Floating Text - Create floating text that reads How did I end up he... at ((Position of (Hero manipulating item)) offset by 200.00 towards 225.00 degrees.) with Z offset 0.00, using font size 10.00, color (100.00%, 50.00%, 0.00%), and 0.00% transparency
              • Set VariableSet FloatingTextMushroom = (Last created floating text)
              • Wait 4.00 seconds
              • Floating Text - Destroy FloatingTextMushroom
            • Else - Actions
            • Else - Actions

Hi all, so I am attempting to incorporate this fade out for local player but for some reason it does not work. My main goal is to be able to make a local player fade out if they eat an item. The fading out only happens though if the roll for an integer is met.

How the trigger is supposed to work:
1) If the integer requirement is met then, then the unit will start running and lose control, then after 10 seconds I want the player screen to fade out for 2 seconds and fade back in.

Hers how the trigger works with no custom script but it makes the screen fade out for all players which is not what I want...

  • MushroomAffects
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Hero manipulating item)) Equal to Main Character
          • (Unit-type of (Hero manipulating item)) Equal to Main Character (ranged)
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Red Spotted Mushroom
          • (Item-type of (Item being manipulated)) Equal to Blue Spotted Mushroom
          • (Item-type of (Item being manipulated)) Equal to Green Spotted Mushroom
    • Actions
      • Set VariableSet PlayerGroupMushroom = (Player group((Owner of (Hero manipulating item))))
      • -------- Red Spotted Mushroom --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Red Spotted Mushroom
        • Then - Actions
          • Set VariableSet IntegerRedMush = (Random integer number between 1 and 3)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerRedMush Equal to 1
            • Then - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerRedMush Equal to 2
                • Then - Actions
                  • Cinematic - Clear the screen of text messages for PlayerGroupMushroom.
                  • Game - Display to PlayerGroupMushroom the text: |cffff0000Red Mushr...
                  • Camera - Lock camera target for (Owner of (Hero manipulating item)) to (Hero manipulating item), offset by (0.00, 0.00) using Default rotation
                  • Set VariableSet PlayerMushroom = (Owner of (Hero manipulating item))
                  • Unit - Change ownership of (Hero manipulating item) to Player 11 (Dark Green) and Retain color
                  • Unit - Order (Hero manipulating item) to Move To (Random point in (Playable map area))
                  • Selection - Add (Hero manipulating item) to selection for PlayerMushroom
                  • Wait 10.00 seconds
                  • Cinematic - Fade out over 2.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
                  • Wait 5.00 seconds
                  • Unit - Move (Hero manipulating item) instantly to (Random point in (Playable map area))
                  • Camera - Reset camera for (Owner of (Hero manipulating item)) to standard game-view over 0.00 seconds
                  • Camera - Pan camera for PlayerMushroom to (Position of (Hero manipulating item)) over 0.00 seconds
                  • Selection - Add (Hero manipulating item) to selection for PlayerMushroom
                  • Cinematic - Fade in over 2.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
                  • Unit - Change ownership of (Hero manipulating item) to PlayerMushroom and Retain color
                  • Floating Text - Create floating text that reads How did I end up he... at ((Position of (Hero manipulating item)) offset by 200.00 towards 225.00 degrees.) with Z offset 0.00, using font size 10.00, color (100.00%, 50.00%, 0.00%), and 0.00% transparency
                  • Set VariableSet FloatingTextMushroom = (Last created floating text)
                  • Wait 4.00 seconds
                  • Floating Text - Destroy FloatingTextMushroom
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IntegerRedMush Equal to 3
                    • Then - Actions
                      • Cinematic - Clear the screen of text messages for PlayerGroupMushroom.
                      • Game - Display to PlayerGroupMushroom the text: |cffff0000Red Mushr...
                      • Unit - Set (Hero manipulating item) movement speed to ((Default movement speed of (Hero manipulating item)) + 200.00)
                      • Wait 60.00 seconds
                      • Unit - Set (Hero manipulating item) movement speed to (Default movement speed of (Hero manipulating item))
                    • Else - Actions

I think the solution is simply to Run a new Trigger, and use the script:



But the problem is I dont know what to change this script into a variable: local player p=GetOwningPlayer(GetManipulatingUnit())

I would like the player to be stored as a PlayerVariable: PlayerMushroom, so with that in mind how do I alter the script. Let me know if the script below is the correct solution.

  • Untitled Trigger 001 Copy 2
    • Events
    • Conditions
    • Actions
      • Custom script: local player p=GetOwningPlayer(GetManipulatingUnit())
      • Custom script: if GetLocalPlayer()==p then
      • Custom script: call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
      • Custom script: call SetCineFilterStartColor(0,0,0,0)
      • Custom script: call SetCineFilterEndColor(0,0,0,255)
      • Custom script: call SetCineFilterDuration(2) // fades within 2 seconds
      • Custom script: call DisplayCineFilter(true)
      • Custom script: endif
      • Wait 2.00 seconds
      • Custom script: if GetLocalPlayer()==p then
      • Custom script: call SetCineFilterStartColor(0,0,0,255)
      • Custom script: call SetCineFilterEndColor(0,0,0,0)
      • Custom script: call SetCineFilterDuration(2)
      • Custom script: call DisplayCineFilter(true)
      • Custom script: endif
      • Custom script: set p=null
  • Trigger - Run Untitled Trigger 001 <gen> (checking conditions)
  • Custom script: local player p=PlayerMushroom
 
Last edited:
The first trigger is definitely not valid gui trigger. I don't know how you copied it or if you were doing some modifications to it here on forums, but there's a lot of stuff missing.
Anyway, one problem I could immediately see is that you are declaring locals mid trigger. As far as I know, local variables can be declared only at the beginning of a trigger (or rather, at the beginning of jass function, which trigger's action block internally is).
 
In your case, you can use a global player variable to "pass" the player along to that trigger. For example, if you made a player variable called "FFP_Player" (Fade For Player - Player), then you could assign it before running the trigger:
  • Set FFP_Player = (Owner of (Hero manipulating item))
  • Trigger - Run Untitled Trigger 001 <gen> (checking conditions)
Then you can adjust your local player p line to read from that variable:
  • Custom script: local player p = udg_FFP_Player
Then it should work just fine.



However, I think your idea is on the right track, but you could make it even more generic so you could re-use this for other cases in the future. So instead, I recommend making a helper trigger to generically fade out or fade in for a player:
  • FadeForPlayer
    • Events
    • Conditions
    • Actions
      • -------- --------
      • -------- Input Parameters: --------
      • -------- - FFP_Player: The player to fade out for --------
      • -------- - FFP_Texture: The mask to use --------
      • -------- - FFP_Duration: How long the fade filter should last --------
      • -------- - FFP_FadeOut: Set this to true to fade out. Set this to false to fade in. --------
      • -------- --------
      • Custom script: if GetLocalPlayer() == udg_FFP_Player then
      • Custom script: call SetCineFilterTexture(udg_FFP_Texture)
      • Custom script: call SetCineFilterBlendMode(BLEND_MODE_BLEND)
      • Custom script: call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
      • Custom script: call SetCineFilterStartUV(0, 0, 1, 1)
      • Custom script: call SetCineFilterEndUV(0, 0, 1, 1)
      • Custom script: if udg_FFP_FadeOut then
      • Custom script: call SetCineFilterStartColor(255, 255, 255, 0)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, 255)
      • Custom script: else
      • Custom script: call SetCineFilterStartColor(255, 255, 255, 255)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, 0)
      • Custom script: endif
      • Custom script: call SetCineFilterDuration(udg_FFP_Duration)
      • Custom script: call DisplayCineFilter(true)
      • Custom script: endif
You can customize the input variables further if you'd like. Then to run it, you simply assign the input variables and then run the trigger:
  • Actions
    • Set VariableSet FFP_Player = Player 1 (Red)
    • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\Black_mask.blp
    • Set VariableSet FFP_Duration = 2.00
    • Set VariableSet FFP_FadeOut = True
    • Trigger - Run FadeForPlayer <gen> (ignoring conditions)
    • Wait 5.00 seconds
    • Set VariableSet FFP_Player = Player 1 (Red)
    • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\Black_mask.blp
    • Set VariableSet FFP_Duration = 2.00
    • Set VariableSet FFP_FadeOut = False
    • Trigger - Run FadeForPlayer <gen> (ignoring conditions)
And as a best practice, I recommend setting all the input variables before running the trigger--just to make sure that none of the previous variable values accidentally affect your filter.
 

Attachments

In your case, you can use a global player variable to "pass" the player along to that trigger. For example, if you made a player variable called "FFP_Player" (Fade For Player - Player), then you could assign it before running the trigger:
  • Set FFP_Player = (Owner of (Hero manipulating item))
  • Trigger - Run Untitled Trigger 001 <gen> (checking conditions)
Then you can adjust your local player p line to read from that variable:
  • Custom script: local player p = udg_FFP_Player
Then it should work just fine.



However, I think your idea is on the right track, but you could make it even more generic so you could re-use this for other cases in the future. So instead, I recommend making a helper trigger to generically fade out or fade in for a player:
  • FadeForPlayer
    • Events
    • Conditions
    • Actions
      • -------- --------
      • -------- Input Parameters: --------
      • -------- - FFP_Player: The player to fade out for --------
      • -------- - FFP_Texture: The mask to use --------
      • -------- - FFP_Duration: How long the fade filter should last --------
      • -------- - FFP_FadeOut: Set this to true to fade out. Set this to false to fade in. --------
      • -------- --------
      • Custom script: if GetLocalPlayer() == udg_FFP_Player then
      • Custom script: call SetCineFilterTexture(udg_FFP_Texture)
      • Custom script: call SetCineFilterBlendMode(BLEND_MODE_BLEND)
      • Custom script: call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
      • Custom script: call SetCineFilterStartUV(0, 0, 1, 1)
      • Custom script: call SetCineFilterEndUV(0, 0, 1, 1)
      • Custom script: if udg_FFP_FadeOut then
      • Custom script: call SetCineFilterStartColor(255, 255, 255, 0)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, 255)
      • Custom script: else
      • Custom script: call SetCineFilterStartColor(255, 255, 255, 255)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, 0)
      • Custom script: endif
      • Custom script: call SetCineFilterDuration(udg_FFP_Duration)
      • Custom script: call DisplayCineFilter(true)
      • Custom script: endif
You can customize the input variables further if you'd like. Then to run it, you simply assign the input variables and then run the trigger:
  • Actions
    • Set VariableSet FFP_Player = Player 1 (Red)
    • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\Black_mask.blp
    • Set VariableSet FFP_Duration = 2.00
    • Set VariableSet FFP_FadeOut = True
    • Trigger - Run FadeForPlayer <gen> (ignoring conditions)
    • Wait 5.00 seconds
    • Set VariableSet FFP_Player = Player 1 (Red)
    • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\Black_mask.blp
    • Set VariableSet FFP_Duration = 2.00
    • Set VariableSet FFP_FadeOut = False
    • Trigger - Run FadeForPlayer <gen> (ignoring conditions)
And as a best practice, I recommend setting all the input variables before running the trigger--just to make sure that none of the previous variable values accidentally affect your filter.
Thank you Purge and Fire I appreciate all this triggers SO SO MUCH! Currently it is bed time for me but I am going to try and incorporate your triggers tomorrow, I will let you know how it works for me bud!
 
Last edited:
The first trigger is definitely not valid gui trigger. I don't know how you copied it or if you were doing some modifications to it here on forums, but there's a lot of stuff missing.
Anyway, one problem I could immediately see is that you are declaring locals mid trigger. As far as I know, local variables can be declared only at the beginning of a trigger (or rather, at the beginning of jass function, which trigger's action block internally is).
Thank you Nichilus for letting me know some of the main issues I am running into with my trigger I appreciate it! Thank you for explaining it to me :)
 
EDIT: @PurgeandFire, it works! I am so excited to incorporate it and to use it in other ways as well. Do you know how to change the variable:

  • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\Black_mask.blp
So that it uses a white mask with 25% transparency instead of black mask? I am using both in my map currently but would like to modify your posted trigger to do white mask as well.

(The transparency part is especially necessary)

Below is my current trigger without modifying the variables you provided.
  • Cinematic - Fade out over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 25.00% transparency
 
Last edited:
EDIT: @PurgeandFire, it works! I am so excited to incorporate it and to use it in other ways as well. Do you know how to change the variable:

  • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\Black_mask.blp
So that it uses a white mask with 25% transparency instead of black mask? I am using both in my map currently but would like to modify your posted trigger to do white mask as well.

(The transparency part is especially necessary)

Below is my current trigger without modifying the variables you provided.
  • Cinematic - Fade out over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 25.00% transparency
awesome!

To use a white mask, you can use the following path: ReplaceableTextures\CameraMasks\White_mask.blp
  • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\White_mask.blp
As a little tip, if you ever need to quickly see what the path for the cinematic filters are, you can create a new trigger in GUI with the filter you want, like so:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Cinematic - Fade out and back in over 2.00 seconds using texture Dream and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
Then you can go to Edit > Convert to Custom Text. That will show the JASS representation (or Lua if your map is using Lua), and then you can just grab the path easily from there. Just be sure to remove the extra backslashes "\" when you paste it into GUI:
JASS:
// You can grab the path in quotations below, and then change all the "\\" to a single "\" when using it in GUI
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 2, "ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp", 0, 0, 0, 0 )

Then you can delete the trigger afterward.



As for transparency, that is definitely doable--I'd recommend adding another variable as input so you can customize the transparency for any filter you want: "FFP_Transparency" (real variable). To keep it consistent with GUI, we'll treat that as a value between 0 and 100, where 0 is opaque and 100 is invisible.

However, in JASS, it expects an alpha value between 0 and 255, where 0 is invisible and 255 is opaque. So in our helper trigger "FadeForPlayer", we can make a local variable that converts the transparency value into an alpha value:
  • Custom script: local integer alpha = PercentTo255(100.0 - udg_FFP_Transparency)
The 100.0 - udg_FFP_Transparency is essentially just "flipping" the meaning of the number, so that it instead represents opacity (where 0% is invisible, and 100% is opaque). Then the PercentTo255 just turns the number into a whole number between 0 and 255.

Then in our code, we can just update the "alpha" parameter to use that alpha instead:
  • Custom script: if udg_FFP_FadeOut then
  • Custom script: call SetCineFilterStartColor(255, 255, 255, 0)
  • Custom script: call SetCineFilterEndColor(255, 255, 255, alpha)
  • Custom script: else
  • Custom script: call SetCineFilterStartColor(255, 255, 255, alpha)
  • Custom script: call SetCineFilterEndColor(255, 255, 255, 0)
  • Custom script: endif
Then you should be good to go! For reference, here is the final trigger as well as a sample trigger with the example you provided:
  • FadeForPlayer
    • Events
    • Conditions
    • Actions
      • -------- --------
      • -------- Input Parameters: --------
      • -------- - FFP_Player: The player to fade out for --------
      • -------- - FFP_Texture: The mask to use --------
      • -------- - FFP_Duration: How long the fade filter should last --------
      • -------- - FFP_FadeOut: Set this to true to fade out. Set this to false to fade in. --------
      • -------- - FFP_Transparency: Controls the transparency of the filter. Should be a value between 0.00 and 100.0 (0 = opaque, 100 = invisible). --------
      • -------- When fading out, this will determine the transparency of the filter at the end of the duration. --------
      • -------- When fading in, this will determine the transparency of the filter initially. --------
      • -------- --------
      • Custom script: local integer alpha = PercentTo255(100.0 - udg_FFP_Transparency)
      • Custom script: if GetLocalPlayer() == udg_FFP_Player then
      • Custom script: call SetCineFilterTexture(udg_FFP_Texture)
      • Custom script: call SetCineFilterBlendMode(BLEND_MODE_BLEND)
      • Custom script: call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
      • Custom script: call SetCineFilterStartUV(0, 0, 1, 1)
      • Custom script: call SetCineFilterEndUV(0, 0, 1, 1)
      • Custom script: if udg_FFP_FadeOut then
      • Custom script: call SetCineFilterStartColor(255, 255, 255, 0)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, alpha)
      • Custom script: else
      • Custom script: call SetCineFilterStartColor(255, 255, 255, alpha)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, 0)
      • Custom script: endif
      • Custom script: call SetCineFilterDuration(udg_FFP_Duration)
      • Custom script: call DisplayCineFilter(true)
      • Custom script: endif
Sample usage:
  • Esc For Specific Player
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Fading...
      • Set VariableSet FFP_Player = Player 1 (Red)
      • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\White_mask.blp
      • Set VariableSet FFP_Duration = 2.00
      • Set VariableSet FFP_FadeOut = True
      • Set VariableSet FFP_Transparency = 25.00
      • Trigger - Run FadeForPlayer <gen> (ignoring conditions)
      • Wait 5.00 seconds
      • Set VariableSet FFP_Player = Player 1 (Red)
      • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\White_mask.blp
      • Set VariableSet FFP_Duration = 2.00
      • Set VariableSet FFP_FadeOut = False
      • Set VariableSet FFP_Transparency = 25.00
      • Trigger - Run FadeForPlayer <gen> (ignoring conditions)

I'll attach the sample map too if that helps. :thumbs_up: If you need to customize more of it, such as the color, you can follow the same steps (or feel free to ask here if you get stuck).
 

Attachments

awesome!

To use a white mask, you can use the following path: ReplaceableTextures\CameraMasks\White_mask.blp
  • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\White_mask.blp
As a little tip, if you ever need to quickly see what the path for the cinematic filters are, you can create a new trigger in GUI with the filter you want, like so:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Cinematic - Fade out and back in over 2.00 seconds using texture Dream and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
Then you can go to Edit > Convert to Custom Text. That will show the JASS representation (or Lua if your map is using Lua), and then you can just grab the path easily from there. Just be sure to remove the extra backslashes "\" when you paste it into GUI:
JASS:
// You can grab the path in quotations below, and then change all the "\\" to a single "\" when using it in GUI
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 2, "ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp", 0, 0, 0, 0 )

Then you can delete the trigger afterward.



As for transparency, that is definitely doable--I'd recommend adding another variable as input so you can customize the transparency for any filter you want: "FFP_Transparency" (real variable). To keep it consistent with GUI, we'll treat that as a value between 0 and 100, where 0 is opaque and 100 is invisible.

However, in JASS, it expects an alpha value between 0 and 255, where 0 is invisible and 255 is opaque. So in our helper trigger "FadeForPlayer", we can make a local variable that converts the transparency value into an alpha value:
  • Custom script: local integer alpha = PercentTo255(100.0 - udg_FFP_Transparency)
The 100.0 - udg_FFP_Transparency is essentially just "flipping" the meaning of the number, so that it instead represents opacity (where 0% is invisible, and 100% is opaque). Then the PercentTo255 just turns the number into a whole number between 0 and 255.

Then in our code, we can just update the "alpha" parameter to use that alpha instead:
  • Custom script: if udg_FFP_FadeOut then
  • Custom script: call SetCineFilterStartColor(255, 255, 255, 0)
  • Custom script: call SetCineFilterEndColor(255, 255, 255, alpha)
  • Custom script: else
  • Custom script: call SetCineFilterStartColor(255, 255, 255, alpha)
  • Custom script: call SetCineFilterEndColor(255, 255, 255, 0)
  • Custom script: endif
Then you should be good to go! For reference, here is the final trigger as well as a sample trigger with the example you provided:
  • FadeForPlayer
    • Events
    • Conditions
    • Actions
      • -------- --------
      • -------- Input Parameters: --------
      • -------- - FFP_Player: The player to fade out for --------
      • -------- - FFP_Texture: The mask to use --------
      • -------- - FFP_Duration: How long the fade filter should last --------
      • -------- - FFP_FadeOut: Set this to true to fade out. Set this to false to fade in. --------
      • -------- - FFP_Transparency: Controls the transparency of the filter. Should be a value between 0.00 and 100.0 (0 = opaque, 100 = invisible). --------
      • -------- When fading out, this will determine the transparency of the filter at the end of the duration. --------
      • -------- When fading in, this will determine the transparency of the filter initially. --------
      • -------- --------
      • Custom script: local integer alpha = PercentTo255(100.0 - udg_FFP_Transparency)
      • Custom script: if GetLocalPlayer() == udg_FFP_Player then
      • Custom script: call SetCineFilterTexture(udg_FFP_Texture)
      • Custom script: call SetCineFilterBlendMode(BLEND_MODE_BLEND)
      • Custom script: call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
      • Custom script: call SetCineFilterStartUV(0, 0, 1, 1)
      • Custom script: call SetCineFilterEndUV(0, 0, 1, 1)
      • Custom script: if udg_FFP_FadeOut then
      • Custom script: call SetCineFilterStartColor(255, 255, 255, 0)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, alpha)
      • Custom script: else
      • Custom script: call SetCineFilterStartColor(255, 255, 255, alpha)
      • Custom script: call SetCineFilterEndColor(255, 255, 255, 0)
      • Custom script: endif
      • Custom script: call SetCineFilterDuration(udg_FFP_Duration)
      • Custom script: call DisplayCineFilter(true)
      • Custom script: endif
Sample usage:
  • Esc For Specific Player
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Fading...
      • Set VariableSet FFP_Player = Player 1 (Red)
      • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\White_mask.blp
      • Set VariableSet FFP_Duration = 2.00
      • Set VariableSet FFP_FadeOut = True
      • Set VariableSet FFP_Transparency = 25.00
      • Trigger - Run FadeForPlayer <gen> (ignoring conditions)
      • Wait 5.00 seconds
      • Set VariableSet FFP_Player = Player 1 (Red)
      • Set VariableSet FFP_Texture = ReplaceableTextures\CameraMasks\White_mask.blp
      • Set VariableSet FFP_Duration = 2.00
      • Set VariableSet FFP_FadeOut = False
      • Set VariableSet FFP_Transparency = 25.00
      • Trigger - Run FadeForPlayer <gen> (ignoring conditions)

I'll attach the sample map too if that helps. :thumbs_up: If you need to customize more of it, such as the color, you can follow the same steps (or feel free to ask here if you get stuck).
You are so helpful man!!! I appreciate the tip to see what a cinematic filter is labelled as in JASS. Thank you for explaining how to use white mask and transparency. I already know its gonna work, so I doubt I'll need any more future help. Thanks again!!! :D

Edit: as expected work perfectly, thanks man
 
Last edited:
Back
Top