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

how to diagnose a desync cause

Status
Not open for further replies.
Level 7
Joined
Nov 18, 2012
Messages
312
My map just went for alpha testing, first time tested in multiplayers.
Apparently it causes a desync which I totally don't know how it happened..

so.. how to diagnose a desync cause?

Is it only when a function extends a handle and it is used not for everyone, it would cause desync?
 
Level 7
Joined
Nov 18, 2012
Messages
312
Hi, thanks for replying, I will Try to deterministically trigger the symptom and isolate it from innocent contents.
Any specificity ?
I would normally disable a trigger and check one by one but it takes too long..
 

Deleted member 219079

D

Deleted member 219079

When saving map, JNGP dumps the map script into war3map.j inside JNGP - folder.

Open that file, you can find spots where you have used GetLocalPlayer() with text editor (Ctrl+F).
 
Level 7
Joined
Nov 18, 2012
Messages
312
I think this caused it to desync.
What I wanted was to use customdefeatbj on the player controlling the unit who died.

JASS:
globals
trigger playerunitdeath
endglobals
//**************************************************************
//*
//*   RegisterPlayerUnitEvent (Vanilla Jass)
//*   v5.1.0.1
//*   By Magtheridon96
//*
//*   I would like to give a special thanks to Bribe, azlier
//*   and BBQ for improving this library. For modularity, it only
//*   supports player unit events.
//*
//*   Functions passed to RegisterPlayerUnitEvent must either
//*   return a boolean (false) or nothing. (Which is a Pro)
//*
//*   Implementation:
//*   ---------------
//*
//*       - Copy all this script into a new trigger called "RegisterPlayerUnitEvent Jass"
//*       - Create a trigger array variable called RPUE.
//*       - Done.
//*
//*   Warning:
//*   --------
//*
//*       - Don't use TriggerSleepAction inside registered code.
//*       - Don't destroy a trigger unless you really know what you're doing.
//*
//*   API:
//*   ----
//*
//*       - function RegisterPlayerUnitEvent takes playerunitevent whichEvent, code whichFunction returns nothing
//*           - Registers code that will execute when an event fires.
//*       - function RegisterPlayerUnitEventForPlayer takes playerunitevent whichEvent, code whichFunction, player whichPlayer returns nothing
//*           - Registers code that will execute when an event fires for a certain player.
//*       - function GetPlayerUnitEventTrigger takes playerunitevent whichEvent returns trigger
//*           - Returns the trigger corresponding to ALL functions of a playerunitevent.
//*
//**************************************************************

function RegisterPlayerUnitEvent takes playerunitevent p, code c returns nothing
    local integer i = GetHandleId(p)
    local integer k = 8
    if udg_RPUE[i] == null then
        set udg_RPUE[i] = CreateTrigger()
        loop
            call TriggerRegisterPlayerUnitEvent(udg_RPUE[i], Player(k), p, null)
            exitwhen k == 0
            set k = k - 1
        endloop
    endif
    call TriggerAddCondition(udg_RPUE[i], Filter(c))
endfunction

function RegisterPlayerUnitEventForPlayer takes playerunitevent p, code c, player pl returns nothing
    local integer i = 16 * GetHandleId(p) + GetPlayerId(pl)
    if udg_RPUE[i] == null then
        set udg_RPUE[i] = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent(udg_RPUE[i], pl, p, null)
    endif
    call TriggerAddCondition(udg_RPUE[i], Filter(c))
endfunction

function GetPlayerUnitEventTrigger takes playerunitevent p returns trigger
    return udg_RPUE[GetHandleId(p)]
endfunction
function UnitDeathAction takes nothing returns nothing
local trigger t2t=GetTriggeringTrigger()
loop
exitwhen t2t==null
call TriggerExecute(t2t)
call DestroyTrigger(t2t)
set t2t=CreateTrigger()
endloop
set t2t=null
endfunction

function KickAction takes nothing returns nothing
call CustomDefeatBJ(GetTriggerPlayer(),"Unfortunately, you died.")
endfunction
function kickboolean takes nothing returns boolean
return IsPlayerEnemy(Player(GetPlayerId(GetTriggerPlayer())),Player(11))
endfunction
/////////////////////////////
function RegisterDeath takes nothing returns nothing
local integer i =0
set playerunitdeath = CreateTrigger()
loop
exitwhen i>9
call TriggerRegisterPlayerUnitEvent(playerunitdeath,Player(i),EVENT_PLAYER_UNIT_DEATH, Condition(function kickboolean))
set i=i+1
endloop 
set i=0
call TriggerAddAction(playerunitdeath,function KickAction )
endfunction
 
Status
Not open for further replies.
Top