HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell Help!

06-30-2006, 04:37 PM#1
emjlr3
ok so this abiltiy is supposed to add 5% attack speed and 5% damage for each additional attack on the same enemy, up to 25%

seems to work sometimes, and sometimes not

what I mean by this is, the attack speed/ damage dont reset when going to a new target, this can be seen in game becasue I create an effect on the attacker each time they get upgraded, but once they get to max, there is no more effect

what yall think?

Collapse JASS:
function Trig_Deaths_Touch_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetAttacker()) == 'N00W' 
endfunction

function Deaths_Touch_Damaged_Conditions takes nothing returns boolean
    return GetEventDamageSource()==GetTableUnit(GetAttTable(GetTriggeringTrigger()),"atk")    
endfunction

function Deaths_Touch_Damaged_Actions takes nothing returns nothing
    local unit u = GetEventDamageSource()
    local unit v = GetTriggerUnit()    
    local integer lvl = GetUnitAbilityLevel(u,'A03G')  
    local real damage = GetEventDamage()*(.05*lvl) 
    local unit dum = CreateUnit(GetOwningPlayer(u),'n003',GetUnitX(v),GetUnitY(v),0) 
    
    call DisableTrigger(GetTriggeringTrigger())
    if lvl<1 then
        call UnitAddAbility(u,'A03E')
        call SetUnitAbilityLevel(u,'A03G',1)
        call DestroyEffect(AddSpecialEffectTarget("Timerift Missle.mdx",u,"chest"))
    elseif lvl<5 then
        call SetUnitAbilityLevel(u,'A03G',lvl+1)
        call DestroyEffect(AddSpecialEffectTarget("Timerift Missle.mdx",u,"chest"))
    endif
    call UnitDamageTarget(dum,v,damage,false,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
    call UnitApplyTimedLife(dum,'BTLF',1.25)    
    
    set u = null
    set v = null      
endfunction

function Deaths_Touch_Change_Conditions takes nothing returns boolean
    local string s = GetAttTable(GetTriggeringTrigger())
    return GetAttacker()==GetTableUnit(s,"atk") and GetTriggerUnit()!=GetTableUnit(s,"atckd")    
endfunction

function Deaths_Touch_Change_Actions takes nothing returns nothing    
    call UnitRemoveAbility(GetTableUnit(GetAttTable(GetTriggeringTrigger()),"atk"),'A03E')
    call DisableTrigger(GetTriggeringTrigger())      
endfunction

function Deaths_Touch_Remove_Trigger takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string s = GetAttTable(t)
    local trigger trig = GetTableTrigger(s,"trig")
    local string strig = GetAttTable(trig)    
    local trigger trig2 = GetTableTrigger(s,"trig2")
    local string strig2 = GetAttTable(trig2)     
      
    call TriggerRemoveAction(trig,GetTableTriggerAction(strig,"ta"))
    call ClearTable(strig)
    call DestroyTrigger(trig)
    call TriggerRemoveAction(trig2,GetTableTriggerAction(strig2,"ta2"))
    call ClearTable(strig2)
    call DestroyTrigger(trig2)
    call Clearst(s,t)
    
    set trig = null 
    set trig2 = null   
endfunction

function Trig_Deaths_Touch_Actions takes nothing returns nothing
    local unit atk = GetAttacker()
    local unit atckd = GetTriggerUnit()
    local trigger trig = CreateTrigger()
    local triggeraction ta
    local string strig = GetAttTable(trig)
    local trigger trig2 = CreateTrigger()
    local triggeraction ta2
    local string strig2 = GetAttTable(trig2)
    local timer t = CreateTimer()   
    local string s = GetAttTable(t)    
    
    call TriggerRegisterUnitEvent(trig,atckd,EVENT_UNIT_DAMAGED)
    call TriggerAddCondition(trig,Condition(function Deaths_Touch_Damaged_Conditions))
    set ta = TriggerAddAction(trig,function Deaths_Touch_Damaged_Actions)
    call SetTableObject(strig,"atk",atk)
    call SetTableObject(strig,"ta",ta)
    
    call TriggerRegisterAnyUnitEventBJ( trig2, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition(trig2,Condition(function Deaths_Touch_Change_Conditions))
    set ta2 = TriggerAddAction(trig2,function Deaths_Touch_Change_Actions)
    call SetTableObject(strig2,"atk",atk)
    call SetTableObject(strig2,"atckd",atckd) 
    call SetTableObject(strig2,"ta2",ta2)   
    
    call SetTableObject(s,"trig",trig)
    call SetTableObject(s,"trig2",trig2)        
    call TimerStart(t,2.0,false,function Deaths_Touch_Remove_Trigger)       
    
    set atk = null
    set atckd = null
    set trig = null
    set ta = null
    set trig2 = null
    set ta2 = null
endfunction

//===========================================================================
function InitTrig_Deaths_Touch takes nothing returns nothing
    set gg_trg_Deaths_Touch = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Deaths_Touch, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Deaths_Touch, Condition( function Trig_Deaths_Touch_Conditions ) )
    call TriggerAddAction( gg_trg_Deaths_Touch, function Trig_Deaths_Touch_Actions )
endfunction

GetAttTable() is what i shortened the function to
Clearst() is a custom function I use to remove timers and clean attachments for me
06-30-2006, 04:54 PM#2
Jacek
Check how DotA did it
06-30-2006, 11:48 PM#3
emjlr3
im pretty sure this is how dota did it
07-02-2006, 04:41 PM#4
emjlr3
bump!