Hey there, I am looking to create a trigger that flashes the screen red briefly. So for example when their hero dies the screen flashes red for a second.
Sorry I hope I'm explaining this properly!
I see thanks but is there a way to do it for just one player?
if GetLocalPlayer() == Player(0) then
endif
@DivineLight: Where do your plain pronouncements originate from?
If you use a local block as Xonok shows, do not take the Video - Fade Filter but rather the Video - Advanced Filter action. The first one contains the handling of timers, thus should not be desynced. The latter one at least tries to reset those timers, so avoid Video - Fade Filter altogether to not have them.
Good point, the cinematic actions in GUI are very expansive and thus have a high chance of containing stuff that should be synced.I'm not sure, but I think you have to apply the Fade Filter to everyone, but base the transparency on each player with an array. If you want just player 1 to have the flash, set transparency to 100% for everyone except player 1.
and how you gonna do that?If you want just player 1 to have the flash, set transparency to 100% for everyone except player 1.
Video - Fade Filter is apply global, which means all plyer will see it
and how you gonna do that?
//===========================================================================
function CinematicFadeCommonBJ takes real red, real green, real blue, real duration, string tex, real startTrans, real endTrans returns nothing
if (duration == 0) then
// If the fade is instant, use the same starting and ending values,
// so that we effectively do a set rather than a fade.
set startTrans = endTrans
endif
call EnableUserUI(false)
call SetCineFilterTexture(tex)
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0, 0, 1, 1)
call SetCineFilterEndUV(0, 0, 1, 1)
call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-startTrans))
call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-endTrans))
call SetCineFilterDuration(duration)
call DisplayCineFilter(true)
endfunction
//===========================================================================
function FinishCinematicFadeBJ takes nothing returns nothing
call DestroyTimer(bj_cineFadeFinishTimer)
set bj_cineFadeFinishTimer = null
call DisplayCineFilter(false)
call EnableUserUI(true)
endfunction
//===========================================================================
function FinishCinematicFadeAfterBJ takes real duration returns nothing
// Create a timer to end the cinematic fade.
set bj_cineFadeFinishTimer = CreateTimer()
call TimerStart(bj_cineFadeFinishTimer, duration, false, function FinishCinematicFadeBJ)
endfunction
//===========================================================================
function ContinueCinematicFadeBJ takes nothing returns nothing
call DestroyTimer(bj_cineFadeContinueTimer)
set bj_cineFadeContinueTimer = null
call CinematicFadeCommonBJ(bj_cineFadeContinueRed, bj_cineFadeContinueGreen, bj_cineFadeContinueBlue, bj_cineFadeContinueDuration, bj_cineFadeContinueTex, bj_cineFadeContinueTrans, 100)
endfunction
//===========================================================================
function ContinueCinematicFadeAfterBJ takes real duration, real red, real green, real blue, real trans, string tex returns nothing
set bj_cineFadeContinueRed = red
set bj_cineFadeContinueGreen = green
set bj_cineFadeContinueBlue = blue
set bj_cineFadeContinueTrans = trans
set bj_cineFadeContinueDuration = duration
set bj_cineFadeContinueTex = tex
// Create a timer to continue the cinematic fade.
set bj_cineFadeContinueTimer = CreateTimer()
call TimerStart(bj_cineFadeContinueTimer, duration, false, function ContinueCinematicFadeBJ)
endfunction
//===========================================================================
function AbortCinematicFadeBJ takes nothing returns nothing
if (bj_cineFadeContinueTimer != null) then
call DestroyTimer(bj_cineFadeContinueTimer)
endif
if (bj_cineFadeFinishTimer != null) then
call DestroyTimer(bj_cineFadeFinishTimer)
endif
endfunction
//===========================================================================
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
// Fade out to the requested color.
call AbortCinematicFadeBJ()
call CinematicFadeCommonBJ(red, green, blue, duration, tex, 100, trans)
elseif (fadetype == bj_CINEFADETYPE_FADEIN) then
// Fade in from the requested color.
call AbortCinematicFadeBJ()
call CinematicFadeCommonBJ(red, green, blue, duration, tex, trans, 100)
call FinishCinematicFadeAfterBJ(duration)
elseif (fadetype == bj_CINEFADETYPE_FADEOUTIN) then
// Fade out to the requested color, and then fade back in from it.
if (duration > 0) then
call AbortCinematicFadeBJ()
call CinematicFadeCommonBJ(red, green, blue, duration * 0.5, tex, 100, trans)
call ContinueCinematicFadeAfterBJ(duration * 0.5, red, green, blue, trans, tex)
call FinishCinematicFadeAfterBJ(duration)
endif
else
// Unrecognized fadetype - ignore the request.
endif
endfunction
CinematicFadeBJ
as shown on the previous page.function CinematicFilterGenericBJ takes real duration, blendmode bmode, string tex, real red0, real green0, real blue0, real trans0, real red1, real green1, real blue1, real trans1 returns nothing
call AbortCinematicFadeBJ()
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)
endfunction
CinematicFadeCommonBJ
or call the native functions directly if you do not mind some more jass.Im not asking you.
Did I say " DivineLight, which one of these is Video - Fade Filter"
One way to prevent the desync is to just make it so that you flash the screen for everyone, but all players except one have 100% transparency.
So basically you set a variable to 100%
Then locally change it to 0
Then globally do the flash
Then set variable to 0(To make sure it won't cause a desync later in case the variable is shared)
Ok so is the bellow trigger what you mean? Have I done it right?
The Risen
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to (==) The "Risen"
Actions
Set Filter = 100.00
Custom script: if GetLocalPlayer() == Player(9) then
Set Filter = 0.00
Custom script: endif
Cinematic - Fade out and back in over 2.00 seconds using texture White Mask and color (100.00%, 0.00%, 0.00%) with Filter% transparency
Set Filter = 0.00
Yep, this is it.
Just note that if this is for a spell, you may want to add this line after the filter:
So that certain things, like tooltips, won't be disabled for the duration of the filter. (or just use "Cinematic - Advanced fade filter" instead)
Custom script: call EnableUserUI(true)
You can look at this for more info (which Spartipilo already linked):
http://www.hiveworkshop.com/forums/cinematics-268/tips-tricks-cinema-39854/#F