HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

On Casting Event Disallows Animation Changes?

08-16-2006, 02:15 PM#1
Rising_Dusk
Well it's quite self explanatory --
There's a little more as well though.

When a unit begins casting an ability, I want to change it's current animation and stop the spellcast.
Sounds simple, hunh?

Collapse JASS:
call SetUnitAnimation(MyUnit, "stand")
Doesn't do anything apparently when the event fires.

Also I've noticed if I kill the unit when this event triggers, it doesn't play it's death animation.
Is there some quirk I should be aware of in coding a spell based around this that will allow me to do what I want to do?

In case you didn't catch all of that, I'm trying to change a unit's animation and stop the casting of the spell when he begins casting of a spell, AKA before cooldown and stuff are registered and then also allow for a proper death of the unit if the damage kills it.
Here's my code for clarification.

Collapse JASS:
function Insignificance_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetSpellAbilityUnit(), 'B00L') > 0
endfunction

function Insignificance_Actions takes nothing returns nothing
    local unit u = udg_u_Violet
    local unit t = GetSpellAbilityUnit()
    local integer lvl = GetUnitAbilityLevel(u, 'A026')
    local real dur = 1.00
    local real x = GetUnitX(t)
    local real y = GetUnitY(t)
    if lvl == 3 or lvl == 4 then
        set dur = 2.00
    elseif lvl == 5 then
        set dur = 3.00
    endif
    
    //****************************************************
    //*This is the block that doesn't seem to do anything*
    call PauseUnit(t, true)                            //*
    call IssueImmediateOrder(t, "stop")                //*
    call SetUnitAnimation(t, "stand")                  //*
    call PauseUnit(t, false)                           //*
    //****************************************************
    
    call ResumeAttack(t)
    call UnitRemoveAbility(t, 'B00L')
    call DestroyEffect(AddSpecialEffectTarget("MDX\\DarkSwirl.mdx", t, "overhead"))
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", x, y))
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl", x, y))
    call UnitDamageTarget(u, t, 150+(50*lvl), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
    
    set u = null
    set t = null
endfunction

function InitTrig_Insignificance takes nothing returns nothing
    set gg_trg_Insignificance = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Insignificance, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition(gg_trg_Insignificance, Condition(function Insignificance_Conditions))
    call TriggerAddAction(gg_trg_Insignificance, function Insignificance_Actions)
endfunction

Can anyone help poor widdle ole' me with this?
I'd be much obliged.
08-16-2006, 02:20 PM#2
The)TideHunter(
I think when a unit casts a spell, the spells animation which you set gets locked, so its forced to play it, wether its dead, alive, or playing another animation.
08-16-2006, 03:17 PM#3
blu_da_noob
Use a 0 second timer and play the animation when it expires.
08-16-2006, 04:05 PM#4
Vexorian
_SPELL_CAST happens before _SPELL_EFFECT
08-16-2006, 04:44 PM#5
Rising_Dusk
I know Vex.
That was intended.
Quote:
I'm trying to change a unit's animation and stop the casting of the spell when he begins casting of a spell, AKA before cooldown and stuff are registered

And Blu, I'll try that right away.
If it works, then you're my savior. :D

EDIT: Okay Blu, you're my savior. *Bows down in recognition*