• 🏆 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!

AdvancedAura

This system allows the user to create code based auras. You can easily add effects, buffs and bonuses with a few lines only. Also you can define a custom filter and the area of effect of the aura. You may acess many methods which grant you acess to even more variety in your aura systems, but all features are optional.

Requires:

Optional:


JASS:
//############################## ~AdvancedAura~ ######################################//
//##
//## Version:       1.0
//## System:        Axarion
//## IndexerUtils:  Axarion
//## AbilityEvent:  Axarion
//## AutoIndex:     grim001
//## AIDS:          Jesus4Lyf
//## UnitIndexer:   Nestharus
//## TimerUtils:    Vexorian
//## GroupUtils:    Rising_Dusk
//##
//############################### DESCRIPTION ###################################//
//##
//## This System allows to  create  custom auras. It was  made, because ability
//## only auras arent very flexible and have bad filters. Also normal auras are
//## limited to specific bonuses.
//##
//############################### HOW DOES IT WORK ##############################//
//##
//## To use this system create an array struct and implement the AdvancedAura module.
//## You can optionally implement AdvancedAuraBuff and AdvancedAuraBonus.
//## In the structs onInit  method you have to define the ability  for the  aura and 
//## the buffs ability if you use UnitAuraBuff. When a unit  acquires the ability the
//## aura will be added automatically so you don't have to do it yourself. To  define
//## the ability just use:
//##   
//##        static constant integer ability = 'AURA'
//##
//## The aura will be paused if the unit is a hero and it dies. If a unit leaves
//## the map the aura will be removed, so you don't have to worry about leaking
//## struct instances.
//##
//################################# METHODS #####################################//
//##  
//##    You can implement these functions into your UnitAura struct. They are
//##    all optional.
//##
//##    - happens when a new aura is created (define the bonuses here)
//##        method AuraInit takes nothing returns nothing
//##
//##    - happens when a unit enters the aura    
//##        method onAffect takes unit u returns nothing
//##
//##    - happens when a unit leaves the aura  
//##        method onUnaffect takes unit u returns nothing
//##   
//##    - happens when a unit stayed in the aura
//##        method onLoop takes unit u returns nothing
//##
//##    - checks if the unit is a valid target for the aura
//##        method onFilter takes unit u returns boolean
//##
//##    - happens when the aura leveled up (increase the bonuses here)
//##        method onLevelUp takes nothing returns nothing
//##
//##    - define the AoE here
//##        method GetAuraAoE takes nothing returns real
//##
//################################# API & Variables ##############################//
//##
//##    - the unit owning the aura:
//##        .owner
//##
//##    - the level of the aura:
//##        .level
//##
//##    - the aura ability
//##        ability
//##      
//##    - the interval of the aura timer:
//##        INTERVAL
//##
//##    - the auras group with all currently affected units
//##        .InstanceGroup
//##
//################################# KNOWN BUGS ###################################//
//##
//## AutoIndex:
//## - when using AutoIndex auras will not be created for preplaced units.
//##   I don't know why if you know why tell me, please. I think its something
//##   with TimerUtils and JassHelper's priorities.
//##
//## AIDS:
//## - you need to make TimerUtils a requirement for AIDS or it will bug for
//##   preplaced units with the ability
//##
//## UnitIndexer
//## - none found yet, therefore i recommend you to use this indexer.
//##
//################################################################################//

native UnitAlive takes unit id returns boolean // may be removed if already declared.

