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

[Snippet] AuraStruct

Level 31
Joined
Jul 10, 2007
Messages
6,306
You don't need Table instances, you could just centralize all the arrays and access them privately via "private keyword blah". Unless you're concerned about hitting 2^13-1 instances for some reason.

You don't understand what I meant by needing table arrays.. they'd be 2D arrays -.-.


Anyways, this is good to go as is since I'm unwilling to turn the arrays into table arrays ; P.


It's only like 4 kb per aura anyways, so it won't add all that much to the map.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Actually, it looks like it bugs because of these lines right here.

JASS:
                        if (lev > auraLevel[affected]) then
                            if (not wasActive) then
                                set buffCount[affected] = buffCount[affected] + 1
                                set activeAura[source] = activeAura[source] + 1
                            endif

Those last 4 lines should go above the if statement. Right now, only the first aura will be applied and the second aura will never factor in. When the unit leaves range of first aura, the other aura is never applied. Moving those 4 lines out of the if statement will properly apply the other aura ; ).

onEndEffect is only run when the aura is actually removed. onStartEffect only runs when the aura is actually applied. This means that if 2 units give off the same aura at the same level, then only the first one applied will actually run onStartEffect and onEndEffect. When I fix this bug (a very fast fix, but I need to turn on my comp with the code on it to do it), then when the unit leaves the range of the active aura, the buff won't remove because the aura count will still be >0. The aura count for a given level increases based on how many auras of that level the unit is under. When the unit leaves the range of the second unit, then onEndEffect will run.


But yea, just change it to this
JASS:
                            if (not wasActive) then
                                set buffCount[affected] = buffCount[affected] + 1
                                set activeAura[source] = activeAura[source] + 1
                            endif
                        if (lev > auraLevel[affected]) then

And it should work perfectly ^)^

edit
damnit.. other bugs too.. apparently, the effects of same aura will stack because i made yet another blunder
JASS:
                        else
                            call doEffect()
                        endif

And then there are more blunders D:... I just need to fix this asap >.<..


This goes to show you that this resource wasn't properly reviewed before being accepted ; P. Ofc, this was partially my fault for being too lazy to go through the code (was focusing on my wmw map ^^).

Happily, the only bugs I see thus far are with non stacking auras of the same level : ), and really just those two. I'll code it up on Friday when I have time >.<. I have 0 time until Friday : (.
 
attachment.php
 

Attachments

  • ReviewTheySaid.png
    ReviewTheySaid.png
    83.3 KB · Views: 133
What I'm saying is that your stuff has many complexities. In the spell section it is required to provide a demo map which is able to test out the spell in various situations (a proper testing environment). How is one supposed to test for every possible error if some errors don't get found out because they were unpredictable? In real life people discover bugs in professional programs, because not even developers who are getting paid to review stuff can find all these things out.

I think I should make a rule that the creator of a JASS resource should either provide a test map or a test script which illustrates many different complexities of the script. Because expecting me, a volunteer, to do that for every single resource that gets submitted when I am also working 42+ hours per week with 2 hours per day commute, is a joke.

If you were in my shoes I think you would also make a lot of the same mistakes that I do or have done, because no one is perfect.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Eh, when I review scripts, I never test them, I just read the code and spot all the bugs ;\. I did that with a little bit of AuraStruct, hence why I spotted those bugs ; P.


95% of the bugs I fix in scripts are bugs I saw from reading the code, not bugs I experienced. I rarely fix a bug that I end up running into in a game or something. I hardly actually test a script ;o. When I do run into a bug from a script in a test or something, those are the bugs that are usually a nightmare to fix and are extremely difficult to find ; ). I'm talking like a bug that results from 5 different resources interacting strangely together (perfect alone, but not so perfect all together) ^)^. Or the Is Path Blocked bug resulting from poor object editor decisions rather than actual bugs in the code ;o. That one befuddled me for 2 hours because I could find 0 problems in the code, lolz... I finally decided to add pathing maps to the objects to see what would happen ; P.


But yea this
Because expecting me, a volunteer, to do that for every single resource that gets submitted

