• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Having a problem with special effect.

Status
Not open for further replies.
Level 5
Joined
Jul 14, 2008
Messages
121
I've added the Attribute Menu system to my map at : http://www.hiveworkshop.com/forums/spells-569/attribute-menu-102908

And since then all my special effects created by trigger don't work.

Example:
JASS:
function Trig_Greater_Bash_Conditions takes nothing returns boolean
    if ( not( IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) == true ) ) then
        return false
    endif
    if( not ( GetUnitAbilityLevel(GetAttacker(), 'A035' ) > 0 ) ) then
        return false
    endif
    if ( not ( IsUnitType(GetTriggerUnit(),UNIT_TYPE_STRUCTURE)==false)) then
        return false
    endif    
    return GetRandomInt(1, 100) <= 17 
endfunction

function GB_Destroy_Trees takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction

function Knockback takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit cast = GetHandleUnit(t, "cast")
    local unit targ = GetHandleUnit(t, "targ")
    local real dist = GetHandleReal(t,"dist")    
    local real angle = GetHandleReal(t,"angle")
    local location m = Location(GetUnitX(targ)+dist*CosBJ(angle),GetUnitY(targ)+dist*SinBJ(angle))        
    call SetUnitPositionLoc( targ, m )
    call DestroyEffect(AddSpellEffectByIdLoc('A035',EFFECT_TYPE_SPECIAL,m))   
    call SetHandleReal(t,"dist",dist*.98)
    call EnumDestructablesInCircleBJ(150.,m,function GB_Destroy_Trees)
    call UnitDamageTargetBJ( cast, targ, .33, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )

    set t = null
    set cast = null
    set targ = null     
    call RemoveLocation(m)    
    set m = null
endfunction

function Trig_Greater_Bash_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local unit cast = GetAttacker()
    local unit targ = GetTriggerUnit() 
    local real angle = AngleBetweenPoints(GetUnitLoc(cast), GetUnitLoc(targ)) 
    local effect fx=AddSpecialEffectTargetUnitBJ("weapon",cast,"Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl")
    call DestroyEffect(fx)    
    call UnitDamageTargetBJ( cast, targ, 10 * GetUnitAbilityLevel(cast, 'A035' ), ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
    call SetHandleHandle(t, "cast", cast)
    call SetHandleHandle(t, "targ", targ)
    call SetHandleReal(t,"dist",4.00)    
    call SetHandleReal(t,"angle",angle)
    call DisableTrigger(GetTriggeringTrigger())
    call TimerStart(t, 0.01, true, function Knockback)       
    call TriggerSleepAction( 0.4+( .2* I2R(GetUnitAbilityLevel(cast, 'A035'))))
    call EnableTrigger(GetTriggeringTrigger())    
    
    call FlushHandleLocals(t)
    set fx = null
    call PauseTimer(t)
    call DestroyTimer(t)    
    set t = null
    set cast = null
    set targ = null
    call RemoveLocation(GetUnitLoc(cast))  
    call RemoveLocation(GetUnitLoc(targ))
endfunction

//===========================================================================
function InitTrig_Greater_Bash takes nothing returns nothing
    set gg_trg_Greater_Bash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Greater_Bash, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Greater_Bash, Condition( function Trig_Greater_Bash_Conditions ) )
    call TriggerAddAction( gg_trg_Greater_Bash, function Trig_Greater_Bash_Actions )
endfunction

That's one of the triggers in my map, now the special effects dont work on it anymore.
 
Status
Not open for further replies.
Top