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

[vJASS] Desync Question

Status
Not open for further replies.
Level 16
Joined
Mar 3, 2006
Messages
1,564
From a thread by shadowvzs

11. Trackables, for 1-2 player only?

Question - this cause desyncronization?
Answer - No - tested myself

I have tested it using kLoader and the second player got disconnected.

My script is this:

JASS:
//========================   TEXT MACROS BLOCK   ========================
    //! textmacro action_block takes TYPE , CALLCODE
        if chatString == "$TYPE$" then
            call $CALLCODE$
        endif
    //! endtextmacro

    //! textmacro event_block takes TYPE
        call TriggerRegisterPlayerChatEvent(test,Player(0),"$TYPE$",true)
    //! endtextmacro
//=======================================================================
globals
    player testingPlayer = Player(0)
    string trackablePath = "units\\nightelf\\Wisp\\Wisp.mdl"
endglobals

function test_Actions takes nothing returns nothing
    local string chatString = GetEventPlayerChatString()
    if ( GetLocalPlayer() == testingPlayer ) then
//! runtextmacro action_block("unit","CreateUnit(Player(15),'hpea',0,0,0)")
//! runtextmacro action_block("item","CreateItem('gomn',0,0)")
//! runtextmacro action_block("trackable","CreateTrackable(trackablePath,0,0,0)")
//! runtextmacro action_block("itemVis","SetItemVisible(gg_item_lmbr_0002,false)")
    endif
endfunction

function desyncTest takes nothing returns nothing
    local trigger test = CreateTrigger()
//! runtextmacro event_block("unit")
//! runtextmacro event_block("item")
//! runtextmacro event_block("trackable")
//! runtextmacro event_block("itemVis")
    call TriggerAddAction( test , function test_Actions )
endfunction
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
You're creating handles locally, what did you expect? :)

EDIT: this is how you create trackables visible for only certain players:

JASS:
local string s=""

if GetLocalPlayer()==MyPlayer then
    set s="Mytrackablepath.mdl"
endif

call CreateTrackable(s,0,0,0)
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
You're creating handles locally, what did you expect? :)

EDIT: this is how you create trackables visible for only certain players:

JASS:
local string s=""

if GetLocalPlayer()==MyPlayer then
    set s="Mytrackablepath.mdl"
endif

call CreateTrackable(s,0,0,0)

Of course it has to be locally, otherwise I am creating a trackable with no model. I intended it to be like that to test desync. What you are saying is a cross-over for this problem.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Yea, creating handles locally should desync :)

I don't quite understand what the question is here then.

I first created my script then searched the site until I found that he is saying "no desync" so I wanted to check what is wrong.

And since I am checking the functions that will cause desync I am using the functions directly without any desync-solving-cross-over techniques.

Anyway, thanks.
 
Status
Not open for further replies.
Top