- Joined
- Aug 11, 2009
- Messages
- 22
Hi,
I made a very straight forward trigger with JASS, using a timer and a hashtable to transfer information from one action to another. However it doesn't save the unithandles I created. I'm fairly inexperienced with hashtables so bare with me if it's something obvious.
Here is the code:
I left out some parts of the code, which work fine. The call KillUnit in the TimerExpired action is only there to test it quickly. What did I do wrong?
I made a very straight forward trigger with JASS, using a timer and a hashtable to transfer information from one action to another. However it doesn't save the unithandles I created. I'm fairly inexperienced with hashtables so bare with me if it's something obvious.
Here is the code:
JASS:
function Reset takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_Hashtable, GetHandleId(t), 0)
local integer lvl = GetUnitAbilityLevel(u , 'A023')
call KillUnit(u)
call AddUnitAnimationProperties(u, "Attack Walk Spin", false)
call EnableTrigger(gg_trg_Bladestorm_Reset)
call PauseTimer(t)
call DestroyTimer(t)
set t = null
endfunction
function Trig_Bladestorm_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location loc = GetUnitLoc(caster)
local integer level = GetUnitAbilityLevel(caster, GetSpellAbilityId())
local real damage = level * 80 + GetHeroStr(caster, true)
local group targets = CreateGroup()
local unit fog
local timer t = CreateTimer()
call AddUnitAnimationProperties(caster, "Attack Walk Spin", true)
call BJDebugMsg(R2S(damage))
call GroupEnumUnitsInRangeOfLoc(targets, loc, 220., Filter(function Enum))
call DisableTrigger(gg_trg_Bladestorm_Reset)
call SaveUnitHandle(udg_Hashtable, GetHandleId(t), 0, caster)
call TimerStart(t, .3, false, function Reset)
I left out some parts of the code, which work fine. The call KillUnit in the TimerExpired action is only there to test it quickly. What did I do wrong?
