why, why, why????

N

nossej

Guest
this was suppose to damage units around the caster when i cast a spell.
the lightning effect is there, but the thing is it wont damage the unit:mad:
why? why? why? and why? :banghead:
JASS:

function Trig_Holy_Thunder_Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == 'A01D' or GetSpellAbilityId() == 'A019' or GetSpellAbilityId() == 'A002' or GetSpellAbilityId() == 'A018')
endfunction

function filterUnit takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and GetUnitAbilityLevel(GetFilterUnit(), 'B00G') > 0
endfunction

function Trig_Holy_Thunder_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit victim 
    local integer spellLvl = GetUnitAbilityLevel(caster, 'A01I')
    local integer dmg = spellLvl * 100
    local group victims = CreateGroup()
    call GroupEnumUnitsInRange(victims, GetUnitX(caster), GetUnitY(caster), 600, Condition(function filterUnit))
    loop 
        set victim = FirstOfGroup(victims)
        exitwhen victim == null
        call UnitDamageTarget(caster, victim, dmg, true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null)
        call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", victim, "chest"))
        call GroupRemoveUnit(victims, victim)
    endloop
    set caster = null
    set victim = null
    set victims = null   
endfunction

//===========================================================================
function InitTrig_Holy_Thunder takes nothing returns nothing
    local trigger gg_trg_Holy_Thunder = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Thunder, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Holy_Thunder, Condition( function Trig_Holy_Thunder_Conditions ) )
    call TriggerAddAction( gg_trg_Holy_Thunder, function Trig_Holy_Thunder_Actions )
endfunction
 
call UnitDamageTarget(caster, victim, dmg, true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null)

should be


call UnitDamageTarget(caster, victim, dmg, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, WEAPON_TYPE_WHOKNOWS)
 
hm, guess theres no triggering unit in that filter:

JASS:
function filterUnit takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and GetUnitAbilityLevel(GetFilterUnit(), 'B00G') > 0
endfunction


better set triggering unit to a global for emaple bj_ghoul[23] and pass it that way to the filter.

JASS:
function Trig_Holy_Thunder_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit victim 
    local integer spellLvl = GetUnitAbilityLevel(caster, 'A01I')
    local integer dmg = spellLvl * 100
    local group victims = CreateGroup()
    set bj_ghoul[23] = caster
    call GroupEnumUnitsInRange(victims, GetUnitX(caster), GetUnitY(caster), 600, Condition(function filterUnit))
    loop 
        set victim = FirstOfGroup(victims)
        exitwhen victim == null
        call UnitDamageTarget(caster, victim, dmg, true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null)
        call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", victim, "chest"))
        call GroupRemoveUnit(victims, victim)
    endloop
    set caster = null
    set victim = null
    set victims = null   
endfunction


JASS:
function filterUnit takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(bj_ghoul[23])) and GetUnitAbilityLevel(GetFilterUnit(), 'B00G') > 0
endfunction


if it works with trollvottels suggestion nvm my reply^^
 
Are you sure that the hero sure has the spell 'A01I' ?

Add a BJDebugMsg and check if spellLvl is 0.
 
> WEAPON_TYPE_WHOKNOWS)

Unnecessary. Null is also alright.

> true, false
Could also be true, true as he did that.

You should put a
JASS:

call DestroyGroup(victims)

after endloop so you can clean the leak. ;)

And as GaLs said, make sure that the Hero has the correct ability.
 
Are you sure that the hero sure has the spell 'A01I' ?

Add a BJDebugMsg and check if spellLvl is 0.


o crap thx....:eek:
i forgot that the spell A01I is deleted by the stupid me......
:banghead::banghead::banghead::nuts:
thx anyways.... it works perfectly now....:)
 
call UnitDamageTarget(caster, victim, dmg, true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, null)

should be


call UnitDamageTarget(caster, victim, dmg, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_DIVINE, WEAPON_TYPE_WHOKNOWS)

Does that really matter? The weapon type is just for the sound. Also, you want the "boolean Ranged" to be true because if the target has spiked carpace, you'll take the return dmg from your spell.
 
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