library AdvancedAura requires TimerUtils, GroupUtils, AbilityEvent
       
    module AdvancedAura
        delegate AuraDelegate AuraDefault
       
        private static  thistype array   Instances
        private static  integer          InstancesTotal
                static  thistype         curr
                static  real             INTERVAL
        private static  timer            AuraTimer
        private         integer          Index
        readonly        group            InstanceGroup
        private         unit             InstanceUnit
        private         integer          Level
        private         boolean          pause
        readonly        integer          affectedCount
       
        method operator owner takes nothing returns unit
            return .InstanceUnit
        endmethod
       
        method operator level takes nothing returns integer
            return .Level
        endmethod
       
        method operator level= takes integer newlevel returns nothing
            loop
                exitwhen newlevel == .Level
                set .Level = .Level + 1
                call .onLevelUp()
            endloop
        endmethod
       
        static method operator [] takes unit u returns thistype
            static if LIBRARY_AIDS then
                return GetUnitIndex(u)
            else
                return GetUnitId(u)
            endif
        endmethod
       
        static method operator []= takes unit u, thistype this returns nothing
            set thistype[u] = this
        endmethod
       
        private method affect takes unit u returns nothing
            set .affectedCount = .affectedCount + 1
           
            static if thistype.BUFF_VERIFIER then
                call .addBuff(u)
            endif
           
            static if thistype.BONUS_VERIFIER then
                call .addBonuses(u)
            endif
           
            static if thistype.EFFECT_VERIFIER then
                call .addEffect(u)
            endif
           
            call curr.onAffectUnit(u)
        endmethod
       
        private method unaffect takes unit u returns nothing
           
            set .affectedCount = .affectedCount - 1
           
            static if thistype.BUFF_VERIFIER then
                call .removeBuff(u)
            endif
           
            static if thistype.BONUS_VERIFIER then
                call .removeBonuses(u)
            endif
           
            static if thistype.EFFECT_VERIFIER then
                call .removeEffect(u)
            endif
           
            call curr.onUnaffectUnit(u)
        endmethod
       
        private static method unaffectenum takes nothing returns nothing
            local unit u = GetEnumUnit()
            call curr.unaffect(u)
            call GroupRemoveUnit(curr.InstanceGroup, u)
        endmethod
       
        private static method GroupEnum takes nothing returns boolean
            local unit u = GetFilterUnit()
            local boolean b = curr.onFilter(u)
           
            if IsUnitInGroup(u, curr.InstanceGroup) and b then
                call curr.onLoopUnit(u)
            elseif b then
                call curr.affect(u)
            elseif IsUnitInGroup(u, curr.InstanceGroup) then
                call curr.unaffect(u)
            endif
           
            call GroupRemoveUnit(curr.InstanceGroup, u)
           
            set u = null
            return b
        endmethod
       
        private static method AuraLoop takes nothing returns nothing
            local integer i = 0
            local thistype this
            loop
                set this = .Instances[i]
                set curr = this
               
                if .pause == false then
                    if GetUnitAbilityLevel(.InstanceUnit, ability) == null then
                        call thistype.removeAura(.InstanceUnit)
                        set i = i - 1
                    elseif UnitAlive(.InstanceUnit) == false and IsUnitType(.InstanceUnit, UNIT_TYPE_DEAD) then
                        if IsUnitType(.InstanceUnit, UNIT_TYPE_HERO) then
                            set .pause = true
                            call ForGroup(.InstanceGroup, function thistype.unaffectenum)
                        else
                            call thistype.removeAura(.InstanceUnit)
                            set i = i - 1
                        endif
                    elseif UnitAlive(.InstanceUnit) and IsUnitType(.InstanceUnit, UNIT_TYPE_DEAD) == false and .pause then
                        set .pause = false
                    else
                        set .level = GetUnitAbilityLevel(.InstanceUnit, ability)
                        call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(.InstanceUnit), GetUnitY(.InstanceUnit), .GetAuraAoE(), Filter(function thistype.GroupEnum))
                       
                        call ForGroup(.InstanceGroup, function thistype.unaffectenum)
                        call GroupAddGroup(ENUM_GROUP, .InstanceGroup)
                        call .onLoop()
                    endif
                endif
               
                set i = i + 1
                exitwhen i >= .InstancesTotal
            endloop
           
        endmethod
       
        private static method removeAura takes unit u returns nothing
            local thistype this             = thistype[u]
            if this != 0 then
                set .InstanceUnit               = null
                call ReleaseGroup(.InstanceGroup)
                set .Level                      = 0
                set .Instances[.Index]          = .Instances[.InstancesTotal]
                set .Instances[.InstancesTotal] = 0
                set .InstancesTotal             = .InstancesTotal - 1
               
                static if thistype.EFFECT_VERIFIER then
                    call .removeOwnerEffect()
                endif
               
                if .InstancesTotal <= 0 then
                    call PauseTimer(thistype.AuraTimer)
                    call ReleaseTimer(thistype.AuraTimer)
                endif
            endif
        endmethod
       
        private static method addAura takes unit u returns nothing
            local thistype this             = thistype[u]
            set .InstanceUnit               = u
            set .InstanceGroup              = NewGroup()
            set .Level                      = GetUnitAbilityLevel(u, ability)
            set .pause                      = false
           
            static if thistype.EFFECT_VERIFIER then
                call .addOwnerEffect()
            endif
           
            call .AuraInit()
           
            set .Instances[.InstancesTotal] = this
            set .Index                      = .InstancesTotal
           
            if .InstancesTotal == 0 then
                set thistype.AuraTimer = NewTimer()
                call TimerStart(thistype.AuraTimer, thistype.INTERVAL ,true, function thistype.AuraLoop)
            endif
            set .InstancesTotal = .InstancesTotal + 1
        endmethod
       
        private static method onInit takes nothing returns nothing
            set .InstancesTotal = 0
        endmethod
           
        static method onIndexWithAbility takes unit u returns nothing
            call thistype.addAura(u)
        endmethod
   
        static method onDeindexWithAbility takes unit u returns nothing
            if thistype[u] != 0 then
                call thistype.removeAura(u)
            endif
        endmethod
       
        static method onSkillAbility takes unit u, integer id returns nothing
            if GetUnitAbilityLevel(u, ability) == 1 then
                call thistype.addAura(u)
            endif
        endmethod
       
        static method onAddAbility takes unit u, integer id returns nothing
            call thistype.addAura(u)
        endmethod
       
        static method onRemoveAbility takes unit u, integer id returns nothing
            call thistype.removeAura(u)
        endmethod
       
        implement AbilityEvent
    endmodule
   
    struct AuraDelegate
        method AuraInit takes nothing returns nothing
        endmethod
        method onAffectUnit takes unit u returns nothing
        endmethod
        method GetAuraAoE takes nothing returns real
            return 900.
        endmethod
        method onUnaffectUnit takes unit u returns nothing
        endmethod
        method onLoopUnit takes unit u returns nothing
        endmethod
        method onLoop takes nothing returns nothing
        endmethod
        method onFilter takes unit u returns boolean
            return true
        endmethod
        method onLevelUp takes nothing returns nothing
        endmethod
    endstruct

