HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is there an ability-indepedent way to create custom buffs?

02-14-2006, 06:05 AM#1
RaeVanMorlock
I have a number of custom abilities that use buffs to aide in display and assist functionality.

For instance, I have a Cleave ability that adds a Cleave buff when casted. Then when the unit attacks, if it has the Cleave buff, it's damase spills onto nearby enemies and the buff is removed.

I'm now running into the problem where I'm not sure that there's enough "buffing" abilities for all the buffs that I need. For instance, I give the Cleave buff with the Inner Fire ability because they're somewhat similar (effecting a unit's attack), but now I have another ability that casts Inner Fire on all the allies of the caster... so the buffs conflict--one gets overwritten by the other. However, I need the second ability to use the properties of Inner Fire--so I have to go back and change the first ability now to something else and then hope I won't find a use for the real buff afterwards.

I tried providing buffs through use of the 'Channel' ability, but it doesn't seem to work.

Does anyone know of a better way to do this?
02-14-2006, 06:15 AM#2
qwertyui
AFAIK you can give buffs with triggers, can't you?
02-14-2006, 09:12 AM#3
Captain Griffen
No. Buffs and their properties are given by the ability, so cannot be created by triggers.
02-14-2006, 09:25 AM#4
Anitarf
It sucks, the best you can do is make a list of all avaliable buffing spells, make a plan for your map and see if it works out; some buffs have limited use since the abilities that make them have certain effects, like invisibility or banish; however, there are more buffing abilities out there than you might think, there's a bunch of item abilities (although they're mostly just no-target Aoe or self-target spells). At least you can use the same ability for self-buffing spells on different heroes.
02-14-2006, 02:52 PM#5
shadow1500
Different buffs on the same aura stack, put aura in spellbook, disable spellbook, add spellbook to unit then remove after buff duration.
Unlimited supply of buffs.
Con: doesnt flash when 10 seconds remain.
i have a function that takes care of everything after u do the object data, if u want it ill put it here.
02-14-2006, 03:39 PM#6
RaeVanMorlock
Quote:
Originally Posted by shadow1500
Different buffs on the same aura stack, put aura in spellbook, disable spellbook, add spellbook to unit then remove after buff duration.
Unlimited supply of buffs.
Con: doesnt flash when 10 seconds remain.
i have a function that takes care of everything after u do the object data, if u want it ill put it here.


Sounds interesting.. That'd be awesome if you could post it.
02-14-2006, 11:53 PM#7
shadow1500
Collapse Jass - AuraBuff Script:
function AuraBuff_Remove takes unit whichUnit, integer spellbookabil returns nothing
    local timer t = GetHandleTimer(whichUnit,"aurabtimer"+I2S(spellbookabil))
    local trigger t2 = GetHandleTrigger(whichUnit,"aurabtrig"+I2S(spellbookabil))
    if t != null then
        call SetHandleHandle(whichUnit,"aurabtimer"+I2S(spellbookabil),null)
        call SetHandleHandle(whichUnit,"aurabtrig"+I2S(spellbookabil),null)
        
        call TriggerRemoveAction(t2,GetHandleTriggerAction(t2,"action"))
        call FlushHandleLocals(t2)
        call DestroyTrigger(t2)
        
        call FlushHandleLocals(t)
        call PauseTimer(t)
        call DestroyTimer(t)
        
        call UnitRemoveAbility( whichUnit, spellbookabil)
    endif
    set t = null
    set t2 = null
endfunction
function AuraBuff_Child takes nothing returns nothing
    call AuraBuff_Remove( GetHandleUnit(GetExpiredTimer(),"u"), GetHandleInt(GetExpiredTimer(),"aura") )
endfunction
function AuraBuff_OnDeath takes nothing returns nothing
    call AuraBuff_Remove(GetTriggerUnit(),GetHandleInt(GetTriggeringTrigger(),"aura"))
endfunction
function AuraBuff_Add takes unit whichUnit,real dur, integer spellbookabil returns nothing
    local timer t = CreateTimer()
    local trigger t2 = CreateTrigger()
    
    call AuraBuff_Remove( whichUnit, spellbookabil )
    call SetPlayerAbilityAvailable( GetOwningPlayer(whichUnit), spellbookabil, false )
    call UnitAddAbility(whichUnit,spellbookabil)
    
    call SetHandleHandle(t,"u",whichUnit)
    call SetHandleInt(t,"aura",spellbookabil)
    
    call SetHandleHandle(t2,"u",whichUnit)
    call SetHandleInt(t2,"aura",spellbookabil)
    
    call SetHandleHandle(whichUnit,"aurabtimer"+I2S(spellbookabil),t)
    call SetHandleHandle(whichUnit,"aurabtrig"+I2S(spellbookabil),t2)
    
    call TimerStart(t, dur, false, function AuraBuff_Child)
    
    call TriggerRegisterUnitEvent(t2 , whichUnit, EVENT_UNIT_DEATH)
    call SetHandleHandle(t2,"action",TriggerAddAction(t2,function AuraBuff_OnDeath))

    set t = null
    set t2 = null
endfunction
02-16-2006, 11:08 AM#8
RaeVanMorlock
Nice code, shadow1500. Thank ya!