classical why does it desync thread :D

Status
Not open for further replies.
Level 4
Joined
Jan 20, 2011
Messages
65
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:
JASS:
if( GetLocalPlayer() == GetOwningPlayer(GetEventDamageSource()) ) then
     call DisplayCineFilter(flagtrue)
endif
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


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
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 :)
 
Last edited:
Level 4
Joined
Jan 20, 2011
Messages
65
i allready saw that CinematicFadeCommonForPlayer which everybody uses, but i suggest that it will disconnect my buddys too since i am useing the same method
 
Level 4
Joined
Jan 20, 2011
Messages
65
here is the map
http://www.megaupload.com/?d=3M1NVNP0
i want it so it doesnt desync anymore
it desyncs after clicking several times on ur tank to damage it, or when turning the engine on and off several times, allways when this fade filter for player is called it 'might' desync^^
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
I get a desync right at the start after a few seconds without any input.

You use

JASS:
function StartSoundForPlayerBJ takes player whichPlayer, sound soundHandle returns nothing
    if (whichPlayer == GetLocalPlayer()) then
        call StartSound(soundHandle)
    endif
endfunction

and

native GetSoundIsPlaying takes sound soundHandle returns boolean

Think hard.
 
Level 4
Joined
Jan 20, 2011
Messages
65
thank you waterknight for helping the newbies to stick to the mapping in order to create awesome maps which might never be popular, but they will resist in the mappers hearts for the rest of their lifes, in 15 years, a youngerster might ask me , "Hey did You ever make a map for a game?!" and then i will say "yes my boy, i indeed made a map in the game Warcraft 3 The Frozen Throne"
 
Level 4
Joined
Jan 20, 2011
Messages
65
lol

i tried to fix it now
but it still desyncs^^

its useing a gamecache to sync the local boolean from GetSoundIsPlaying()

JASS:
function Trig_loop_1fps_Actions takes nothing returns nothing
local integer i = 0
local unit fog

loop
  set fog = udg_MotionGroup[i]
  if( GetUnitTypeId(fog) == 'h003' ) then// peasant lost his target
    if( GetUnitState(udg_Target[GetUnitUserData(fog)], UNIT_STATE_LIFE) <= 0 ) then
      set udg_Target[GetUnitUserData(fog)] = GetPlayerOwndTank(GetOwningPlayer(fog))
    endif
  endif
set i = i + 1
exitwhen udg_MotionGroup[i] == null
endloop

set i = 0
loop
exitwhen i > 11
  if( IsPlayerInForce(Player(i),udg_AllPlayers) ) then
    if( GetLocalPlayer() == Player(i) )then
        call StoreBoolean(udg_SyncCache,"sound", I2S(i) , GetSoundIsPlaying(udg_CurrentlyPlayingMusic[i]))
        call SyncStoredBoolean(udg_SyncCache,"sound",I2S(i) )
    endif
  endif
set i = i + 1
endloop

set i = 0
loop
exitwhen i > 11
    if( IsPlayerInForce(Player(i),udg_AllPlayers) ) then
        if( TimerGetRemaining(udg_MusicTimer[i]) > udg_CurrentWaitTime[i] and not(GetStoredBoolean(udg_SyncCache,"sound",I2S(i))) ) then
            if( udg_TournamentStarted ) then
                if( udg_CurrentlyPlayingMusic[i] == gg_snd_SonicHisWorldLoop ) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_SonicHisWorldLoop )
                elseif( udg_CurrentlyPlayingMusic[i] == gg_snd_SonicHisWorldStart ) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_SonicHisWorldStart )
                  call TimerStart( udg_MusicTimer[i] , GetSoundDuration(gg_snd_SonicHisWorldStart)*0.001 , false , function SonicHisWorldChange )
                elseif( udg_CurrentlyPlayingMusic[i] == gg_snd_MarioBowserFightLoop ) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_MarioBowserFightLoop )
                elseif( udg_CurrentlyPlayingMusic[i] == gg_snd_MarioBowserFightStart ) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_MarioBowserFightStart )
                  call TimerStart( udg_MusicTimer[i] , GetSoundDuration(gg_snd_MarioBowserFightStart)*0.001 , false , function MarioBowserFightChange )
                elseif( udg_CurrentlyPlayingMusic[i] == gg_snd_SonicEscapeCity) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_SonicEscapeCity )
                elseif( udg_CurrentlyPlayingMusic[i] != null ) then
                  call StartChillMusic(i)
                endif
            else
                if( udg_CurrentlyPlayingMusic[i] == gg_snd_SonicWeaponsBedLoop ) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_SonicWeaponsBedLoop )
                elseif( udg_CurrentlyPlayingMusic[i] == gg_snd_SonicWeaponsBedStart ) then
                  call StartSoundForPlayerBJ( Player(i) , gg_snd_SonicWeaponsBedStart )
                  call TimerStart( udg_MusicTimer[i] , GetSoundDuration(gg_snd_SonicWeaponsBedStart)*0.001 , false , function SonicWeaponsBedChange )
                elseif( GetUnitTypeId(GetPlayerOwndTank(Player(i))) == 'h000' ) then
                    call StartAgileMusic(i)
                else
                    call StartChillMusic(i)
                endif
            endif
        endif
    endif
set i = i + 1
endloop

set fog = null
endfunction

//===========================================================================
function InitTrig_loop_OneHalf_fps takes nothing returns nothing
    set gg_trg_loop_OneHalf_fps = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_loop_OneHalf_fps, 2.00 )
    call TriggerAddAction( gg_trg_loop_OneHalf_fps, function Trig_loop_1fps_Actions )
endfunction

i tested with buddy if the syncing works, and over communication we seemd to have the same values
i tested though and it really is this trigger which is causing it (commenting it)
why is it still desyncing? is it possible that maybe sometimes the syncing fails? 1 in 10 times or something? not so secure? someone has other suggestion of fixing this?
Questions over Questions!!!
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
http://www.hiveworkshop.com/forums/triggers-scripts-269/do-code-cause-desync-205042/

+ SyncStoredValue only initializes the sync process but it requires time until the incoming data arrives.

You could keep track of the playing status with a timer or create different sound handles for different players and play them for everybody but locally set volume to 0 who shall not hear it.

Ps: When I looked over your map, I found the script to be very messy. Lack and inconsistency of indents, of separation lines, accumulating stuff in the root (you normally do not put anything in there or hardly), no scopes/libraries/structs (learn vJass) or folders --> do not know where to search your functions and you spread things like the global sound names or object ids here and there, have hard-coded it without the use of custom variables.
 
Last edited:
Level 4
Joined
Jan 20, 2011
Messages
65
ahhhh ok thank you, i can simply put a wait in there? doesnt matter if it happens 2 sec later or so

sorry about the big mess^^ i did not intend that others are needed to work with the code, if u make the mess yourself then its not a mess to urself^^
i might take a look at vjass , but i dont rly think its needed for my purpose^^ as long as the mess is working im happy :)
 
Status
Not open for further replies.
Top