• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Problem with call ForGroupBJ/ForGroup

Status
Not open for further replies.
Level 2
Joined
Sep 25, 2013
Messages
6
Help !!!
My spell Ice Strike attempt to deal damage to unit within 300 range of caster after 0.5sec of cast.
But there is a problem that i cant call ForGroupBJ/ForGroup actions while using timer to wait.:vw_wtf:

JASS:
scope IceStrike initializer Init

    globals
        private real damage
        private timer dtimer
        private real period = 0.5
    endglobals

    private function GroupActions takes nothing returns nothing
        // Break point
        call BJDebugMsg("!!") 
        if ( IsUnitDeadBJ(GetEnumUnit()) == FALSE ) then
        if ( IsUnitType(GetEnumUnit(), UNIT_TYPE_MAGIC_IMMUNE) == FALSE) then
        if ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == FALSE ) then
        if ( IsUnitAlly(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == FALSE) then
            call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetEnumUnit(), damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
            call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        endif
        endif
        endif
        endif
    endfunction

    private function timeOut takes nothing returns nothing
        local location tempLoc =GetUnitLoc(GetSpellAbilityUnit())
        local group tempGroup =GetUnitsInRangeOfLocAll(300,tempLoc)
        set damage =  ( I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) * 50.00 ) + I2R(GetHeroStatBJ(bj_HEROSTAT_INT, GetSpellAbilityUnit(), true))
        call ForGroupBJ( tempGroup, function GroupActions )
        call DestroyGroup(tempGroup)
        call RemoveLocation(tempLoc)
        call DestroyTimer(dtimer)
    endfunction
    
    private function Actions takes nothing returns nothing
        set dtimer = CreateTimer()
        call TimerStart(dtimer, period, false, function timeOut)
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call RegisterSpellEffectEvent('A00D', function Actions )
        set t = null
    endfunction

endscope

I wan to know why and how to fix it
please help :ogre_rage:
 
Level 3
Joined
Jul 30, 2013
Messages
25
May I know your RegisterSpellEffectEvent use what resources? Just curious.

Edit: I suspect the GetSpellAbilityUnit in tempLoc causes the problem, you should set it as variable in the Actions function and then use the variable in your tempLoc?
 
Status
Not open for further replies.
Top