HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Aura Template

01-19-2010, 12:30 AM#1
ShadowDestroyer
The Aura template is within the spell factory compiles and saves, but does not function. I am not sure why I am posting this here, but I need a fix asap for a map I am working on.
01-21-2010, 08:28 AM#2
311
yay hope you fix ! I want aura template so bad, and the spiral one back also :)
01-21-2010, 08:53 AM#3
Anachron
That one is 2 years old. You really should do it on your own.
01-22-2010, 09:30 PM#4
ShadowDestroyer
Vex updated it, it just doesn't work.

I know how to do most of the stuff without the templates. But with auras, I am not sure how to do it other than constant looping.
01-22-2010, 11:40 PM#5
Themerion
Quote:
But with auras, I am not sure how to do it other than constant looping.

As far as I know you have to do looping to manage auras. I think Blizzard's auras loop once every second or something like that. Hardly affects performance unless you have a lot of units and a lot of auras.
01-23-2010, 01:56 AM#6
ShadowDestroyer
So do you just want to pick every unit within range of unit and add a spell book and set the level of the ability inside equal to the level of the ability?
01-23-2010, 06:32 AM#7
Themerion
You also need to keep track on the units who currently have the aura (so you can remove the spellbooked ability if they are our of range).
01-23-2010, 11:27 AM#8
fX_
you can use abuff aura
01-23-2010, 03:22 PM#9
ShadowDestroyer
Is there a way to detect what unit is applying a buff though? Because I will need to get the level of the aura from the hero.
01-23-2010, 04:25 PM#10
fX_
i think, yes.

abuffaura automatically applies and removes buffs (abuff) to enemies around aura bearers as they approach and stray. both caster (source/bearer) and level are data within abuffs and are available to functions that work on abuffs.
01-23-2010, 07:01 PM#11
ShadowDestroyer
Do you know what the functions are?
01-23-2010, 08:47 PM#12
Anitarf
Each aBuff can have a bunch of user-created event functions assigned to it: for when it is created, for when it is cleaned up, a periodic function etc. You can use these functions to create whatever effect you want the aura buff to have. If you give me a specific example of what you want your spell to do, I can give you more specific code examples.
01-23-2010, 09:56 PM#13
ShadowDestroyer
Ok, cool.

The idea is simple really... It is an aura that gives bash to the units under its effects. It has 6 ranks, upgrading bash at each rank.
01-24-2010, 10:26 PM#14
Anitarf
That's simple:

Collapse JASS:
library BashAura initializer Init requires ABuff, ABuffAura, ABuffHeroSkill, ABuffDisplay

    globals
    // BUFF EFFECT
        private constant integer BUFF_ABILITY = 'A000' //the bash ability that units under the effect of the aura gain
    // BUFF VISUALS
        private constant integer BUFF_AURA = 'A001' //the self-targeting aura that places the buff in the unit's status card
        private constant integer BUFF = 'B000' //the buff bestowed upon the unit by the aura

    // MAIN AURA HERO SKILL
        private constant integer AURA = 'A002' //the dummy aura ability on the hero
    endglobals

    private function Range takes integer level returns real
        // This is the area of effect of the aura.
        return 800.0
    endfunction

    private function Targets takes unit affected, unit auraGiver returns boolean
        // This function follows the ABuffAuraTargets function interface
        // and defines what units can be affected by the aura.
        return not(IsUnitEnemy(affected, GetOwningPlayer(auraGiver))) and not(IsUnitType(affected, UNIT_TYPE_MECHANICAL)) and not(IsUnitType(affected, UNIT_TYPE_STRUCTURE))
    endfunction

// ================================================================

    // BUFF CODE
    globals
        private aBuffType auraBuff
    endglobals
    private function BuffApply takes aBuff eventBuff returns nothing
        //add the bash ability when the unit enters aura range.
        call UnitAddAbility(eventBuff.target.u, BUFF_ABILITY)
        call SetUnitAbilityLevel(eventBuff.target.u, BUFF_ABILITY, eventBuff.level)
        call UnitMakeAbilityPermanent(eventBuff.target.u, true, BUFF_ABILITY) //prevent morphing from removing the ability
    endfunction
    private function BuffCleanup takes aBuff eventBuff returns nothing
        //remove the bash ability when the unit leaves aura range.
        call UnitRemoveAbility(eventBuff.target.u, BUFF_ABILITY)
    endfunction

    // ABILITY CODE
    globals
        private aBuffType auraSource
    endglobals
    private function AuraSet takes aBuff eventBuff returns nothing
        call UnitSetABuffAura(eventBuff.target.u, auraBuff, eventBuff.level, Targets, Range(eventBuff.level))
    endfunction
    private function AuraRemove takes aBuff eventBuff returns nothing
        call UnitRemoveABuffAura(eventBuff.target.u, auraBuff)
    endfunction

// ================================================================

    // ABILITY INITIALIZATION
    private function Init takes nothing returns nothing
        //this is the aura buff which gives units the bash ability
        set auraBuff=aBuffType.create()
        set auraBuff.eventCreate = BuffApply
        set auraBuff.eventRefresh = BuffApply
        set auraBuff.eventCleanup = BuffCleanup
        set auraBuff.countsAsBuff = false

        set auraBuff.display = aBuffDisplay.create(BUFF_AURA, BUFF)

        //this is the hero buff which makes the hero a source of the aura
        //when he learns the AURA ability (thanks to ABuffHeroSkill)
        set auraSource=aBuffType.create()
        set auraSource.eventCreate = AuraSet
        set auraSource.eventRefresh = AuraSet
        set auraSource.eventCleanup = AuraRemove
        set auraSource.ignoreAsBuff = true
        
        call NewABuffHeroSkill(AURA, auraSource)
    endfunction

01-25-2010, 02:56 AM#15
ShadowDestroyer
Hey Anitarf,

A couple things I don't understand:

1.
Collapse JASS:
        private constant integer BUFF_AURA = 'A001' //the self-targeting aura that places the buff in the unit's status card
        private constant integer BUFF = 'B000' //the buff bestowed upon the unit by the aura

    // MAIN AURA HERO SKILL
        private constant integer AURA = 'A002' //the dummy aura ability on the hero

Could you explain these 3 more clearly?

"Self-Targeting Aura that places buff in unit's status card"

Is this an aura that ONLY affects the aura holder and not surrounding allies? Or is this the same thing as the dummy aura ability on the hero?

"Buff bestowed upon the unit by the aura"

Is this simply the standard buff provided by any aura, or is this the weird buff generated by a self-targeting only ability?

2. How would I go about applying the ability via a spellbook so that the icon is hidden?