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