• 🏆 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!

[JASS] Cinematic Fade Filters for 1 player

Status
Not open for further replies.
Level 7
Joined
Dec 8, 2008
Messages
243
Basically, hero dies... screen fades to black over 10 seconds. Hero respawns. (Camera is attached to hero so no need to pan to new location). Screen fades in over 2 seconds.

  • Respawn Blue
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) is A Hero) Equal to True
        • Then - Actions
          • Cinematic - Fade out over 10.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
          • Wait 10.00 seconds
          • Hero - Instantly revive (Dying unit) at (Center of Respawn Point <gen>), Show revival graphics
          • Cinematic - Fade in over 4.50 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
Thats what it looks like as a trigger. Now I need that to work for one single player at a time. I believe its something along these lines.

JASS:
function Trig_Respawn_Red_Conditions takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(0) ) ) then
        return false
    endif
    if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Red_Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Red_Actions takes player whichPlayer, real duration, blendmode bmode, string tex, real red0, real green0, real blue0, real trans0, real red1, real green1, real blue1, real trans1 returns nothing
    if ( Trig_Respawn_Red_Func001C() ) then
    if ( GetLocalPlayer() == whichPlayer ) then
        call SetCineFilterTexture(tex)
        call SetCineFilterBlendMode(bmode)
        call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterEndUV(0, 0, 1, 1)
        call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0))
        call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1))
        call SetCineFilterDuration(duration)
        call DisplayCineFilter(true)
    endif

        call TriggerSleepAction( 10.00 )
        call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Respawn_Point), true )
    else
    endif
endfunction

//===========================================================================
function InitTrig_Respawn_Red takes nothing returns nothing
    set gg_trg_Respawn_Red = CreateTrigger(  )
    call DisableTrigger( gg_trg_Respawn_Red )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Respawn_Red, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Respawn_Red, Condition( function Trig_Respawn_Red_Conditions ) )
    call TriggerAddAction( gg_trg_Respawn_Red, function Trig_Respawn_Red_Actions )
endfunction

I know I can change it by " ( GetLocalPlayer() == whichPlayer )", but I'm not sure which part to change, and I don't know how to set the duration of fade, and where to set the faded type.

Thanks for taking the time to read this. :smile: :3
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Change "dying unit" to triggering unit every time.

I don't think you need a total conversion for this. Try what I give you here (note the changes of "dying unit" and the custom script boxes).

  • Respawn Blue
  • Events
  • Unit - A unit Dies
  • Conditions
    • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Custom script: if GetLocalPlayer()==GetTriggerPlayer() then
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Triggering unit) is A Hero) Equal to True
      • Then - Actions
        • Cinematic - Fade out over 10.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Wait 10.00 seconds
        • Hero - Instantly revive (Triggering unit) at (Center of Respawn Point <gen>), Show revival graphics
        • Cinematic - Fade in over 4.50 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
        • Else - Actions
    • Custom script: endif
 
Purge is right.
Try this;

  • Respawn Blue
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Custom script: local player p = GetTriggerPlayer()
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Then - Actions
      • Custom script: if GetLocalPlayer()== p then
      • Cinematic - Fade out over 10.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Custom script: endif
      • Wait 10.00 seconds
      • Hero - Instantly revive (Triggering unit) at (Center of Respawn Point <gen>), Show revival graphics
      • Custom script: if GetLocalPlayer()== p then
      • Cinematic - Fade in over 4.50 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Custom script: endif
    • Else - Actions
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Fades use timers, it will desync. You have to dissect the filter function and find out the parts that interest you. I have done this before, managing to get something equal to the fade filter. Here's the function you're currently using:
JASS:
function CinematicFadeBJ takes integer fadetype, real duration, string tex, real red, real green, real blue, real trans returns nothing
    if (fadetype == bj_CINEFADETYPE_FADEOUT) then
        call AbortCinematicFadeBJ()  //Destroys a timer. Desync.
        call CinematicFadeCommonBJ(red, green, blue, duration, tex, 100, trans) 
//The above function is the function we're looking for!
 (...)
    endif
endfunction

Since you don't seem to know JASS, I'll just write down the custom scripts for you:
  • Actions
    • Custom script: local player p=GetTriggerPlayer() //This must be the FIRST ACTION
    • Custom script: if GetLocalPlayer()==p then
    • Custom script: call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
    • -------- The above function sets the texture you'll be using. Remember that it must come between the " things. Here are a few other masks, in the order by which they can be found in the list: --------
    • -------- "ReplaceableTextures\\CameraMasks\\White_mask.blp" --------
    • -------- "ReplaceableTextures\\CameraMasks\\HazeFilter_mask.blp" --------
    • -------- "ReplaceableTextures\\CameraMasks\\GroundFog_mask.blp" --------
    • -------- "ReplaceableTextures\\CameraMasks\\HazeAndFogFilter_Mask.blp" --------
    • -------- "ReplaceableTextures\\CameraMasks\\DiagonalSlash_mask.blp" --------
    • -------- "ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp" --------
    • -------- "ReplaceableTextures\\CameraMasks\\Scope_Mask.blp" --------
    • -------- =============================================================================== --------
    • Custom script: call SetCineFilterStartColor( red , green , blue , visible ) //If you are fading in, the visible is 255* here.
    • Custom script: call SetCineFilterEndColor( red , green , blue , visible ) //If you are fading out, the visible is 255* here.
    • -------- Replace «red», «green», «blue» and «visible» for numbers ranging from 0 to 255*. --------
    • -------- «visible» decides the transparency. If you want a filter with 75% transparency, set visible to 64*. By default, it's 0 on the one that is not 255*. --------
    • -------- =============================================================================== --------
    • Custom script: call SetCineFilterDuration(duration)
    • -------- Remember the part that says «fade with Black mask over 2 seconds» Well, the «X seconds» is the duration. If you want 1.5 seconds, replace «duration» with 1.5 (IT'S A DOT, NOT A COMMA!) --------
    • -------- =============================================================================== --------
    • Custom script: call DisplayCineFilter(true)
    • -------- Nothing to change here. This function is constant (never changes regardless of the fade). --------
    • Custom script: endif
    • Custom script: set p=null //This script should come after endif.
Can you please report back? Thank you!
 
Last edited:
Status
Not open for further replies.
Top