endlibrary

JASS:
//############################### CREDITS #######################################//
//##
//## Version:       1.0
//## System:        Axarion
//## IndexerUtils:  Axarion
//## AbilityEvent:  Axarion
//## AutoIndex:     grim001
//## AIDS:          Jesus4Lyf
//## UnitIndexer:   Nestharus
//## TimerUtils:    Vexorian
//## GroupUtils:    Rising_Dusk
//##
//############################### DESCRIPTION ###################################//
//##
//## This library enables you to add buffs to your aura.
//##
//############################### HOW DOES IT WORK ##############################//
//##
//## Just implement AdvancedAuraBuff before you implement AdvancedAura
//## and define the BUFF in the onInit method of your struct and your done.
//## The ability should be a modified Tornado Slow Aura with targets set as
//## only self and range of 0.01.
//## Also you should modify the buff/create a new one.
//##
//##            set BUFF = 'Haxx'
//##
//################################################################################//

library AdvancedAuraBuff requires AdvancedAura

module AdvancedAuraBuff
    static integer BUFF
    private static integer array LOCK
    static constant boolean BUFF_VERIFIER = true // for checking if the module is implemented.
   
    method addBuff takes unit u returns nothing
        if BUFF != 0 then
            if LOCK[GetUnitId(u)] == 0 then
                call UnitAddAbility(u, thistype.BUFF)
                call UnitMakeAbilityPermanent(u, true, thistype.BUFF)
            endif   
            set LOCK[GetUnitId(u)] = LOCK[GetUnitId(u)] + 1
        endif
    endmethod
   
    method removeBuff takes unit u returns nothing
        if BUFF != 0 then
            set LOCK[GetUnitId(u)] = LOCK[GetUnitId(u)] - 1
            if LOCK[GetUnitId(u)] == 0 then
                call UnitRemoveAbility(u, thistype.BUFF)
            endif
        endif
    endmethod
