• 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.

[JASS] Does this cause a Desync?

Status
Not open for further replies.
Level 19
Joined
Oct 12, 2007
Messages
1,821
Heya,

I'm trying to find the cause of my desync. I know it has to do with GetLocalPlayer(), but I can't find my mistake...
I'm not sure, but is this the thing that might be wrong here?:

JASS:
loop
exitwhen i > 8

    if GetLocalPlayer() == Player(i) then
                set Text[i] = CreateTextTag()
    endif
set i = i + 1
endloop
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
JASS:
library lolz initializer init
  
    globals
        texttag array Text
    endglobals

    function test takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen i > 8
            if GetLocalPlayer() == Player(i) then
                set Text[i] = CreateTextTag()
            endif
            set i = i + 1
            call BJDebugMsg(I2S(i))
        endloop
        call BJDebugMsg("end")
    endfunction

    function init takes nothing returns nothing
        call TimerStart(CreateTimer(), 1.00, false, function test)
    endfunction

endlibrary
I tested this code with a friend and nobody desynced so the error might be elsewhere.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Yes that does desync. (i know it for a fact). what you have to do is create the text tag globally than set the text of the text tag locally
 
Yes that does desync. (i know it for a fact). what you have to do is create the text tag globally than set the text of the text tag locally

Texttags have their own handle stack. For whatever reason, this ensures that they can be created locally without any desyncs. (or at least, that is the trait of the objects that are local-creation safe) Same thing for a few other handle types. :)

You can test it on LAN or bnet or w/e, it works.

It's probably something that has to do with you comparing Text[something] and creating handles within the if block.

^This may be the case, because while that code doesn't desync by itself, the data is localized. So if you, for example, check if Text[x] == null and some of them are null while others aren't, then it will perform the code locally.

I recommend that you post the war3map.j, we might be able to find the problem. Or PM it.
 
Level 19
Joined
Oct 12, 2007
Messages
1,821
I found the cause of the desync.
It luckily wasn't this issue with the texttags.
It was something where I locally tried to shake the camera.
 
Status
Not open for further replies.
Top