• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Why won't it work!? : <

Status
Not open for further replies.
Level 6
Joined
Aug 15, 2007
Messages
209
I would GREATLY appreciate anyone who helps me with this. It won't do anything regarding the group that is created. It's supposed to enumerate a group of units, then transfer them using Local Handle Vars to a timer, and slide them back. But for some reason it won't even do anything in the first funciton. Please help, and thanks in advance.

JASS:
function Trig_Impact_Cannon_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00D' 
endfunction
function ImpCheck takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'H002' 
endfunction
function ImpPush takes nothing returns nothing
local timer d = GetExpiredTimer()
local unit u = GetHandleUnit(d, "unit")
local unit i
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x2
local real y2
local real dist
local real face
local integer count = GetHandleInt(d, "count")
local integer level = GetHandleInt(d, "level")
local integer count2 = 1
local boolean end = false
    loop
    set i = GetHandleUnit(d,I2S(count2))
    exitwhen count2 == count
    set x2 = GetUnitX(i)
    set y2 = GetUnitY(i)
    set dist = SquareRoot((x2-x)*(x2-x)+(y2-y)*(y2-y))
    set face = (180/3.14) * Atan2(y2-y,x2-x)
    call SetUnitPosition(i, x2 + 20 * Cos(face*(3.14/180)), y2 + 20 * Sin(face*(3.14/180)))
    if dist > 100 + 50 * level then
    set end = true
    endif
    endloop
 if end == true then
 call PauseTimer(d)
 call DestroyTimer(d)
 call FlushHandleLocals(d)
 endif
endfunction
function Trig_Impact_Cannon_Actions takes nothing returns nothing
local timer d = CreateTimer()
local unit u = GetTriggerUnit()
local unit i
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real face = GetUnitFacing(u)
local integer level = GetUnitAbilityLevel(u, 'A004')
local integer count
local real radius = 50 + level * 10
local real x2 = x + radius * Cos(face*(3.14/180))
local real y2 = y + radius * Sin(face*(3.14/180))
local group impactv = CreateGroup()
call GroupEnumUnitsInRange(impactv, x2,y2,radius, Condition(function ImpCheck))
call SetHandleReal(d, "level", level)
call SetHandleHandle(d, "unit", u)

    loop
    set i = FirstOfGroup(impactv)
    exitwhen i == null
    set count = count + 1
    call GroupRemoveUnit(impactv, i)
    call PauseUnit(i,true)
    call SetHandleHandle(d, I2S(count), i)
    call UnitDamageTarget(u,i, 20 + level * 2, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MIND, WEAPON_TYPE_WHOKNOWS)
    endloop
call SetHandleInt(d, "count", count)
call TimerStart(d, .02, true, function ImpPush)
endfunction

//===========================================================================
function InitTrig_Impact_Cannon takes nothing returns nothing
    set gg_trg_Impact_Cannon = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Impact_Cannon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Impact_Cannon, Condition( function Trig_Impact_Cannon_Conditions ) )
    call TriggerAddAction( gg_trg_Impact_Cannon, function Trig_Impact_Cannon_Actions )
endfunction
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Use bj_DEGTORAD !!!!!!!!!!!! (optional)

firstly take your loop incrasers to end of loop and start then from same integer
and loop in timer doesnt increase count2
 
Status
Not open for further replies.
Top