endmodule

endlibrary

JASS:
//############################### CREDITS #######################################//
//##
//## Version:       1.0
//## System:        Axarion
//## IndexerUtils:  Axarion
//## AbilityEvent:  Axarion
//## AutoIndex:     grim001
//## AIDS:          Jesus4Lyf
//## UnitIndexer:   Nestharus
//## TimerUtils:    Vexorian
//## GroupUtils:    Rising_Dusk
//##
//############################### DESCRIPTION ###################################//
//##
//## This library enables you to add bonuses to your aura.
//##
//############################### HOW DOES IT WORK ##############################//
//##
//## Just implement AdvancedAuraBonus before you implement AdvancedAura and define
//## the bonuses in the AuraInit method of your struct and increase/decrease them
//## in the onLevelUp method if you want. (set .AURA_BONUS_DAMAGE = x * .level)
//## This library requires BonusMod and AbilityPreload to work.
//##
//##      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//##      | Aura Bonus Type constants:       | Minimum bonus: | Maximum bonus: |
//##      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//##      | AURA_BONUS_SIGHT_RANGE           |   -2048        |   +2047        |
//##      | AURA_BONUS_ATTACK_SPEED          |   -512         |   +511         |
//##      | AURA_BONUS_ARMOR                 |   -1024        |   +1023        |
//##      | AURA_BONUS_MANA_REGEN_PERCENT    |   -512%        |   +511%        |
//##      | AURA_BONUS_LIFE_REGEN            |   -256         |   +255         |
//##      | AURA_BONUS_DAMAGE                |   -1024        |   +1023        |
//##      | AURA_BONUS_STRENGTH              |   -256         |   +255         |
//##      | AURA_BONUS_AGILITY               |   -256         |   +255         |
//##      | AURA_BONUS_INTELLIGENCE          |   -256         |   +255         |
//##      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//##
//################################################################################//

library AdvancedAuraBonus requires AdvancedAura, BonusMod

module AdvancedAuraBonus
    static constant boolean BONUS_VERIFIER = true // for checking if the module is implemented.
   
    //! runtextmacro AuraBonusCreate("DAMAGE")
    //! runtextmacro AuraBonusCreate("ARMOR")
    //! runtextmacro AuraBonusCreate("ATTACK_SPEED")
    //! runtextmacro AuraBonusCreate("SIGHT_RANGE")
    //! runtextmacro AuraBonusCreate("LIFE_REGEN")
    //! runtextmacro AuraBonusCreate("MANA_REGEN_PERCENT")
    //! runtextmacro AuraBonusCreate("STRENGTH")
    //! runtextmacro AuraBonusCreate("AGILITY")
    //! runtextmacro AuraBonusCreate("INTELLIGENCE")

    method addBonuses takes unit u returns nothing
        //! runtextmacro AuraBonusAdd("DAMAGE", "")
        //! runtextmacro AuraBonusAdd("ARMOR", "")
        //! runtextmacro AuraBonusAdd("ATTACK_SPEED", "")
        //! runtextmacro AuraBonusAdd("SIGHT_RANGE", "")
        //! runtextmacro AuraBonusAdd("LIFE_REGEN", "")
        //! runtextmacro AuraBonusAdd("MANA_REGEN_PERCENT", "")
        //! runtextmacro AuraBonusAddHero("STRENGTH", "")
        //! runtextmacro AuraBonusAddHero("AGILITY", "")
        //! runtextmacro AuraBonusAddHero("INTELLIGENCE", "")
    endmethod

    method removeBonuses takes unit u returns nothing
        //! runtextmacro AuraBonusAdd("DAMAGE", "-")
        //! runtextmacro AuraBonusAdd("ARMOR", "-")
        //! runtextmacro AuraBonusAdd("ATTACK_SPEED", "-")
        //! runtextmacro AuraBonusAdd("SIGHT_RANGE", "-")
        //! runtextmacro AuraBonusAdd("LIFE_REGEN", "-")
        //! runtextmacro AuraBonusAdd("MANA_REGEN_PERCENT", "-")
        //! runtextmacro AuraBonusAddHero("STRENGTH", "-")
        //! runtextmacro AuraBonusAddHero("AGILITY", "-")
        //! runtextmacro AuraBonusAddHero("INTELLIGENCE", "-")
    endmethod
endmodule

//! textmacro AuraBonusCreate takes NAME
    private integer AURA_BONUS_$NAME$_SAVER
   
    private static method $NAME$_UPDATE_REM takes nothing returns nothing
        local unit u = GetEnumUnit()
        local thistype this = curr
       
        call AddUnitBonus(u, BONUS_$NAME$, -.AURA_BONUS_$NAME$_SAVER)
       
        set u = null
    endmethod
   
    private static method $NAME$_UPDATE_ADD takes nothing returns nothing
        local unit u = GetEnumUnit()
        local thistype this = curr
       
        call AddUnitBonus(u, BONUS_$NAME$, .AURA_BONUS_$NAME$_SAVER)
       
        set u = null
    endmethod
   
    method operator AURA_BONUS_$NAME$= takes integer i returns nothing
        if .AURA_BONUS_$NAME$_SAVER != 0 then
            call ForGroup(.InstanceGroup, function thistype.$NAME$_UPDATE_REM)
        endif
        set .AURA_BONUS_$NAME$_SAVER = i
        if .AURA_BONUS_$NAME$_SAVER != 0 then
            call ForGroup(.InstanceGroup, function thistype.$NAME$_UPDATE_ADD)
        endif
    endmethod
   
    method operator AURA_BONUS_$NAME$ takes nothing returns integer
        return .AURA_BONUS_$NAME$_SAVER
    endmethod
//! endtextmacro

//! textmacro AuraBonusAdd takes NAME, plusorminus
    if .AURA_BONUS_$NAME$_SAVER != 0 then
        call AddUnitBonus(u, BONUS_$NAME$, $plusorminus$.AURA_BONUS_$NAME$_SAVER)
    endif
//! endtextmacro

//! textmacro AuraBonusAddHero takes NAME, plusorminus
    if IsUnitType(u, UNIT_TYPE_HERO) and .AURA_BONUS_$NAME$_SAVER != 0 then
        call AddUnitBonus(u, BONUS_$NAME$, $plusorminus$.AURA_BONUS_$NAME$_SAVER)
    endif
//! endtextmacro

endlibrary

JASS:
//############################### CREDITS #######################################//
//##
//## Version:       1.0
//## System:        Axarion
//## IndexerUtils:  Axarion
//## AbilityEvent:  Axarion
//## AutoIndex:     grim001
//## AIDS:          Jesus4Lyf
//## UnitIndexer:   Nestharus
//## TimerUtils:    Vexorian
//## GroupUtils:    Rising_Dusk
//##
//############################### DESCRIPTION ###################################//
//##
//## This library enables you to add effects to your aura.
//##
//############################### HOW DOES IT WORK ##############################//
//##
//## Just implement AdvancedAuraEffect before you implement AdvancedAura
//## and define the TARGET_SFX, OWNER_SFX in the onInit method of your struct and your done.
//##
//##            set TARGET_SFX      = "Abilities\\Spells\\Other\\GeneralAuraTarget\\GeneralAuraTarget.mdl"
//##            set TARGET_ATTACH   = "origin"
//##           
//##            set OWNER_SFX       = ""
//##            set OWNER_ATTACH    = "origin"
//##
//################################################################################//

