Why Wont The Objects Damage People

Frosthowl

TH.net Regular
Reaction score
15
Hi, Im trying to make a burst spell that makes a bunch of projectiles fly out from the caster. That part works, however, the bolts will not damage anyone, even if they run into one of them. Whats wrong?

Code:
struct Bloodb
unit array bloodmissles[8]
unit caster
timer bloodtimer
trigger t
endstruct

function Trig_OgreMagic2_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'OGRE' ) ) then
        return false
    endif
    return true
endfunction

function Blood_Dam_Cond takes nothing returns boolean
local timer t = GetExpiredTimer()
local Bloodb blood = GetTimerStructA(t)
set t = null
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(blood.caster))
endfunction

function Blood_Dam takes nothing returns nothing
local timer t = GetExpiredTimer()
local Bloodb blood = GetTimerStructA(t)
local unit u = GetTriggerUnit()
set t = null
call UnitDamageTargetBJ(blood.caster, u, 55.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
endfunction

function Blood_Timer_Actions takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local Bloodb blood = GetTimerStructA(t)
    local integer i = 0
    loop
        exitwhen i > 7
        if IsUnitAliveBJ(blood.bloodmissles[i]) == true then
            call SetUnitPosition(blood.bloodmissles[i], GetUnitX(blood.bloodmissles[i]) + 20 * Cos(GetUnitFacing(blood.bloodmissles[i])* bj_DEGTORAD), GetUnitY(blood.bloodmissles[i]) + 20 * Sin(GetUnitFacing(blood.bloodmissles[i])* bj_DEGTORAD))
        endif
        set i = i + 1
    endloop
    set t = null
endfunction

function Trig_OgreMagic2_Actions takes nothing returns nothing
    local Bloodb blood = Bloodb.create()
    local unit u = GetSpellAbilityUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real angle = GetUnitFacing(u)
    local integer i = 0
    set blood.t = CreateTrigger() 
    set blood.caster = u
    loop
        exitwhen i > 7
        set blood.bloodmissles[i] = CreateUnit(GetOwningPlayer(u), 'BB00', x + 10 * Cos((GetUnitFacing(u) + 45 * (i+1)) * bj_DEGTORAD), y + 10 * Sin((GetUnitFacing(u) + 45 * (i+1)) * bj_DEGTORAD), GetUnitFacing(u) + 45 * (i+1))
        call UnitApplyTimedLifeBJ( 1, 'BTLF', blood.bloodmissles[i])
        call TriggerRegisterUnitInRange(blood.t, blood.bloodmissles[i],150,null)
        set i = i + 1
    endloop
    call TriggerAddCondition(blood.t, Condition( function Blood_Dam_Cond ) )
    call TriggerAddAction(blood.t, function Blood_Dam )
    set blood.bloodtimer = CreateTimer()
    call SetTimerStructA(blood.bloodtimer, blood)
    call TimerStart (blood.bloodtimer, .03, true, function Blood_Timer_Actions)
endfunction

//===========================================================================
function InitTrig_OgreMagic2 takes nothing returns nothing
    set gg_trg_OgreMagic2 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_OgreMagic2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_OgreMagic2, Condition( function Trig_OgreMagic2_Conditions ) )
    call TriggerAddAction( gg_trg_OgreMagic2, function Trig_OgreMagic2_Actions )
endfunction
 
JASS:
function Blood_Dam_Cond takes nothing returns boolean
local timer t = GetExpiredTimer()
This is causing some sort of problem, I'd suppose. Which timer do you think expires when a unit comes in range of another unit? I'd bet on none.

And you could change this:
JASS:
function Trig_OgreMagic2_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'OGRE' ) ) then
        return false
    endif
    return true
endfunction
To this:
JASS:
function Trig_OgreMagic2_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'OGRE'
endfunction
 
Hmnn, really dude, why do you call GetExpiredTimer in that function?
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top