Is exactly why I don't want to be a moderator, because that's exactly what I do. I review every single line of code and learn the entire operation of the script >.>.

I was only a moderator on one forum for 1 week and I had to spend 10+ hours a day in order to keep up on the resources submitted there... that was not my idea of fun. I ofc properly and thoroughly reviewed everything, sometimes taking 3 hours for one resource.

edit
My suggestion is to review the code in bits. Maybe review these 5 lines this day and the next 5 lines another day. If it takes you 2 weeks to review one resource, that's not your problem. After all, you are volunteering your time ; P. But you should probably ensure that every resource is thoroughly and properly reviewed, even if it takes a lot longer ; P. Rather than trying to do it all at once, spreading it out over time decreases your work load. If you fall way the heck behind on resources, then that just means that THW needs to find more mods, that's not your problem : ).

edit
Look at how I reviewed Purge's CombatState and ReviveUnit for excellent examples on how to thoroughly and properly review resources ; P.

edit
I'm personally in favor of THW moving to a more standard resource depo where everyone can just put up their own resources and there is no approval process. If the author is reliable, people will use that person's resources. If people run into bugs, then it's the author's problem. If the author obviously stole another person's script, then that's where you come in (usually from a using hitting the report button). That's how it's run everywhere else, I don't know why the heck THW does it so differently with this weird approval process.

edit
Of course THW will never change over though. Why? No idea... but countless hours are being wasted on this stupid process. I don't much care for the ratings on scripts in Spells Section either... what constitutes a 5 star script? I've seen perfectly written scripts get 3 stars just because the mod didn't find them to be cool enough, which is a load of bs... that's personal opinion -.-. Really, if there are going to be ratings for scripts, it should get a 0 if it doesn't work, a 1-2 for bugs, a 3 for leaks and performance issues, 4 for some minor flaws, and 5 for totally perfect, but who is going to rate it? Who is qualified? Again... a total waste of time.

So I'm against everything that THW does with its spells section and JASS section right now, but like I said, they are probably going to stick on this bs system just because it's already all set up, sooo, w/e. Maps section shouldn't have ratings and etc either... really, no section should have these weird ratings or go through an approval process. Instead, it should be like every other community, where other people who are checking the resource out or are trying to use the resource report problems, or where the original author finds the problems themselves.
 
I don't know how some people rate the resources but basically the way I rate is on a scale of how well-written it is (efficiency, readability, comments, originality, usefulness) and if there are leaks or bugs or stuff doesn't work I don't rate yet it and give it "needs fix" status.

Personally, I disagree with YouTube's like/dislike feature because the five star system worked better for me and showed more realistic opinions. However, with things as sensitive as spells and maps that don't usually get more than a few votes would do much better to have a like/dislike feature.

I agree that if stuff was just left out in the open for the average joe to check it out, and report bugs, then the resource could get "buried" if it's no good. That would save me, Maker and Pharaoh_ a lot of work as well, and we wouldn't even have to have knowledge on the subject.

Pretty good idea from you, I think. But I don't know what you're talking about by Hive being the only system with this kind of setup - how is it different on TheHelper or wc3c? Stuff always has to get approved by a moderator there.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I don't know how some people rate the resources but basically the way I rate is on a scale of how well-written it is (efficiency, readability, comments, originality, usefulness) and if there are leaks or bugs or stuff doesn't work I don't rate yet it and give it "needs fix" status.

Personally, I disagree with YouTube's like/dislike feature because the five star system worked better for me and showed more realistic opinions. However, with things as sensitive as spells and maps that don't usually get more than a few votes would do much better to have a like/dislike feature.

I agree that if stuff was just left out in the open for the average joe to check it out, and report bugs, then the resource could get "buried" if it's no good. That would save me, Maker and Pharaoh_ a lot of work as well, and we wouldn't even have to have knowledge on the subject.

Pretty good idea from you, I think. But I don't know what you're talking about by Hive being the only system with this kind of setup - how is it different on TheHelper or wc3c? Stuff always has to get approved by a moderator there.

I mean that if you look at any other community with resources on it, excluding wc3 communities, they work the way I outlined it. This is purely a weird wc3 thing.
 