library AdvancedAuraEffect requires AdvancedAura

module AdvancedAuraEffect
            static constant boolean         EFFECT_VERIFIER = true
    private static          integer array   LOCK
            static          string          TARGET_SFX      = "Abilities\\Spells\\Other\\GeneralAuraTarget\\GeneralAuraTarget.mdl"
            static          string          TARGET_ATTACH   = "origin"
            static          string          OWNER_SFX
            static          string          OWNER_ATTACH    = "origin"
    private static          effect  array   TARGET_EFFECT
    private                 effect          OWNER_EFFECT
           
    method addEffect takes unit u returns nothing
        if LOCK[GetUnitId(u)] == 0 then
            set TARGET_EFFECT[GetUnitId(u)] = AddSpecialEffectTarget(TARGET_SFX, u, TARGET_ATTACH)
        endif
        set LOCK[GetUnitId(u)] = LOCK[GetUnitId(u)] + 1
    endmethod
   
    method removeEffect takes unit u returns nothing
        set LOCK[GetUnitId(u)] = LOCK[GetUnitId(u)] - 1
        if LOCK[GetUnitId(u)] == 0 then
            call DestroyEffect(TARGET_EFFECT[GetUnitId(u)])
            set TARGET_EFFECT[GetUnitId(u)] = null
        endif
    endmethod
   
    method addOwnerEffect takes nothing returns nothing
        set .OWNER_EFFECT = AddSpecialEffectTarget(OWNER_SFX, .owner, OWNER_ATTACH)
    endmethod
   
    method removeOwnerEffect takes nothing returns nothing
        call DestroyEffect(.OWNER_EFFECT)
        set .OWNER_EFFECT = null
    endmethod
   
endmodule

endlibrary




Keywords:
Aura, Axarion, System
Contents

AdvancedAura (Map)

Reviews
12:14, 29th Oct 2010 The_Reborn_Devil: The coding looks very good. Seems to be easy to use and very powerful as well. Status: Approved Rating: Highly Recommended

Moderator

M

Moderator

12:14, 29th Oct 2010
The_Reborn_Devil:

The coding looks very good. Seems to be easy to use and very powerful as well.


Status: Approved
Rating: Highly Recommended
 
Level 4
Joined
Jul 24, 2010
Messages
85
I will help you posting the code.
Here the code of the example of using this system.

JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AuraOfBravery initializer onInit requires AdvancedAura

private struct AuraOfBravery extends array
    implement AdvancedAuraBonus
    implement AdvancedAuraBuff
    implement AdvancedAuraEffect
    implement AdvancedAura
    
    static constant integer ability = 'A000'

    /*
    private method GetAuraAoE takes nothing returns real
            return 900.
    endmethod
    */
    private method onLoop takes nothing returns nothing
        set .AURA_BONUS_DAMAGE = 2 * .affectedCount * .level
    endmethod
    /*
    private method onLoopUnit takes unit u returns nothing

    endmethod
    
    private method onAffectUnit takes unit u returns nothing
        
    endmethod
    
    private method onUnaffectUnit takes unit u returns nothing

    endmethod
    */
    private method onFilter takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_DEAD) == false and IsUnitAlly(u, GetOwningPlayer(.owner))
    endmethod
    /*
    private method onLevelUp takes nothing returns nothing
    
    endmethod
    
    private method AuraInit takes nothing returns nothing
    
    endmethod
    */
    
    private static method onInit takes nothing returns nothing
        set INTERVAL        = 0.5
        set BUFF            = 'aud0'
        set OWNER_SFX       = "Abilities\\Spells\\Human\\DevotionAura\\DevotionAura.mdl"
    endmethod
endstruct

