real reason: it disconnected because i was useing StartSoundForPlayerBJ() and then GetSoundIsPlaying()
one player was playing the sound, the others not, so causing a split at the GetSoundIsPlaying()
the below was not the reason it desyced, just ignore the crap below^^
------------------------------------------------------------
original post:
------------------------------------------------------------
hi, once again i have a problem with desyncing
i just want simple cinematic fade for single players:
it works a few times but eventually it will disconnect my buddys
im calling all the other functions required for cinematic fade without getlocalplayer, for all players, and then the display function only for one
i found on web some examples on how to do this, they do the same as me
found that u need to use local variables for the flag (not sure if its true but it seemd to improved it bit, before it just bam disconnected on first use)
i commented all other parts where i use getlocalplayer to make sure its because of this type of code
this code is scatterd few times over my map, its allways "if getlocal player == blabla then do displaycine with a local variable as the flag"
im guna list the functions where its used, but rly its allways the same type of code, i dont think its connected somehow
this one is called when the unit gets damage
i know i could do something like
but it does not fitt my needs, it will stop the fade for other players or interrupt or whatever :S
i hope there is someone who has smart knowledge about this
one player was playing the sound, the others not, so causing a split at the GetSoundIsPlaying()
the below was not the reason it desyced, just ignore the crap below^^
------------------------------------------------------------
original post:
------------------------------------------------------------
hi, once again i have a problem with desyncing
i just want simple cinematic fade for single players:
JASS:
if( GetLocalPlayer() == GetOwningPlayer(GetEventDamageSource()) ) then
call DisplayCineFilter(flagtrue)
endif
im calling all the other functions required for cinematic fade without getlocalplayer, for all players, and then the display function only for one
i found on web some examples on how to do this, they do the same as me
found that u need to use local variables for the flag (not sure if its true but it seemd to improved it bit, before it just bam disconnected on first use)
i commented all other parts where i use getlocalplayer to make sure its because of this type of code
this code is scatterd few times over my map, its allways "if getlocal player == blabla then do displaycine with a local variable as the flag"
im guna list the functions where its used, but rly its allways the same type of code, i dont think its connected somehow
JASS:
function ScareFade takes player fadeplayer returns nothing
local boolean flagtrue = true
call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Scope_Mask.blp")
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0.38, 0.17 , 0.6, 0.73)
call SetCineFilterEndUV(0.28, 0.1 , 0.7, 0.8)
call SetCineFilterStartColor(0, 0, 0, 0)
call SetCineFilterEndColor(0, 0, 0, 130)
call SetCineFilterDuration(10)
if( GetLocalPlayer() == fadeplayer ) then
call DisplayCineFilter(flagtrue)
endif
endfunction
JASS:
function SwitchTank takes unit switcheru , integer itype , real newangle returns nothing
local integer i = GetUnitUserData(switcheru)
local integer i2
local boolean select = IsUnitSelected(switcheru,GetOwningPlayer(switcheru))
local boolean flagfalse = false
local real angle
local integer playerid = GetPlayerId(GetOwningPlayer(switcheru))
//call BJDebugMsg("1 ST: Player: "+I2S(GetPlayerId(GetOwningPlayer(switcheru)))+" UName: "+GetUnitName(switcheru))
if( switcheru == null ) then
return
endif
call RemoveCollisionGroup(switcheru)
call RemoveSteamTanksGroup(switcheru)
if( newangle != -1 ) then
set angle = newangle
else
set angle = GetUnitFacing(switcheru)
endif
if( GetUnitTypeId(switcheru) == 'h000' ) then
if( itype == 'h000' ) then
call RemoveMotionGroup(switcheru)
call ReplaceTankBJ( switcheru , 'h000' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
call AddMotionGroup(bj_lastReplacedUnit)
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(bj_lastReplacedUnit), bj_lastReplacedUnit , 0, 0, false )
elseif( itype == 'h00D' ) then
if( not(udg_TournamentStarted) and not(udg_PlayerIsInStreetFight[playerid]) ) then
call NonDominantReplaceSoundChill(playerid)
call ScareFade(GetOwningPlayer(switcheru))
endif
call RemoveMotionGroup(switcheru)
call ReplaceTankBJ( switcheru , 'h00D' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
set udg_StaticObject[i] = true
elseif( itype == 'h00J' ) then
if( not(udg_TournamentStarted) and not(udg_PlayerIsInStreetFight[playerid]) ) then
call NonDominantReplaceSoundChill(playerid)
call ScareFade(GetOwningPlayer(switcheru))
endif
call RemoveMotionGroup(switcheru)
call ReplaceTankBJ( switcheru , 'h00J' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
set udg_StaticObject[i] = true
elseif( itype == 'h004' )then
if( not(udg_TournamentStarted) and not(udg_PlayerIsInStreetFight[playerid]) ) then
call NonDominantReplaceSoundChill(playerid)
call ScareFade(GetOwningPlayer(switcheru))
endif
call RemoveMotionGroup(switcheru)
call ReplaceTankBJ( switcheru , 'h004' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
set udg_StaticObject[i] = true
endif
elseif( GetUnitTypeId(switcheru) == 'h004' ) then
if( itype == 'h00J' ) then
call ReplaceTankBJ( switcheru , 'h00J' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h00D' ) then
call ReplaceTankBJ( switcheru , 'h00D' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h004' )then
call ReplaceTankBJ( switcheru , 'h004' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h000' )then
if( not(udg_TournamentStarted) and not(udg_PlayerIsInStreetFight[playerid]) ) then
call NonDominantReplaceSoundAgile(playerid)
if( GetLocalPlayer() == GetOwningPlayer(switcheru) ) then
call DisplayCineFilter(flagfalse)
endif
endif
call ReplaceTankBJ( switcheru , 'h000' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
call AddMotionGroup(bj_lastReplacedUnit)
set udg_StaticObject[i] = false
set udg_xVelocity[i] = 0
set udg_yVelocity[i] = 0
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(bj_lastReplacedUnit), bj_lastReplacedUnit , 0, 0, false )
endif
elseif( GetUnitTypeId(switcheru) == 'h00D' ) then
if( itype == 'h000' ) then
if( not(udg_TournamentStarted) and not(udg_PlayerIsInStreetFight[playerid]) ) then
call NonDominantReplaceSoundAgile(playerid)
if( GetLocalPlayer() == GetOwningPlayer(switcheru) ) then
call DisplayCineFilter(flagfalse)
endif
endif
call ReplaceTankBJ( switcheru , 'h000' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
call AddMotionGroup(bj_lastReplacedUnit)
set udg_StaticObject[i] = false
set udg_xVelocity[i] = 0
set udg_yVelocity[i] = 0
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(bj_lastReplacedUnit), bj_lastReplacedUnit , 0, 0, false )
elseif( itype == 'h00J' )then
call ReplaceTankBJ( switcheru , 'h00J' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h00D' )then
call ReplaceTankBJ( switcheru , 'h00D' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h004' )then
call ReplaceTankBJ( switcheru , 'h004' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
endif
elseif( GetUnitTypeId(switcheru) == 'h00J' ) then
if( itype == 'h000' ) then
if( not(udg_TournamentStarted) and not(udg_PlayerIsInStreetFight[playerid]) ) then
call NonDominantReplaceSoundAgile(playerid)
if( GetLocalPlayer() == GetOwningPlayer(switcheru) ) then
call DisplayCineFilter(flagfalse)
endif
endif
call ReplaceTankBJ( switcheru , 'h000' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
call AddMotionGroup(bj_lastReplacedUnit)
set udg_StaticObject[i] = false
set udg_xVelocity[i] = 0
set udg_yVelocity[i] = 0
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(bj_lastReplacedUnit), bj_lastReplacedUnit , 0, 0, false )
elseif( itype == 'h00J' )then
call ReplaceTankBJ( switcheru , 'h00J' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h00D' )then
call ReplaceTankBJ( switcheru , 'h00D' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
elseif( itype == 'h004' )then
call ReplaceTankBJ( switcheru , 'h004' , bj_UNIT_STATE_METHOD_ABSOLUTE , angle)
endif
endif
// for all types
call AddCollisionGroup(bj_lastReplacedUnit)
call AddSteamTanksGroup(bj_lastReplacedUnit)
call SetUnitUserData(bj_lastReplacedUnit,i)
set udg_UniqueDataUnits[i] = bj_lastReplacedUnit
call SetUnitAbilityLevel( bj_lastReplacedUnit , 'A000' , udg_PeasantAbilityLevel[i] )
call SetUnitTimeScale(bj_lastReplacedUnit,udg_TankSpeed[i]*10+0.15 )
if( GetPlayerTechCount(GetOwningPlayer(bj_lastReplacedUnit),'R000',true) == 0) then
call UnitRemoveAbility(bj_lastReplacedUnit,'A001')
endif
if( select ) then
call SelectUnitAddForPlayer(bj_lastReplacedUnit,GetOwningPlayer(bj_lastReplacedUnit))
endif
call TriggerExecute(udg_UpdateDamageEventTriggerFix)
endfunction
this one is called when the unit gets damage
JASS:
function Trig_TankGetsDamage_Actions takes nothing returns nothing
local player tempp = GetOwningPlayer(GetTriggerUnit())
local integer userdata = GetUnitUserData(GetTriggerUnit())
local unit fog
local unit tank
local boolean flagtrue = true
local boolean flagfalse = false
if( userdata != -1 ) then
if( GetUnitState(GetTriggerUnit(),UNIT_STATE_LIFE)-GetEventDamage() <= 0 ) then
call SetUnitState(GetTriggerUnit(),UNIT_STATE_LIFE,GetEventDamage()+1)
if( GetTriggeringTrigger() == gg_trg_UnitDies ) then
call SwitchTank(GetTriggerUnit(),GetUnitTypeId(GetTriggerUnit()),-1)
set tank = bj_lastReplacedUnit
else
set tank = GetTriggerUnit()
endif
if( udg_TankIsInvulnerable[GetPlayerId(tempp)] ) then
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPos(bj_lastCreatedTextTag,GetUnitX(tank),GetUnitY(tank),30)
call SetTextTagText(bj_lastCreatedTextTag,"indestructible",0.015)
call SetTextTagColor(bj_lastCreatedTextTag,255,255,0,255)
call SetTextTagPermanent(bj_lastCreatedTextTag,false)
call SetTextTagLifespan(bj_lastCreatedTextTag,1)
call SetTextTagFadepoint(bj_lastCreatedTextTag,0)
call SetTextTagVisibility(bj_lastCreatedTextTag,true)
elseif( not(udg_TankIsDead[GetPlayerId(tempp)]) ) then
if( GetTriggeringTrigger() == gg_trg_UnitDies ) then
set fog = GetKillingUnit()
else
set fog = GetEventDamageSource()
endif
call StopSound( udg_CurrentlyPlayingMusic[GetPlayerId(GetOwningPlayer(fog))] , false , true )
set udg_CurrentWaitTime[GetPlayerId(GetOwningPlayer(fog))] = 4
call TimerStart( udg_MusicTimer[GetPlayerId(GetOwningPlayer(fog))] , GetSoundDuration(gg_snd_DbzPride)*0.001+4 , false , function DetermineMusic )
call StartSoundForPlayerBJ(GetOwningPlayer(fog),gg_snd_DbzPride)
set udg_CurrentlyPlayingMusic[GetPlayerId(GetOwningPlayer(fog))] = gg_snd_DbzPride
if( udg_PlayerIsInStreetFight[GetPlayerId(GetOwningPlayer(fog))] ) then
call PauseTimer(udg_StreetFightTimer[GetPlayerId(GetOwningPlayer(fog))])
set udg_PlayerIsInStreetFight[GetPlayerId(GetOwningPlayer(fog))] = false
endif
if( udg_PlayerIsInStreetFight[GetPlayerId(tempp)] ) then
call PauseTimer(udg_StreetFightTimer[GetPlayerId(tempp)])
set udg_PlayerIsInStreetFight[GetPlayerId(tempp)] = false
call PauseTimer(udg_MusicTimer[GetPlayerId(tempp)])
call StopSound( udg_CurrentlyPlayingMusic[GetPlayerId(tempp)] , false , true )
set udg_CurrentlyPlayingMusic[GetPlayerId(tempp)] = null
endif
call TankGotKilled(tank)
call TriggerSleepAction(9)
if( IsPlayerInForce( tempp , udg_AllPlayers) )then
call StopSound( udg_CurrentlyPlayingMusic[GetPlayerId(tempp)] , false , true )
set udg_CurrentWaitTime[GetPlayerId(tempp)] = 10
call TimerStart( udg_MusicTimer[GetPlayerId(tempp)] , GetSoundDuration(gg_snd_YunasBallade)*0.001+10 , false , function DetermineMusic )
call StartSoundForPlayerBJ(tempp,gg_snd_YunasBallade)
set udg_CurrentlyPlayingMusic[GetPlayerId(tempp)] = gg_snd_YunasBallade
endif
call TriggerSleepAction(5)
call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0, 0, 1, 1)
call SetCineFilterEndUV(0, 0, 1, 1)
call SetCineFilterStartColor(255, 255, 255, 0)
call SetCineFilterEndColor(255, 255, 255, 255)
call SetCineFilterDuration(4)
if( udg_TournamentStarted ) then
call EnableUserUI(flagfalse)
call DisplayCineFilter(flagtrue)
else
if( GetLocalPlayer() == tempp )then
call DisplayCineFilter(flagtrue)
endif
endif
call TriggerSleepAction(4)
if( IsPlayerInForce( tempp , udg_AllPlayers) )then
call ReviveTank(GetPlayerOwndTank(tempp))
endif
call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0, 0, 1, 1)
call SetCineFilterEndUV(0, 0, 1, 1)
call SetCineFilterStartColor(255, 255, 255, 255)
call SetCineFilterEndColor(255, 255, 255, 0)
call SetCineFilterDuration(2)
if( udg_TournamentStarted ) then
call EnableUserUI(flagtrue)
call DisplayCineFilter(flagtrue)
set udg_TournamentPlayersAreFighting = false
else
if( GetLocalPlayer() == tempp )then
call DisplayCineFilter(flagtrue)
endif
endif
if( udg_TournamentFightingPlayers[0] == tempp) then
if( IsPlayerInForce( tempp , udg_AllPlayers) )then
call ForceAddPlayer( udg_TournamentLoserForce , udg_TournamentFightingPlayers[0])
endif
call ForceAddPlayer( udg_TournamentWinnerForce , udg_TournamentFightingPlayers[1])
set udg_TournamentFightingPlayers[0] = null
set udg_TournamentFightingPlayers[1] = null
call TriggerExecute(udg_StartTournamentTriggerFix)//call StartTournamentLobby()
elseif( udg_TournamentFightingPlayers[1] == tempp) then
if( IsPlayerInForce( tempp , udg_AllPlayers) )then
call ForceAddPlayer( udg_TournamentLoserForce , udg_TournamentFightingPlayers[1])
endif
call ForceAddPlayer( udg_TournamentWinnerForce , udg_TournamentFightingPlayers[0])
set udg_TournamentFightingPlayers[0] = null
set udg_TournamentFightingPlayers[1] = null
call TriggerExecute(udg_StartTournamentTriggerFix)//call StartTournamentLobby()
endif
call TriggerSleepAction(10)
call DestroyEffect(udg_TankExplodeNuclearEffect[GetPlayerId(tempp)])
endif
else
call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Scope_Mask.blp")
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0.38, 0.17 , 0.6, 0.73)
call SetCineFilterEndUV(0.28, 0.1 , 0.7, 0.8)
call SetCineFilterStartColor(255, 0, 0, 255)
call SetCineFilterEndColor(255, 0, 0, 0)
call SetCineFilterDuration(1)
if( not(udg_TankIsDead[GetPlayerId(tempp)]) ) then
if( not(udg_TournamentStarted) ) then
if( not(udg_PlayerIsInStreetFight[GetPlayerId(tempp)]) ) then
set udg_PlayerIsInStreetFight[GetPlayerId(tempp)] = true
call StopSound( udg_CurrentlyPlayingMusic[GetPlayerId(tempp)] , false , true )
set udg_CurrentWaitTime[GetPlayerId(tempp)] = -1
call TimerStart( udg_MusicTimer[GetPlayerId(tempp)] , GetSoundDuration(gg_snd_SonicWeaponsBedStart)*0.001 , false , function SonicWeaponsBedChange )
call StartSoundForPlayerBJ(tempp,gg_snd_SonicWeaponsBedStart)
set udg_CurrentlyPlayingMusic[GetPlayerId(tempp)] = gg_snd_SonicWeaponsBedStart
endif
call TimerStart( udg_StreetFightTimer[GetPlayerId(tempp)] , 20 , false , function EndStreetFight )
endif
if( GetLocalPlayer() == tempp ) then
call DisplayCineFilter(flagtrue)
endif
endif
if( not(udg_TankIsDead[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))]) ) then
if( not(udg_TournamentStarted) ) then
if( not(udg_PlayerIsInStreetFight[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))]) ) then
set udg_PlayerIsInStreetFight[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))] = true
call StopSound( udg_CurrentlyPlayingMusic[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))] , false , true )
set udg_CurrentWaitTime[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))] = -1
call TimerStart( udg_MusicTimer[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))] , GetSoundDuration(gg_snd_SonicWeaponsBedStart)*0.001 , false , function SonicWeaponsBedChange )
call StartSoundForPlayerBJ(GetOwningPlayer(GetEventDamageSource()),gg_snd_SonicWeaponsBedStart)
set udg_CurrentlyPlayingMusic[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))] = gg_snd_SonicWeaponsBedStart
endif
call TimerStart( udg_StreetFightTimer[GetPlayerId(GetOwningPlayer(GetEventDamageSource()))] , 20 , false , function EndStreetFight )
endif
if( GetLocalPlayer() == GetOwningPlayer(GetEventDamageSource()) ) then
call DisplayCineFilter(flagtrue)
endif
endif
endif
endif
set tank = null
set tempp = null
set fog = null
endfunction
i know i could do something like
JASS:
if( GetLocalPlayer() == someplayer ) then
call DisplayCineFilter(flagtrue)
else
call DisplayCineFilter(flagfalse)
endif
i hope there is someone who has smart knowledge about this
Last edited: