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

[Snippet] AuraStruct

Level 4
Joined
Jun 9, 2011
Messages
91
Your demo don't compiles.

I added 2 lines after implemenation of CTQ
JASS:
        implement CTQ
            local boolean wasActive
            local real x1
            local real x2
            local real y1
            local real y2
            local integer lev
            // forgotten lines??
            local thistype time
            local UnitIndex entering
        implement CTQExpire
            // ...

@Edit
Why is this not working?
JASS:
library TestAura uses AuraStruct, Bonus
 struct tester extends array
    private static constant real TIMEOUT = .3
    private static constant boolean STACKS = false
    private static constant integer ABILITY_ID = 'AHad' // Devotion Aura
    
    private static method onLevel takes UnitIndex source, integer level returns nothing
    endmethod
    
    private method onEndEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
        call AddUnitBonus(GetUnitById(affected),BONUS_DAMAGE,100)
    endmethod
    
    private method onEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
        call AddUnitBonus(GetUnitById(affected),BONUS_DAMAGE,100)
    endmethod
    
    private static method getRange takes UnitIndex source, integer level returns real
        return 900.
    endmethod
    
    implement AuraStruct
 endstruct
endlibrary
Can you show me a simple aura?
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Sry about that, it should have 0 syntax errors now ; ).


I only tested syntax errors, and for syntax errors I only tested a portion of it.



Uh, latest version is up ; P.



Also, it's not working because what you did didn't fix it. I had the wrong arguments in there (lazy cnping and forgot to change some things with a last minute edit, hehe).


edit
Without a filter, that will give that aura to all units, including enemies. You sure you want that? : P


I have a couple of planned updates for this now as well.


This needs to correctly be applied to the source unit. This also needs to check for an ability level of 0 on the source unit so that the timer can be completely destroyed. At the moment, it'll just go to inactive.


Anyways, after those 2 updates, it should be gold
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ok, so updated and tested with this script

JASS:
struct testers extends array
    private static unit u
    private static unit u2
    private static unit u3
    private static method onInit takes nothing returns nothing
        set u=CreateUnit(Player(0),'Hmkg',GetStartLocationX(0),GetStartLocationY(0),270)
        set u2=CreateUnit(Player(0),'Hpal',GetStartLocationX(0),GetStartLocationY(0)-250,270)
        set u3=CreateUnit(Player(0),'hbar',GetStartLocationX(0),GetStartLocationY(0)-500,270)
        call SetHeroLevel(u2,10,false)
    endmethod
endstruct

struct tester extends array
    private static constant real TIMEOUT = .3
    private static constant boolean STACKS = false
    private static constant integer ABILITY_ID = 'AHad'
    
    private static method onLevel takes UnitIndex source, integer level returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,GetUnitName(GetUnitById(source))+" has learned devotion aura")
    endmethod
    
    private method onEndEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,GetUnitName(GetUnitById(affected))+" has lost devotion aura")
    endmethod
    
    private method onEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,GetUnitName(GetUnitById(affected))+" has gotten devotion aura")
    endmethod
    
    private method onPeriodicEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
        call SetWidgetLife(GetUnitById(affected), GetWidgetLife(GetUnitById(affected))+5*.3)
    endmethod
    
    private static method absFilter takes UnitIndex source, UnitIndex entering returns boolean
        return not IsUnitType(GetUnitById(entering), UNIT_TYPE_STRUCTURE)
    endmethod
    
    private method filter takes UnitIndex source, UnitIndex affected, integer level returns boolean
        return IsUnitAlly(GetUnitById(source), GetOwningPlayer(GetUnitById(affected)))
    endmethod
    
    private static method getRange takes UnitIndex source, integer level returns real
        return 900.
    endmethod
    
    implement AuraStruct
endstruct

Appeared to work perfectly : P


Only thing was the buff removal ran before the buff was actually removed from the unit (system is a bit more accurate than wc3, lol), but that's ok : )


This is the most efficient AuraStruct system there is as it uses 0 group enumerations : D
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
no, that wouldn't work... you might have 2 units with the same buff. Removing the ability would make the buff go away for a second when it shouldn't : P.


I could test it to see how long it takes to pop back up... I was thinking of doing buff counter things, but it would get really messy due to things like reincarnation and death.


This would ofc only be a problem with stacking buffs ; P
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Oh, another cool thing you can do is use a dummy to cast a spell on a unit that places an infinitely lasting buff. From there, you can easily do the onAdd/onRemove, but I'd need to do the proper buff counting for that : |.

edit
I have discovered that auras are bugged in wc3... devotion aura at level 3 is supposed to give 4.5 armor. Instead it is giving 9. This value of 9 is from adding up all the levels: 1.5+3.5+4.5=9.5

Another thing is that auras break unit in range events... also auras go way above their allowed range >.<.


The solution? No more auras >.>. Do fully custom script auras and u r good to go. This means that I will be changing this around to not work with standard auras since standard auras are so broken and buggy >.>. The good news is that I don't really have to change much : ).


The latest version is this (this code has messages in it from when I was testing the wc3 auras and wondering why the heck my triggers weren't running).
JASS:
library AuraStruct /* v1.1.0.1
*************************************************************************************
*
*   An efficient and easy to use module for aura design.
*
*************************************************************************************
*
*   */uses/*
*
*       */ UnitEvent /*             hiveworkshop.com/forums/jass-functions-413/extension-unit-event-172365/
*       */ UnitInRangeEvent /*      hiveworkshop.com/forums/submissions-414/unitinrangeevent-205036/
*       */ Tt /*                    hiveworkshop.com/forums/jass-functions-413/system-timer-tools-201165/
*
************************************************************************************
*
*   Interface
*
*       private static constant real TIMEOUT
*           (required) -   How often the aura effect runs
*
*       private static constant boolean STACKS
*           (required) -   Does the aura stack?
*
*       private static constant integer ABILITY_ID
*           (required) -   The aura ability id
*
*       private static method onLevel takes UnitIndex source, integer level returns nothing
*           (optional) -    Runs when aura levels up
*
*       private static method getRange takes UnitIndex source, integer level returns real
*           (required) -    Should return the range of the aura
*
*       private method onEndEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
*           (optional) -    Runs when the aura effect ends (aura no longer on unit)
*
*       private method onEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
*           (optional) -    Runs when aura effect starts (aura just went on to unit)
*
*       private method onPeriodicEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
*           (optional) -    Runs every period of the aura. First run is right after onEffect
*
*       private static method absFilter takes UnitIndex source, UnitIndex entering returns boolean
*           (optional) -    Runs when the unit initially enters in the range of the aura. If this returns false, the
*                      -    unit is ignored as if it doesn't exist and it will never be able to get the aura
*
*       private method filter takes UnitIndex source, UnitIndex affected, integer level returns boolean
*           (optional) -    Runs whenever the aura cycles (every TIMEOUT seconds). This helps determine if the
*                      -    aura is active or not for the unit.
*
*       private static method removeBuff takes unit whichUnit, integer level returns nothing
*           (optional) -    Runs when the buff icon should be removed from the unit
*
*       private static method addBuff takes unit whichUnit, integer level returns nothing
*           (optional) -    Runs when the buff icon should be added to the unit
*
************************************************************************************/
    module AuraStruct
        static if not thistype.STACKS then
            private static integer array auraLevel
        endif
        
        private integer affectedLevel
        
        private static hashtable affecting = InitHashtable()
        
        static if thistype.removeBuff.exists then
            private static integer array buffCount
        elseif thistype.addBuff.exists then
            private static integer array buffCount
        endif
        
        private static integer array level
        
        private static triggercondition array onEnterT
        private static triggercondition array onEnterT2
        
        private boolean ran
        private boolean active
        private UnitIndex source
        private UnitIndex affected
        
        private method isActive takes nothing returns boolean
            static if not thistype.STACKS then
                static if thistype.filter.exists then
                    return filter(source, affected, level[source]) and (level[source] > auraLevel[affected] or affectedLevel == auraLevel[affected])
                else
                    return (level[source] > auraLevel[affected]) or affectedLevel == auraLevel[affected]
                endif
            else
                static if thistype.filter.exists then
                    return filter(source, affected, level[source])
                endif
            endif
        endmethod
        
        private method doEffect takes nothing returns nothing
            if (not ran) then
                set ran = true
                static if thistype.onEffect.exists then
                    call onEffect(source, affected, level[source])
                endif
            endif
            static if thistype.onPeriodicEffect.exists then
                call onPeriodicEffect(source, affected, level[source])
            endif
        endmethod
        
        implement CTQ
            local boolean wasActive
            local real x
            local real y
        implement CTQExpire
            set x = GetWidgetX(GetUnitById(source))-GetWidgetX(GetUnitById(affected))
            set y = GetWidgetY(GetUnitById(source))-GetWidgetY(GetUnitById(affected))
            
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"----------------------------------\n"+/*
            */"ability("+I2S(GetUnitAbilityLevel(GetUnitById(source), ABILITY_ID))+") != "+"stored("+I2S(affectedLevel)+") or "/*
            */+R2S(SquareRoot(x*x+y*y))+" > "+R2S(getRange(source, level[source]))/*
            */)
            
            if (/*
                    */GetUnitAbilityLevel(GetUnitById(source), ABILITY_ID) != affectedLevel or /*
                    */IsUnitDead(source) or /*
                    */IsUnitReincarnating(source) or /*
                    */IsUnitDead(affected) or /*
                    */IsUnitReincarnating(affected) or /*
                    */SquareRoot(x*x+y*y) > getRange(source, level[source]) /*
            */) then
                if (active) then
                    static if thistype.removeBuff.exists then
                        set buffCount[affected] = buffCount[affected] - 1
                        if (0 == buffCount[affected]) then
                            call removeBuff(GetUnitById(affected), auraLevel[affected])
                        endif
                    elseif thistype.addBuff.exists then
                        set buffCount[affected] = buffCount[affected] - 1
                    endif
                    
                    static if not thistype.STACKS then
                        if (affectedLevel == auraLevel[affected]) then
                            set auraLevel[affected] = 0
                        endif
                    endif
                    
                    static if thistype.onEndEffect.exists then
                        call onEndEffect(source, affected, level[source])
                    endif
                endif
                
                if (LoadInteger(affecting, source, affected) == affectedLevel) then
                    call RemoveSavedInteger(affecting, source, affected)
                endif
                
                call destroy()
                
                if (source == affected) then
                    call source.unlock()
                endif
                call affected.unlock()
            else
                set wasActive = active
                
                set active = isActive()
                
                if (active) then
                    static if not thistype.STACKS then
                        if (level[source]>auraLevel[affected]) then
                            static if thistype.addBuff.exists then
                                if (not wasActive) then
                                    set buffCount[affected] = buffCount[affected] + 1
                                endif
                                
                                static if thistype.removeBuff.exists then
                                    call removeBuff(GetUnitById(affected), auraLevel[affected])
                                endif
                                
                                call addBuff(GetUnitById(affected), level[source])
                            elseif thistype.removeBuff.exists then
                                if (not wasActive) then
                                    set buffCount[affected] = buffCount[affected] + 1
                                endif
                            endif
                            
                            set auraLevel[affected] = level[source]
                            set ran = false
                        else
                            call doEffect()
                        endif
                    else
                        call doEffect()
                    endif
                elseif (wasActive) then
                    static if thistype.removeBuff.exists then
                        set buffCount[affected] = buffCount[affected] - 1
                        if (0 == buffCount[affected]) then
                            call removeBuff(GetUnitById(affected), auraLevel[affected])
                        endif
                    elseif thistype.addBuff.exists then
                        set buffCount[affected] = buffCount[affected] - 1
                    endif
                
                    static if not thistype.STACKS then
                        if (affectedLevel == auraLevel[affected]) then
                            set auraLevel[affected] = 0
                        endif
                    endif
                    
                    set ran = false
                    static if thistype.onEndEffect.exists then
                        call onEndEffect(source, affected, level[source])
                    endif
                endif
            endif
        implement CTQNull
        implement CTQEnd
        
        private static method doEnter takes thistype this, UnitIndex entering returns nothing
            local thistype time
            
            local boolean canEnter = true
            static if thistype.absFilter.exists then
                set canEnter = absFilter(this, entering)
            endif
            
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"Entered")
            if (canEnter and LoadInteger(affecting, this, entering) != level[this]) then
                call entering.lock()
                
                call SaveInteger(affecting, this, entering, level[this])
                
                set time = create()
                
                set time.source = this
                set time.affected = entering
                set time.ran = false
                
                set time.affectedLevel = level[this]
                
                set time.active = time.isActive()
                
                static if not thistype.STACKS then
                    if (time.active) then
                        static if thistype.addBuff.exists then
                            set buffCount[entering] = buffCount[entering] + 1
                            if (0 != level[this]) then
                                call addBuff(GetUnitById(entering), level[this])
                            endif
                        elseif thistype.removeBuff.exists then
                            set buffCount[entering] = buffCount[entering] + 1
                        endif
                        
                        set auraLevel[entering] = level[this]
                    endif
                endif
            endif
        endmethod
        
        private static method onEnter takes nothing returns boolean
            call doEnter(GetEventSourceUnitId(), GetUnitUserData(GetTriggerUnit()))
            
            return false
        endmethod
        
        private static method onLearn takes nothing returns boolean
            local thistype this
            local unit u
            
            if (GetLearnedSkill()==ABILITY_ID) then
                set u = GetTriggerUnit()
                set this = GetUnitUserData(u)
                
                call UnitIndex(this).lock()
                
                if (null!=onEnterT[this]) then
                    call UnregisterUnitInRangeEvent(onEnterT2[this], u, getRange(this, level[this])-64)
                    call UnregisterUnitInRangeEvent(onEnterT[this], u, getRange(this, level[this]))
                endif
                
                set level[this] = GetUnitAbilityLevel(u, ABILITY_ID)
                
                static if thistype.onLevel.exists then
                    call onLevel(this, level[this])
                endif
                
                call doEnter(this, this)
                
                set onEnterT2[this] = RegisterUnitInRangeEvent(function thistype.onEnter, u, getRange(this, level[this])-64)
                set onEnterT[this] = RegisterUnitInRangeEvent(function thistype.onEnter, u, getRange(this, level[this]))
                
                set u = null
            endif
            
            return false
        endmethod
        
        static if thistype.addBuff.exists then
            private static method onIndex takes nothing returns boolean
                set buffCount[GetIndexedUnitId()] = 0
                return false
            endmethod
        elseif thistype.removeBuff.exists then
            private static method onIndex takes nothing returns boolean
                set buffCount[GetIndexedUnitId()] = 0
                return false
            endmethod
        endif
        
        private static method onInit takes nothing returns nothing
            local integer i = 15
            local trigger t = CreateTrigger()
            
            loop
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_HERO_SKILL, null)
                exitwhen 0 == i
                set i = i - 1
            endloop
            
            call TriggerAddCondition(t, Condition(function thistype.onLearn))
            
            static if thistype.addBuff.exists then
                call RegisterUnitIndexEvent(Condition(function thistype.onIndex), UnitIndexer.INDEX)
            elseif thistype.removeBuff.exists then
                call RegisterUnitIndexEvent(Condition(function thistype.onIndex), UnitIndexer.INDEX)
            endif
            
            set t = null
        endmethod
    endmodule
endlibrary


So... there will be an addBuff and removeBuff. I'll be updating my dummy caster thing so that it is 100% working so that addBuff can be used : ). Actually, as soon as I update my dummy caster and remove the messages in this system, it should be good to go. I've already coded it to the point where 100% custom auras are possible >.<.


The highest level buff will always display, even when buffs are stackable =).


Auras for dead units will still not be possible since I am using UnitInRangeEvent rather than group enums ;o.



Anyways... Blizzard's Warcraft 3 strikes me again with more nasty bugs =(.
 
Last edited:
JASS:
            local integer i = 15
            local trigger t = CreateTrigger()
            
            loop
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_HERO_SKILL, null)
                exitwhen 0 == i
                set i = i - 1
            endloop
            
            call TriggerAddCondition(t, Condition(function thistype.onLearn))
            
            set t = null

->

call RegisterPlayerUnitEvent(EVENT_PLAYER_HERO_SKILL,function thistype.onLearn)

;)
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Updated ; )


Should work perfectly now : P


Keep in mind that if you have ANY warcraft 3 aura abilities on ANY units, this will not work. It's either 100% custom or not at all ;P. The reason is because Warcraft 3 auras break the UnitInRangeEvent thing ;p.

edit
Updating it to work with things like SetUnitAbilityLevel : )
 
Last edited:
Level 7
Joined
Dec 3, 2006
Messages
339
JASS:
            call RegisterPlayerUnitEvent(EVENT_PLAYER_HERO_SKILL, function thistype.onLearn)
If your going to make dynamic auras then why make the only way that the auras can be used by learning them? Most maps that use dynamically triggered type auras aren't the maps that are using the regular wc3 way of adding abilities through leveling units I mean.

You could split it into a demo script that adds the auras for when skills are learned. Cause the other ugly alternative would be hooking when an ability is added to an unit.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I am never doing a BuffStruct. That's just a plain bad idea >.>.


Also, Switch33, after I finish this, I am planning to do other auras. Next I'm doing an ItemAuraStruct, and then after that a full custom aura struct where you have to create the auras etc yourself ; ).

this bug still exists.

I'll check it out as soon as I get the SetUnitAbilityLevel working properly. I have a feeling that the bug I'm running into with SetUnitAbilityLevel is the same bug you are experiencing ; p.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Double removal bug fixed!!


woo : D


I recoded some portions of this and handled the UnitInRangeEvent quirks that were causing the auras to bug


The double aura removal was from the UnitInRangeEvent quirk


I recoded some portions because there didn't need to be multiple instances between 2 units for the same aura ; P.


Now the only problem is that the code for each aura is like 6 kb of text, lol. Oh well, no way around it : |


Also, everything in the module, the arrays etc, have to be in the module. They are all aura specific >.>.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Creating a local to store an array index works out much better on
FPS than letting an array index be referenced so many times. Arrays
are quite slower than locals.

GetUnitX/Y was benchmarked faster than GetWidgetX/Y by multiple
people including myself with the RTC benchmarks and D4RK_G4ND4LF
with his crazy GUI benchmarks, and some others.

If the unit finishes reincarnating, or gets ressurrected or reanimated,
it looks like the aura doesn't re-register for that unit.

The module is absolutely gargantuan. Try to centralize things as much
as possible to shrink this beast. I have found some areas which help
somewhat if you want some ideas.

Collision sizes that you use for your event checkers should be configurable.
So should whether this applies to dead or living units or not, or if a dead
unit should have an aura.

Perhaps just throw out those living/dead checks and let the user decide
under what special conditions to remove the aura, and make it up to them
to decide when the aura should be re-added.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Collision sizes?? don't know what you mean


Also, it can't be centralized at all


Creating a local to store an array index works out much better on
FPS than letting an array index be referenced so many times. Arrays
are quite slower than locals.

sure

GetUnitX/Y was benchmarked faster than GetWidgetX/Y by multiple
people including myself with the RTC benchmarks and D4RK_G4ND4LF
with his crazy GUI benchmarks, and some others.

sure

If the unit finishes reincarnating, or gets ressurrected or reanimated,
it looks like the aura doesn't re-register for that unit.

Ah, that be right (source unit).
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
There are some areas to centralize, if you re-check my post (edit post==fail).

What I meant by collision sizes:

JASS:
        private static method unregisterRange takes integer sourceId, unit sourceUnit, real range returns nothing
            if (null!=onEnterT[sourceId]) then
                call UnregisterUnitInRangeEvent(onEnterT2[sourceId], sourceUnit, range-96)
                call UnregisterUnitInRangeEvent(onEnterT[sourceId], sourceUnit, range-32)
            endif
        endmethod
        private static method registerRange takes integer sourceId, unit sourceUnit, real range returns nothing
            call doEnter(sourceId, sourceId)
            set learning[sourceId] = true
            set onEnterT2[sourceId] = RegisterUnitInRangeEvent(function thistype.onEnter, sourceUnit, range-96)
            set onEnterT[sourceId] = RegisterUnitInRangeEvent(function thistype.onEnter, sourceUnit, range-32)
        endmethod

Where are you getting these numbers from? They look like collision size type numbers.

Also, instead of square rooting, maybe try using IsUnitInRange, and check if the target is
in range of the source. Cause maybe you want collision size factored in.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
The unit filters, for example, same with the initialization principle.

private function FilterUnits takes unit source, unit affected returns boolean

private function InitModule takes code a, code b, code c returns nothing

These are just examples.

And using Filter instead of Condition does the same thing but with a
shorter function name.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ahem, the filters can't be centralized at all.. they are aura specific, seriously >.>.

The init module can be centralized, but that looks like it ; )

edit
updated : P

Perhaps just throw out those living/dead checks and let the user decide
under what special conditions to remove the aura, and make it up to them
to decide when the aura should be re-added.

I can't do that because they don't fire UnitInRangeEvent ;p
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
If you have a dead unit on the map with an aura on it, it won't give off that aura >.>.

I'm not going to support dead unit auras because the range event won't fire, meaning that it'd require group enums, which is just too much overhead for it to be worth it.


On another note, I updated this to 2.0.0.0 : ). It can now handle anything ; P. It is no longer specific to abilities. The demonstration I have up is still the Devotion Aura ability =).

You can create super custom auras, ones based on wc3 abilities, one based on wc3 items, w/e u want ; P
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
>>If you have a dead unit on the map with an aura on it, it won't give off that aura >.>.

Well that's the way Blizzard programmed it for object editor auras, but the way you have it doesn't have to be the same.

Still using the "Condition" native and I don't know why. "Filter" is better. And I am not sure why you are still checking if the "affected" unit is alive periodically but checking if the source unit is alive by events. Or maybe I am missing something.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
And I am not sure why you are still checking if the "affected" unit is alive periodically but checking if the source unit is alive by events. Or maybe I am missing something.
I checked for the source unit only so that revive etc would work with it.

but the way you have it doesn't have to be the same

I already told you that that would require group enumerations, and that overhead is not worth it.

Still using the "Condition" native and I don't know why. "Filter" is better.
filterfunc extends boolexpr
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
>> I checked for the source unit only so that revive etc would work with it.

What about units under the effect of the aura who revive? They should re-register then.

>> filterfunc extends boolexpr

conditionfunc extends boolexpr

Filter() does the same thing as Condition() but is less text and also probably a faster call though that doesn't matter.

Why does this not work with wc3 auras?
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The UnitInRangeEvent won't fire until the aura goes away, and removing it doesn't seem to help >.>. This means that you can go a little out of range and then go back in and the buff is never put back on. The aura is never applied either. This applies to all auras that affect any unit >.>.

You can have auras that have no valid unit targets though : P (None), which is what I use in the demo map.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Well, if you completely replace wc3 auras with this, then ur good to go.


I think that I'm going to create a Buff Handler resource tomorrow ^)^. The buff handling in this is rather specific to auras, but you still need regular buff handling. The reason is because some buffs stack and some don't. If you buff a unit for +600 hp and then buff it for +400 hp, you won't know whether to apply that second effect or not and you won't know which buff to show ; P. You need a buff handler to handle that ^)^.


It should be something simple like ApplyBuff(ability, level, buff handler) -> boolean and RemoveBuff(buff) -> boolean =).
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ok, this update is going to take longer than I anticipated. I figured out a way to reduce the module size by A TON ; ). I can centralize the creation/destruction of the timer thing meaning that tons of the code will be gone =D.

Anyways, the planned update will hopefully have no bugs left (I found more possible bugs) and a smaller module.

However, this update could take me up to a week to finish. Sry about that : |.


Also, the new code will be extremely readable ; P.
 
Also, the new code will be extremely readable ; P.

Coined it: Less of a Nes Mess
xD

However, this update could take me up to a week to finish. Sry about that : |

No problem, we can do benchmarks while we wait :ogre_hurrhurr:

I figured out a way to reduce the module size by A TON ; )

Can't wait to see what you'll invoke ^^
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ok, fixed syntax errors with UnitInRangeEvent. I haven't worked on this in so long that I don't know what possible bugs I was talking about >.>.

The map I put up originally had different code and a different version in it (where I was centralizing everything), but oh well, got rid of it as I have no idea what I was planning, lol.

edit
and I now see the possible bugs I was talking about... >.<, doh

That code I deleted now makes a lot of sense.. I regret deleting it >.<.

edit
nvm, that bug I thought was a bug would never actually bug (it was the bug I was trying to resolve in the last update, but I realize now that it will never bug up).

edit
I still don't like the 400 line module tho : \, but I don't really see a way to centralize it. On the previous update, I hadn't started the centralizing yet. Well, I mean I do, but everything would turn into table arrays from integer arrays/tables, which would slow it way the hell down.. and it runs on a timer, meaning that maps with lots of units on them would begin to spike... like my wmw map that needs this... so I don't want to >.>. I'd rather have a 400 line module than an unusable script.

This is now ready for use.
 
Top