• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

Where's the group?

Status
Not open for further replies.
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
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Are you sure it is correctly created in the first place? Your use of EnumUnitsInRange amazes me, why don't you use it as you are supposed to? (=return true for units that fulfill the condition)
Also, you could use the same timer over and over, instead of copying the entire data between fields in hashtables all the time.
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
I realize that, but you don't need to create a new timer on each step, you can use the same timer and just start it again with different function in parameter, and that way you don't need to load the entire data from the hashtable and save it under another ID.

Also, you clear and destroy the group in part3, and try to use it again in part 4.
And the filter should look like this:
JASS:
function TidalUltFilt takes nothing returns boolean
    local unit f = GetFilterUnit()
    local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),0)
    local boolean doAdd = false
    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
        set doAdd = true
//        call PauseUnit(f,true)
//        call UnitAddAbility(f,0x416D7266)
//        call UnitRemoveAbility(f,0x416D7266)
//        call SetUnitFlyHeight(f,300,600)    
    endif
    set dummy = null
    set f = null
    return doAdd
endfunction
Also, the part are commented out should be run in a separate ForGroup, running them in filter is ugly.
Then just use the group g (which you run the EnumUnitsInGroup on) for further actions, instead of creating a new one and copying all the units i there manually)
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
JASS:
function TidalUltFilt takes nothing returns boolean
    local unit f = GetFilterUnit()
    local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),0)
    local boolean doAdd = false
    set doAdd =(  GetUnitAbilityLevel(f,0x41303749) == 0 and IsUnitEnemy(f,GetOwningPlayer(dummy)) and not IsUnitType(f,UNIT_TYPE_DEAD) and not IsUnitType(f,UNIT_TYPE_STRUCTURE) )
    set dummy = null
    set f = null
    return doAdd
endfunction

function TidalFury_InitGroup takes nothing returns nothing
    set f = GetEnumUnit()
    call PauseUnit(f,true)
    call UnitAddAbility(f,0x416D7266)
    call UnitRemoveAbility(f,0x416D7266)
    call SetUnitFlyHeight(f,300,600)
    set f = null
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()
    
    call GroupEnumUnitsInRange(g,GetUnitX(dummy),GetUnitY(dummy),500,Filter(function TidalUltFilt))
    call ForGroup(g, function TidalFury_InitGroup)
    call SaveGroupHandle(udg_Hashtable,GetHandleId(t),1,g)
    call TimerStart(t,0.5,false,function TidalFuryMove_Actions)

    set dummy = null
    set t = null
    set g = null
endfunction
Also remove this line from TidaFuryCast_Actions:
call SaveGroupHandle(udg_Hashtable,GetHandleId(t),1,CreateGroup())

EDIT: modified TidalFuryCast_Group, and added this: (I removed the entire part 2 in the process)
JASS:
function TidalFuryMove_Actions takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),1)
    call ForGroup(g,function TidalFuryMoveGroup)
    call TimerStart(t,0.3,false,function TidalFuryCast_Part3)
    set t = null
    set g = null
endfunction

EDIT 2: modified part 3 and 4 (I am not sure whether it is necessary to clear group before destroying, but I left it there)
JASS:
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)
    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
endfunction

function TidalFuryCast_Part3 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)
    call ShowUnit(dummy,false)
    call ForGroup(g,function TidalFuryCast_Group2)
    call TimerStart(t,0.5,false,function TidalFuryCast_Part4)
    set t = null
    set g = null
    set dummy = null
endfunction

Now just put the parts together :grin: (the functions I didn't post I didn't modify, with the exception of part 2, which was removed)
 
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)
    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
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 group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),2)
    call ShowUnit(dummy,false)
    call ForGroup(g,function TidalFuryCast_Group2)
    call TimerStart(t,0.5,false,function TidalFuryCast_Part4)
    set t = null
    set g = null
    set dummy = 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 group g = LoadGroupHandle(udg_Hashtable,GetHandleId(t),1)
    call ForGroup(g,function TidalFuryMoveGroup)
    call TimerStart(t,0.3,false,function TidalFuryCast_Part3)
    set t = 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 boolean doAdd = false
    set doAdd =(  GetUnitAbilityLevel(f,0x41303749) == 0 and IsUnitEnemy(f,GetOwningPlayer(dummy)) and not IsUnitType(f,UNIT_TYPE_DEAD) and not IsUnitType(f,UNIT_TYPE_STRUCTURE) )
    set dummy = null
    set f = null
    return doAdd
endfunction

function TidalFury_InitGroup takes nothing returns nothing
    local unit f = GetEnumUnit()
    call PauseUnit(f,true)
    call UnitAddAbility(f,0x416D7266)
    call UnitRemoveAbility(f,0x416D7266)
    call SetUnitFlyHeight(f,300,600)
    set f = null
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()
    
    call GroupEnumUnitsInRange(g,GetUnitX(dummy),GetUnitY(dummy),500,Filter(function TidalUltFilt))
    call ForGroup(g, function TidalFury_InitGroup)
    call SaveGroupHandle(udg_Hashtable,GetHandleId(t),1,g)
    call TimerStart(t,0.5,false,function TidalFuryMove_Actions)

    set dummy = 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 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

