• 🏆 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!

[vJASS] Spell problems with special effects

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2012
Messages
63
Hi hive, I'm having problems with this spell, Chaotic Fire. It picks every unit around it in range, then it damages them. The damage works just fine, but the special effects doesn't show up! I don't know why. Help will be appreciated.

JASS:
scope ChaoticFire initializer Init

globals
    private constant integer SPELL_ID = 'A01G' 
    private constant string EFFECT_TARGET ="Abilities\\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl"
    private constant string EFFECT_CASTER ="Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl"
    private group all
    private group copy
    private boolexpr b
endglobals

private function Targets takes unit target returns boolean
    return (GetWidgetLife(target) > 0.405) and(IsUnitType(target, UNIT_TYPE_STRUCTURE) == false) and(IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) == false) and(IsUnitType(target, UNIT_TYPE_MECHANICAL) == false)   
endfunction    

private function Pick takes nothing returns boolean
    return Targets(GetFilterUnit())
endfunction 

private function CopyGroup takes group g returns group
    set bj_groupAddGroupDest = CreateGroup()
    call ForGroup(g, function GroupAddGroupEnum)
    return bj_groupAddGroupDest
endfunction    

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID  
endfunction

private function Actions takes nothing returns nothing
    local unit hero = GetTriggerUnit()
    local player owner = GetOwningPlayer(hero)
    local integer pid  = GetPlayerId(owner) + 1 
    local real x    = GetUnitX(hero)
    local real y    = GetUnitY(hero)
    local unit f
    local real dmg = udg_StatsMentalPower[pid] * 2.0
    
    call GroupEnumUnitsInRange(all, x, y, 750,b)
    set copy = CopyGroup(all)
    call DestroyEffect(AddSpecialEffectTarget(EFFECT_CASTER, hero, "origin"))

    
    loop
        set f = FirstOfGroup(all)
        exitwhen (f == null)
        call GroupRemoveUnit(all, f)

        if IsUnitEnemy(f, owner) then
            call DestroyEffect(AddSpecialEffectTarget(EFFECT_TARGET, f, "origin"))
            call  UnitDamageTarget(hero, f, dmg, false, true,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null) 
            call ZTS_ApplyHealThreat( GetTriggerUnit(), GetSpellTargetUnit(), 85, true, true)
        endif 
    endloop
    
    set hero = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger ChaoticFireTrg = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( ChaoticFireTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( ChaoticFireTrg, Condition( function Conditions ) )
    call TriggerAddAction(ChaoticFireTrg, function Actions )
    
    set all = CreateGroup()
    set b = Condition(function Pick)
    set copy = CreateGroup()
    
    call Preload(EFFECT_CASTER)
    call Preload(EFFECT_TARGET)
    
endfunction
endscope
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,892
Are you sure? um, yesterday, I created a trigger that creates a special effect on a unit, (a buff one, I think) and then ofc destroy it immediately, but then when I tested, the unit still had the special effect. :eekani:
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
well, your problem is "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl", this effect has no death animation so that when you kill it it doesnt show any animation because it has nothing to show(no death animation) so there is nothing shown

Try changing the animation to something else, or let the Special effect play(add it to some array or hashtable and destroy it after second or so)
 
Status
Not open for further replies.
Top