endlibrary

JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AuraOfDoom initializer onInit requires AdvancedAura

private struct AuraOfDoom extends array
    implement AdvancedAuraBuff
    implement AdvancedAuraBonus
    implement AdvancedAuraEffect
    implement AdvancedAura
    
    static constant integer ability = 'A001'

    /*
    private method GetAuraAoE takes nothing returns real
            return 900.
    endmethod
    
    private method onLoop takes nothing returns nothing

    endmethod
    
    private method onLoopUnit takes unit u returns nothing

    endmethod
    */
    private method onAffectUnit takes unit u returns nothing
        call SetUnitScale(u, 0.5, 0.5, 0.5)
    endmethod
    
    private method onUnaffectUnit takes unit u returns nothing
        call SetUnitScale(u, 1., 1., 1.)
    endmethod
    
    private method onFilter takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_DEAD) == false and IsUnitAlly(u, GetOwningPlayer(.owner)) == false
    endmethod
    
    private method onLevelUp takes nothing returns nothing
        set .AURA_BONUS_ARMOR  = .level * -2
        set .AURA_BONUS_DAMAGE = .level * -3
    endmethod
    
    private method AuraInit takes nothing returns nothing
        set .AURA_BONUS_ARMOR  = .level * -2
        set .AURA_BONUS_DAMAGE = .level * -3
    endmethod
    
    private static method onInit takes nothing returns nothing
        set INTERVAL   = 0.5
        set BUFF       = 'aud1'
        set TARGET_SFX = "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl"
        set OWNER_SFX  = "Abilities\\Spells\\Undead\\UnholyAura\\UnholyAura.mdl"
    endmethod
    
endstruct

endlibrary
 
Last edited:
Level 7
Joined
Oct 11, 2008
Messages
304
I dislike what Bankde said...

Attack Speed, Armor, Mana/Life Regen, Damage, both are good auras...


also no aura is necessary... is just an option and some auras maybe are here just to complete the system

and... hmm... those auras is based on bonus, so what bonus give, the aura give so u know, is optional as said in the template
 
Level 4
Joined
Jul 24, 2010
Messages
85
I dislike what Bankde said...

Attack Speed, Armor, Mana/Life Regen, Damage, both are good auras...


also no aura is necessary... is just an option and some auras maybe are here just to complete the system

and... hmm... those auras is based on bonus, so what bonus give, the aura give so u know, is optional as said in the template

I said it is unnecessary because you can easily set it in Object editor without using this system. I don't think someone will use a very long code instead of changing 2-3 setting in object editor. Will you ?
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
I said it is unnecessary because you can easily set it in Object editor without using this system. I don't think someone will use a very long code instead of changing 2-3 setting in object editor. Will you ?

and what are you going to do if you have something like:

aura
gives 2 armor per int for all units within x range

or
aura
damages all units between 300 and 600 range
 
Level 4
Joined
Jul 24, 2010
Messages
85
and what are you going to do if you have something like:
aura
gives 2 armor per int for all units within x range
aura
damages all units between 300 and 600 range

Some map have also done stupid things like create 100 level of ability to set your first aura.
Second one, create 2 command aura. One is positive buff with 600 range. Other is negative (and difference) buff with 300 range. But negative bonus will not go below the base damage.

But as you have said, I completely agree that this system will help to set the bonus damage/armor easier and more accuracy than object editor.
Thank for giving me a better decision for this system. +rep :)

+ Hope the creator create the better and more complicate example of auras.

:goblin_good_job:
 
Level 7
Joined
Oct 11, 2008
Messages
304
I said it is unnecessary because you can easily set it in Object editor without using this system. I don't think someone will use a very long code instead of changing 2-3 setting in object editor. Will you ?

of course... if you want a map which you can control everything, do everything manually...

this is the point of lots of system, for example, projectile system

EDIT: i don't see the demomap but if bankde said that the examples are too simple, i agree with him

some example of the power of the system may help people to see what they can do with this (which can't be done with others aura's systems)
 