That's because there are a lot of people who upload shitty resources, and those resources are the ones that get the most attention, because the majority of modders are noobs who prefer leaky scripts that cause performance issues rather than well-written, clean and efficient scripts.

There has to be some moderation :/
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
That's because there are a lot of people who upload shitty resources, and those resources are the ones that get the most attention, because the majority of modders are noobs who prefer leaky scripts that cause performance issues rather than well-written, clean and efficient scripts.

There has to be some moderation :/

Protecting people from themselves is never the answer
 
Well WarChasers (Blizzard version) leaks thousands of handles and it has been played mostly fine for years. Though a lot of players drop in that game, could be because of leaks.

As long as users only put trusted resources into their map it will be fine. Moderators could still go around pointing out faults and indicating room for improvement, but it would be optional for the user at that point.

I think eliminating the approve/reject system is a pretty solid idea. Buried resources alone would be considered rejected.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ok, all of those bugs I mentioned before and more have now been fixed ; O.


I tried my best to break this latest version and couldn't break it ; P.


For non stacking auras, they operate exactly how you think they would. When 2 units are both giving off auras of same level, first one that got there will be giving off the aura. When unit #2 increases level of its aura, then unit #1 aura goes away and unit #2 aura is applied in that order ;o.

It works flawlessly ;D.


The only thing is that I had to add yet another 100 lines to the module for all of the fixes ;\.

1 non stacking aura with minimal code is 7kb. Using them sparingly ;).
A stacking aura with minimal code is 6kb. Use those sparingly too : P.


If anyone sees a way to reduce code size of module, feel free to give it a shot ^)^.

Events are a major no no : P. Those would destroy the speed >.<.


Oh yes, you can now have auras of 0 range, but those are kind of silly, heh.


Also, my suggestion is to create auras for units when they first learn the ability.

edit
units giving off aura will now be under the influence of auras with 0 range.
 
Last edited:
Nes, here's how you can decrease module code size:

JASS:
module DerpHerp

    // code

    static method blabla takes nothing returns nothing
        // ZOMG LOTS OF CODE BLAAAAAAAARFUGGH
    endmethod
endmodule

->

JASS:
public function blabla takes trollargs trollarg1, trollargs trollarg2 returns trolltype
    // ZOMG LOTS OF CODE ... AND IT'S OUTSIDE THE MODULE
    // PROFIT!
endfunction

module DerpHerp

    // some code

    static method blabla takes nothing returns nothing
        call LIBNAME_blabla(args, args, moar args, lol)
    endmethod
endmodule

It adds one function call, but reduces code size by a ton. (Maybe 150 lines)
Honestly, I think this is worth it.

Typically, a large map would have close to 300-400 spells, some of which are auras.
If we have about 90 auras, with your current Setup, those auras would be adding 630KB to the map. (lol)
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Fixed final bugs ;D


Rewrote timer code a bit so that stacking auras will now update the buffs on the units to show the highest aura

Removed unregister range in the deindex method. I ran my wmw map in debug mode and was spamming with double free errors in range event >: O. My auras now work in the map with 0 error messages, fuahahahaha ;D.

The freezing was not a result of this resource... it was actually a resource inside of that map for unit regeneration : (, so now I gotta go and fix that.
 
Level 6
Joined
Oct 23, 2011
Messages
182
is there some way to create/destroy auras manually, without having abilities?

does removing ability also remove aura? I'm trying to make a temporary aura lasting for a period without having an ability
 
Level 6
Joined
Oct 23, 2011
Messages
182
All i see is "An efficient and easy to use module for fully custom aura design."

I'm pretty confused. Am I supposed to set getLevel to return 0 when I no longer want my aura?

I don't know how exactly linked list works but wouldnt updating unit through createAura add it again to the list? addCheck is called everytime createAura is called.
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
This seems pretty clear to me

JASS:
*   static method createAura takes UnitIndex sourceId returns nothing
*       -   Call this when the unit initially gets the aura. This can also be
*       -   called whenever the aura's level changes for an instant update.

so when you want to add the aura to the unit, you call createAura... if you want to add it when the unit gets the ability, you register ability level up event or w/e to a method that calls createAura, which is what I did in the demo map.


This also seems pretty clear
JASS:
*       private static method addBuff takes unit whichUnit, integer level returns nothing
*           (optional) -    Runs when the buff icon should be added to the unit

It just appears to me that you didn't read the API.
 
Level 6
Joined
Oct 23, 2011
Messages
182
Did read API many times, guess this is more related to common sense

I cannot destroy the aura once I create it before the unit is deindexed (or dies)
I can only disable it, and if I want to add other factors I have to modifty getLevel to do so temporarily
(why do I have to do that on a method that simply returns level of aura?)

that's why I was asking about manual create/destroy; this only seems to support one aura of type per index though.. so I would have problem creating something like an item with aura that stacks, and equiping 2 of them

Yes these are probably my poor understanding of your system after spending considerable, difficult time reading your code

do you expect people to know these all?
would be nice to explain some stuff

Like the first 4 methods. am i supposed to figure what they do by looking at their name????

Do these count aura abilties in general? or a specific aura type?
Does getAuraCount return auras that werent applied due to no stacking as well?
getUnitsUnderAura - I'm assuming it returns units under inactive aura too..
However, it does not make sense that units can be affected by an inactive aura to begin with.


info like STACKS depend on aura's level.
when there are two non-stackable aura with same level, the first applied one remains. (Unconfirmed)
(I assumed your auras apply/remove buffs on TIMEOUT, so I wonder which one would be applied first)
getLevel returning 0 disables aura.. etc


Aura with target 'self' only and range 0 does not seem to break whatever event you mention.
If my assumption is true, slow aura may work well in this situation (stacks and does not show icon)
Buff like acid boom doesn't stack with same base abilities
If there is no stackable buff, I think you should tell that amount of aura structs you can create is limited

I think I also found a bug?

JASS:
    private static method onLearn takes nothing returns boolean
        if GetUnitAbilityLevel(GetTriggerUnit(), ABILITY_ID) == 1 then
            call createAura(GetUnitId(GetTriggerUnit()))
        endif
        
        return false
    endmethod
        
    private static method onInit takes nothing returns nothing
        call RegisterPlayerUnitEvent(EVENT_PLAYER_HERO_SKILL, function thistype.onLearn)
    endmethod

Whether filter returns true or not, the source isnt affected by aura when creating aura like this
Map attached
 

Attachments

  • AuraStructTest.w3x
    66.6 KB · Views: 28
Last edited:
Level 6
Joined
Oct 23, 2011
Messages
182
active[time] is false for source.. if that helps

If unit has ability prior to creating aura,
that is, if getLevel returns > 0,
the source is not affected. (seems permanent)
 
Last edited:
Level 6
Joined
Oct 23, 2011
Messages
182
Here I updated Aurastruct and Timer Tools to latest versions

in the "Doesn't work" version, the caster is not affected by aura at all
And yes, even with updated versions the bug is still there

not even sure if this is the bug I was talking about.. seems like ages ago
 

Attachments

  • AuraStructTest.w3x
    76.2 KB · Views: 48
Level 31
Joined
Jul 10, 2007
Messages
6,306
Uh.. if you didn't modify your test code, the reason that caster/target aren't modified by auras is because you don't do anything, lol... there really is no way to tell if they are or not w/o you doing something ;p.

You don't return the buffs for the auras or anything ; ), so you can't even tell if they have it or not. Furthermore, ur auras don't do anything at all ;p.


Add actual stuff like reducing life and returning buffs to see if it works or not. If you're not sure how, look at my demo, it does all of that.
 
Level 6
Joined
Oct 23, 2011
Messages
182
Dude I don't even understand you now.. what are you talking about?

Just run the test map. I simply used addition/removal of buff to see if unit is affected or not..
You want me to add some status library and add some stat bonuses to show you that its not working?
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Dude I don't even understand you now.. what are you talking about?

Just run the test map. I simply used addition/removal of buff to see if unit is affected or not..

Ah, I see that you changed the code. Let me look over it a moment ; ).

edit
What is the problem? I ran the map you sent and it works perfectly, lol.

edit
I see the bug now ; o.
 
Top