Well, as I've seen, Kattana's Handle Variables system is not working anymore, seems too old. It also seems that a good replacement for it is the Vexorian's Table3, but after surfing on lots of webpages, I've found no help or tut about using it. Im pretty new to JASS but if you could help me about this code would be really appreciated.
And It would be cool to learn to use Table3 as it looks very powerful.
This is what I was trying to do with Kattana's system:
EDIT: Ok I'm now using Vexorian's CSData... but when the trigger executes, after the timer finishes, it crashes my Wc3. It's definitely me doing something wrong with the data retrieve... help please :B
EDIT2: Fixed, it was only a noob mistake, changed
And It would be cool to learn to use Table3 as it looks very powerful.
This is what I was trying to do with Kattana's system:
JASS:
function HeroResurrection takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = GetHandleInt(t, "i")
call DestroyTimerDialog( udg_Death_TimerWindow[i] )
call ReviveHeroLoc( udg_Survivor[i], GetRectCenter(gg_rct_WarpStart), true )
call SetUnitManaPercentBJ( udg_Survivor[i], 100 )
set udg_Status_Hunger[i] = 100.00
set udg_Status_Heat[i] = 100.00
call PanCameraToTimedLocForPlayer( Player(i-1), GetRectCenter(gg_rct_WarpStart), 0 )
if (GetLocalPlayer() == Player(i-1)) then
// Use only local code (no net traffic) within this block to avoid desyncs.
call ClearSelection()
call SelectUnit(udg_Survivor[i], true)
endif
//unleak
set t = null
endfunction
function ReviveTimer takes nothing returns nothing
local timer t = CreateTimer()
local timerdialog td = CreateTimerDialog(t)
local integer i = GetPlayerId(GetOwningPlayer(GetDyingUnit()))
set udg_Death_TimerWindow[i+1] = td
call TimerStart( t, 10, false, function HeroResurrection)
call TimerDialogSetTitle(udg_Death_TimerWindow[i+1], GetPlayerName(Player(i)))
call TimerDialogDisplay(udg_Death_TimerWindow[i+1], true)
call SetHandleInt(t, "i", i+1)
//unleak
set t = null
endfunction
EDIT: Ok I'm now using Vexorian's CSData... but when the trigger executes, after the timer finishes, it crashes my Wc3. It's definitely me doing something wrong with the data retrieve... help please :B
JASS:
struct Ress
integer i
endstruct
function HeroResurrection takes nothing returns nothing
local Ress data = GetCSData(GetExpiredTimer())
local timer t = GetExpiredTimer()
local integer i = data.i
call DestroyTimerDialog( udg_Death_TimerWindow[i] )
call ReviveHeroLoc( udg_Survivor[i], GetRectCenter(gg_rct_WarpStart), true )
call SetUnitManaPercentBJ( udg_Survivor[i], 100 )
set udg_Status_Hunger[i] = 100.00
set udg_Status_Heat[i] = 100.00
call PanCameraToTimedLocForPlayer( Player(i-1), GetRectCenter(gg_rct_WarpStart), 0 )
if (GetLocalPlayer() == Player(i-1)) then
// Use only local code (no net traffic) within this block to avoid desyncs.
call ClearSelection()
call SelectUnit(udg_Survivor[i], true)
endif
//unleak
set t = null
call data.destroy()
endfunction
function ReviveTimer takes nothing returns nothing
local timer t = CreateTimer()
local timerdialog td = CreateTimerDialog(t)
local integer i = GetPlayerId(GetOwningPlayer(GetDyingUnit()))
//struct data
local Ress data = Ress.create()
set data.i = i
call SetCSData(t, data)
set udg_Death_TimerWindow[i+1] = td
call TimerStart( t, 10, false, function HeroResurrection)
call TimerDialogSetTitle(udg_Death_TimerWindow[i+1], GetPlayerName(Player(i)))
call TimerDialogDisplay(udg_Death_TimerWindow[i+1], true)
//unleak
set t = null
endfunction
//===========================================================================
function InitTrig_ReviveTimer takes nothing returns nothing
set gg_trg_ReviveTimer = CreateTrigger( )
call DisableTrigger( gg_trg_ReviveTimer )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ReviveTimer, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_ReviveTimer, Condition( function Trig_ReviveTimer_Conditions ) )
call TriggerAddAction( gg_trg_ReviveTimer, function ReviveTimer )
endfunction
EDIT2: Fixed, it was only a noob mistake, changed
local integer i = GetPlayerId(GetOwningPlayer(GetDyingUnit()))
with local integer i = GetPlayerId(GetOwningPlayer(GetDyingUnit()))+1
and its working now. But It would be nice to have a response about the Handle Vars as this is the 1st piece of code I make with those and had to learn it by myself so I'm pretty sure there are some tips I could have from someone with more experience.
Last edited: