• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Trigger issue

Status
Not open for further replies.
Level 5
Joined
Sep 19, 2006
Messages
152
This trigger has a problem. The World Editor doesn't seem to like the call GroupEnumUnitsInRange (g, tX, tY, 550.0, function AbilityExorcism_Filter01) command, even though it passes in JassCraft. In fact, the spell doesn't always apply its graphics as per the spell ability itself. What am I doing wrong here?

JASS:
function AbilityExorcism_Condition01 takes nothing returns boolean
    return GetSpellAbilityId () == 'AHhb'
endfunction

function AbilityExorcism_Filter01 takes nothing returns boolean
    local unit U = GetFilterUnit ()
    if GetOwningPlayer (U) != Player (12) then
        set U = null
        return false
    elseif IsUnitRace (U, RACE_UNDEAD) then
        set U = null
        return true
    else
        set U = null
        return false     
    endif
endfunction

function AbilityExorcism_Action01 takes nothing returns nothing
    local unit c          = GetSpellAbilityUnit ()
    local unit t          = GetSpellTargetUnit ()
    local integer a       = GetSpellAbilityId ()
    local integer w       = GetUnitAbilityLevel (c, a) 
    local integer z       = GetHeroAgi (c, true) + (GetHeroAgi (c, false) * 2)
    local real cX         = GetUnitX (c)
    local real cY         = GetUnitY (c)
    local real tX         = GetUnitX (t)
    local real tY         = GetUnitY (t)
    local group g         = CreateGroup ()
    local unit f
//
    call GroupEnumUnitsInRange (g, tX, tY, 550.0, function AbilityExorcism_Filter01)
    loop
        set f = FirstOfGroup (g)
        exitwhen f == null
        call GroupRemoveUnit (g, f)
        call IssuePointOrder (f, "attack", cX, cY)
    endloop
    set f = null
    call DestroyGroup (g)
    set g = null
    call TriggerSleepAction (0.50)
    if GetRandomInt (0, 19) < z and GetUnitState (t, UNIT_STATE_LIFE) < 0.01 then
        call DestroyEffect (AddSpecialEffect ("Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", tX, tY))
        call DestroyEffect (AddSpecialEffectTarget ("Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl", c, "origin"))
        call SetUnitState (c, UNIT_STATE_MANA, (GetUnitState (c, UNIT_STATE_MANA) + ((w * 200.00) - 25.00)))        
    endif
    set c = null
    set t = null    
endfunction

function InitTrig_AbilityExorcism takes nothing returns nothing
    set gg_trg_AbilityExorcism = CreateTrigger()
    call DisableTrigger (gg_trg_AbilityExorcism)
    call TriggerRegisterAnyUnitEventBJ (gg_trg_AbilityExorcism, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition (gg_trg_AbilityExorcism, Condition (function AbilityExorcism_Condition01))
    call TriggerAddAction (gg_trg_AbilityExorcism, function AbilityExorcism_Action01)
endfunction
 
Level 7
Joined
Jun 10, 2007
Messages
225
JASS:
call GroupEnumUnitsInRange (g, tX, tY, 550.0, function AbilityExorcism_Filter01)
should be
JASS:
call GroupEnumUnitsInRange (g, tX, tY, 550.0, Filter(function AbilityExorcism_Filter01))
 
Status
Not open for further replies.
Top