It loses the group after lifting it up in the sky.... hmm...
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Hmm... very strange. Try loading some other data from hashtable (caster and dummy) and testing if they are null, too. Also, that seems really stupid, try printing the "GetHandleId(t)" in each of the functions, to see whether it always returns the same number.
Or try timing the move to 0.0 instead of 0.5, if there would be a difference (maybe there is some other trigger that flushes hashtable in this 0.5 seconds?)
 
JASS:
function TidalFuryMoveGroup takes nothing returns nothing
local unit e=GetEnumUnit()
local real x=GetUnitX(e)
local real y=GetUnitY(e)
local real x2=GetUnitX(udg_WaterFurySpirit[0])
local real y2=GetUnitY(udg_WaterFurySpirit[0])
call SetUnitX(e,x-15.*Cos(AngleBetweenCoords(x,y,x2,y2)))
call SetUnitY(e,y-15.*Sin(AngleBetweenCoords(x,y,x2,y2)))
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 e=null
endfunction

function TidalUltFilt takes nothing returns boolean
local unit f=GetFilterUnit()
return GetUnitAbilityLevel(f,0x41303749)==0 and IsUnitEnemy(f,GetOwningPlayer(udg_WaterFurySpirit[0])) and GetUnitState(f,UNIT_STATE_LIFE)>0.00 and IsUnitType(f,UNIT_TYPE_STRUCTURE)==false
set f=null
endfunction

function TidalFuryMove_Actions takes nothing returns nothing
call ForGroup(udg_WaterFuryGroup[0],function TidalFuryMoveGroup )
endfunction

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_Group2 takes nothing returns nothing
local unit q=GetSpellAbilityUnit()
local integer lvl=GetUnitAbilityLevel(q,0x41303157)
local integer lvl2=GetUnitAbilityLevel(q,0x41303154)
call SetUnitFlyHeight(GetEnumUnit(),0.00,500.)
call UnitDamageTarget(q,GetEnumUnit(),((GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE)*((5*lvl2)/100.00)+100*lvl)),true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DIVINE,WEAPON_TYPE_WHOKNOWS)
set q=null
endfunction

function TidalFuryCast_Group takes nothing returns nothing
local unit e=GetEnumUnit()
call GroupAddUnit(udg_WaterFuryGroup[0],e)
call PauseUnit(e,true)
call UnitAddAbility(e,0x416D7266)
call UnitRemoveAbility(e,0x416D7266)
call SetUnitFlyHeight(e,300.,600.)
endfunction

function TidalFuryCast_Actions takes nothing returns nothing
local real x=GetLocationX(GetSpellTargetLoc())
local real y=GetLocationY(GetSpellTargetLoc())
local unit tidecaster=GetSpellAbilityUnit()
local timer t=CreateTimer()
local group g=CreateGroup()
set udg_WaterFurySpirit[0]=CreateUnit(GetOwningPlayer(tidecaster),0x6E303052,x,y,GetUnitFacing(tidecaster))
call SetUnitVertexColor(udg_WaterFurySpirit[0],80,80,100,70)
call SetUnitAnimation(udg_WaterFurySpirit[0],"attack slam")
call SetUnitFlyHeight(udg_WaterFurySpirit[0],0.00,900.)
call TerrainDeformationRippleBJ(1.00,false,GetSpellTargetLoc(),600.00,600.00,64,1,600.)
call SetUnitAbilityLevel(udg_WaterFurySpirit[0],0x4130314F,GetUnitAbilityLevel(tidecaster,0x41303157))
call GroupEnumUnitsInRange(g,GetUnitX(udg_WaterFurySpirit[0]),GetUnitY(udg_WaterFurySpirit[0]),500.,Filter(function TidalUltFilt))
call ForGroup(g,function TidalFuryCast_Group)
call DestroyGroup(g)
set g=null
call TriggerSleepAction(.5)
call TimerStart(t,.05,true,function TidalFuryMove_Actions)
call TriggerSleepAction(.3)
call ShowUnitHide(udg_WaterFurySpirit[0])
call ForGroup(udg_WaterFuryGroup[0],function TidalFuryCast_Group2)
call TriggerSleepAction(.5)
call DestroyTimer(t)
set t=null
call ForGroup(udg_WaterFuryGroup[0],function TidalFuryCast_Group3)
call RemoveUnit(udg_WaterFurySpirit[0])
set tidecaster=null
//set TidalFuryMove=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
Okay this is the trigger where I must remove ugly sleep actions and global vars exclude the Hashtable... Maybe I've done my optimization wrong?
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
This seems much more bugged, for instance you don't even set the group here. Maybe it would be better to go back to the timer version and figure out what is wrong there. I am going to test the script it right now.

EDIT: I put it in a newly created map and it works, so I am guessing it's some problem in your map, some other trigger must overwrite or flush the hashtable just between the two functions.
 
Status
Not open for further replies.
Top