- Joined
- Jul 20, 2009
- Messages
- 835
Hey, I've got a problem. My group disappears somehow and don't show in the timer (function TidalFuryMove_Actions). What's the problem?
JASS:
function TidalFuryCast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 0x41303157
endfunction
function TidalFuryCast_Group3 takes nothing returns nothing
call PauseUnit(GetEnumUnit(),false)
endfunction
function TidalFuryCast_Part4 takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
local group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),2)
local timer t2 = LoadTimerHandle(udg_Hashtable,GetHandleId(t),1)
call BJDebugMsg("GHID: " + I2S(GetHandleId(g)))
call BJDebugMsg("TID: " + I2S(GetHandleId(t2)))
call PauseTimer(t2)
call DestroyTimer(t2)
call ForGroup(g,function TidalFuryCast_Group3)
call RemoveUnit(dummy)
call GroupClear(g)
call DestroyGroup(g)
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set t = null
set dummy = null
set g = null
set t2 = null
endfunction
function TidalFuryCast_Group2 takes nothing returns nothing
local unit e = GetEnumUnit()
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),3)
local integer lvl = GetUnitAbilityLevel(caster,0x41303157)
local integer lvl2 = GetUnitAbilityLevel(caster,0x41303154)
local real dmg = GetUnitState(e,UNIT_STATE_LIFE) * 5 * lvl2 / 100 + 100 * lvl
call SetUnitFlyHeight(e,0,500)
call UnitDamageTarget(caster,e,dmg,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DIVINE,WEAPON_TYPE_WHOKNOWS)
set caster = null
set e = null
endfunction
function TidalFuryCast_Part3 takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(t),3)
local group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),2)
local timer t3 = LoadTimerHandle(udg_Hashtable,GetHandleId(t),1)
local timer t2 = CreateTimer()
call ShowUnit(dummy,false)
call BJDebugMsg("3 - TID: " + I2S(GetHandleId(t2)))
call BJDebugMsg("3 - GHID: " + I2S(GetHandleId(g)))
call PauseTimer(t3)
call DestroyTimer(t3)
call ForGroup(g,function TidalFuryCast_Group2)
call SaveTimerHandle(udg_Hashtable,GetHandleId(t2),1,t3)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t2),0,dummy)
call SaveGroupHandle(udg_Hashtable,GetHandleId(t2),1,g)
call TimerStart(t2,0.5,false,function TidalFuryCast_Part4)
call GroupClear(g)
call DestroyGroup(g)
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set t = null
set g = null
set dummy = null
set caster = null
set t2 = null
set t3 = null
endfunction
function TidalFuryMoveGroup takes nothing returns nothing
local unit e = GetEnumUnit()
local real x = GetUnitX(e)
local real y = GetUnitY(e)
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),0)
local real x2 = GetUnitX(dummy)
local real y2 = GetUnitY(dummy)
call SetUnitX(e,x - 15 * Cos(Atan2(y2 - y,x2 - x)))
call SetUnitY(e,y - 15 * Sin(Atan2(y2 - y,x2 - x)))
if x >= udg_MaxX then
call SetUnitX(e,udg_MaxX)
endif
if x <= udg_MinX then
call SetUnitX(e,udg_MinX)
endif
if y >= udg_MaxY then
call SetUnitY(e,udg_MaxY)
endif
if y <= udg_MinY then
call SetUnitY(e,udg_MinY)
endif
set dummy = null
set e = null
endfunction
function TidalFuryMove_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
local group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),1)
call ForGroup(g,function TidalFuryMoveGroup)
//call GroupClear(g)
//call DestroyGroup(g)
set g = null
endfunction
function TidalFuryCast_Part2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
local group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),1)
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(t),3)
local timer t2 = CreateTimer()
local timer t3 = CreateTimer()
call SaveUnitHandle(udg_Hashtable,GetHandleId(t2),0,dummy)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t3),0,dummy)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t3),3,caster)
call SaveTimerHandle(udg_Hashtable,GetHandleId(t3),1,t2)
call SaveGroupHandle(udg_Hashtable,GetHandleId(t3),2,g)
call SaveGroupHandle(udg_Hashtable,GetHandleId(t2),1,g)
call TimerStart(t2,0.05,true,function TidalFuryMove_Actions)
call TimerStart(t3,0.3,false,function TidalFuryCast_Part3)
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set t = null
set caster = null
set dummy = null
set t2 = null
set t3 = null
set g = null
endfunction
function TidalUltFilt takes nothing returns boolean
local unit f = GetFilterUnit()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),0)
local group g = LoadGroupHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),1)
if GetUnitAbilityLevel(f,0x41303749) == 0 and IsUnitEnemy(f,GetOwningPlayer(dummy)) and IsUnitType(f,UNIT_TYPE_DEAD) == false and IsUnitType(f,UNIT_TYPE_STRUCTURE) == false then
call GroupAddUnit(g,f)
call SaveGroupHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),1,g)
call PauseUnit(f,true)
call UnitAddAbility(f,0x416D7266)
call UnitRemoveAbility(f,0x416D7266)
call SetUnitFlyHeight(f,300,600)
endif
set dummy = null
set g = null
set f = null
return false
endfunction
function TidalFuryCast_Group takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(t),3)
local group g = CreateGroup()
local timer t2 = CreateTimer()
call GroupEnumUnitsInRange(g,GetUnitX(dummy),GetUnitY(dummy),500,Filter(function TidalUltFilt))
call TimerStart(t2,0.5,false,function TidalFuryCast_Part2)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t2),0,dummy)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t2),3,caster)
call SaveGroupHandle(udg_Hashtable,GetHandleId(t2),1,LoadGroupHandle(udg_Hashtable,GetHandleId(t),1))
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call GroupClear(g)
call DestroyGroup(g)
call DestroyTimer(t)
set dummy = null
set caster = null
set t2 = null
set t = null
set g = null
endfunction
function TidalFuryCast_Actions takes nothing returns nothing
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit tidecaster = GetTriggerUnit()
local timer t = CreateTimer()
local unit dummy = CreateUnit(GetOwningPlayer(tidecaster),0x6E303052,x,y,GetUnitFacing(tidecaster))
if udg_Hashtable == null then
set udg_Hashtable = InitHashtable()
endif
call SetUnitVertexColor(dummy,80,80,100,70)
call SetUnitAnimationByIndex(dummy,3)
call SetUnitFlyHeight(dummy,0,900.)
call TerrainDeformRipple(x,y,600,64,1000,1,2,2,1,false)
call SetUnitAbilityLevel(dummy,0x4130314F,GetUnitAbilityLevel(tidecaster,0x41303157))
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),0,dummy)
call SaveGroupHandle(udg_Hashtable,GetHandleId(t),1,CreateGroup())
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),3,tidecaster)
call TimerStart(t,0.01,false,function TidalFuryCast_Group)
set t = null
set dummy = null
set tidecaster = null
endfunction
//===========================================================================
function InitTrig_TidalFuryCast takes nothing returns nothing
local trigger TidalFuryCast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( TidalFuryCast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( TidalFuryCast, Condition( function TidalFuryCast_Conditions ) )
call TriggerAddAction(TidalFuryCast, function TidalFuryCast_Actions )
set TidalFuryCast=null
endfunction