Level 11
Joined
Sep 30, 2009
Messages
697
Bankde said:
Here is unnecessary Aura.
1. Attackspeed
2. Armor
3. Mana regen
4. Life regen
5. Damage aura
What if you want to create an aura which adds armor, damage, life regen and attackspeed? It would require you to create multiple abilities in object editor. Therefore more buffs with abilities only and my only needs one. Also my Auras stack totally.

Bankde said:
+ Hope the creator create the better and more complicate example of auras.
It doesn't need to be complex systems are made to make complex things easy.


Anyway updated with improved examples.
 
Level 20
Joined
Oct 21, 2006
Messages
3,231

Attachments

  • asdhow.png
    asdhow.png
    20 KB · Views: 349
Level 4
Joined
Jul 24, 2010
Messages
85
Thank for improving sample map. I know it is not important but it is the advertising your own system which show that your system is better than using Object Editor (rather than just buffs)

The code is really easy to use, completely agree.

And...http://www.hiveworkshop.com/forums/spells-569/system-vjass-customaura-169141/
What is this ??? :goblin_jawdrop:

I know that your system is better. But why you said there that
I like the system moar than mine :(

He said he got the ideas from you. But most of the code is the same. Even the debug messages also same as his system.
I know you have improve his system but... don't know how to say.

If Anachron accept and allow you to improve the system, I will approve this system and also rate 5/5. (As very useful and great system)
 
Level 11
Joined
Sep 30, 2009
Messages
697
You have to understand that Anachron and me started developing an aura system before we knew each other. Also my old system was the first one released on hive. Also its not an improvement to his system, its totally written from scratch.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
I already knew about this and I know it's well coded, seems that you used BonusMod after all Ax! :p

Shouldn't AbilityPreload be optional in the Bonus library? Because if you have xe in your map you don't need to import another preload library. Right make xepreload optional too :D
 
Level 19
Joined
Oct 12, 2007
Messages
1,821
Some map have also done stupid things like create 100 level of ability to set your first aura.

I hope you do know that this drastically increases the load time of your map.
I once had 5 abilities in the map with ~100 levels each. Then when I removed them to replace them with a system the map loaded something like 30 seconds faster.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
You dont need the bonus module if you create the bonuses yourself with onaffect and onunaffect? Also i just read it all threw, why will aids bug if i dont put timerutils as required? Anyways i guess i can avoid this with not having any preplaced units with the ability :)
 
Level 11
Joined
Sep 30, 2009
Messages
697
You dont need the bonus module if you create the bonuses yourself with onaffect and onunaffect?

Yeah if you want to you can do it like this.

Also i just read it all threw, why will aids bug if i dont put timerutils as required? Anyways i guess i can avoid this with not having any preplaced units with the ability :)

I don't really know whats the problem with AIDS and with AutoIndex. But I don't think it is a big problem, since most maps don't use much preplaced units.
 
Level 3
Joined
Dec 16, 2010
Messages
31
When the hero dies and returns from the dead, the aura does not work.

I think the error is here in AuraLoop:
JASS:
if .pause == false then
    if GetUnitAbilityLevel(.InstanceUnit, ability) == null then

    ...

    elseif UnitAlive(.InstanceUnit) and IsUnitType(.InstanceUnit, UNIT_TYPE_DEAD) == false and .pause then
        //This statement is unreachable because true != false,
        //yet you require pause to be true AND false to get here.
        set .pause = false
    else

    ...

    endif
endif

I believe that specific part of the ifelse ladder should be outside.

Edit: also, does this account for a unit entering the range of two same auras, but where one aura is higher level?
The way I have it working right now, a unit gets bonuses from two of the same auras (auras stack, and I don't want them to).
 
Last edited:
Level 4
Joined
Sep 3, 2008
Messages
67
+Rep for your aura system.

About the pointless and nonsense posts, ignore them.

With your Aura System you can code by yourself what you want in an Aura.
 
Top