Warcraft III resources & community, 2003–2006 · archived

Bonuser v1.2

not rated
Submitted by EdwardSwolenToeSystems254 downloads26 KB
Screenshot
Screenshot
Allows bonus stats to units for Health, mana, armor, damage and Hero Stats. Now also allows negative values.
File Name
Bonuser v1.2.w3x
Author
Edwardswolentoe
Download

Comments

11
Yes an my version is optimised. I dowbt this could be done without jass.
Working fine isn't why you use jass. If all you want is it to work fine just use GUI. When you use Jass you do it because of ease and the fact that you can optimize. Vexorian and my version are still far more optimal then this.
It works fine. :)
It's still ineffecient. Your get method could be optimized by caching unit data, instead of looping through. Your bit check is also odd. Just check if its greater, don't always call Pow, pow is slower than devision.
Ok new version 1.2.


    1. Optimised most of the code, so now it should run smoother.
    2. Added a GetBonus() function.


How do you like it?
I'm annonymous. Or was, I have no idea why it showed up as Anon.

I'm not criticizing you, I'm criticizing your effort. Vex and I have both said it would be best to use one or the others version.

Natives are faster than blizzard.j wrapper functions. This is why you use the native.

Overflow protection is something your version truly doesn't need to bother with because you don't include an add or a get bonus method. But essientially, if your bonus is 1050 and the limit is a 1023, if you were to subtract 25 bonus, an overflow protected system would do nothing. An unprotected system would do work unneccessarily.

Remember when I said our versions were optimized? Vex and I have worked on our versions for over a year.

Calling remove every time is ineffecient. Because that means your doubling the work it does (your trigger runs at big o (2n) because it does two linear calls, when all it needs to run of n) You should interlace the calls like such

If(Bonus>Bit)then
call UnitAddAbility( ...)
else
call UnitRemoveAbility(...)
endif

This would get rid of the whole remove method, as all you would need to is make it
function Remove ...
call setBonus(hero,0,typee)
endfunction
wow anonymous, ok im not the greatest bloody triggerer in the world. I only learned jass about 2 months ago and pieced it together myself.

As i was saying this version is the first fully working one. Its not fully optimised.

And what do you mean your version if i see correctly you are Vexorian. As i see your version has what you say "overflow" protection whatever that may do.

You use Blizzard.j wrapper functions, you should use natives.


Natives? I dont see any difference between UnitAddAbilityBJ() and UnitAddAbility()

you use ISignBJ(value)==-1, when you should just use Value<0.


And yes im not the greatest mathematics expert.

Your "optimizer" call "all" is kind of worthless, as rarely do you want to give a flat bonus to all stats, but you may want to give 5 arm, 20 dmg and 150 hp, or something like that.


Worthless or not, i had a use for it and thought it would be a help to put it in.

@ TorontoRock, as i see there is nothing wrong with my version. In the eyes of 'pros' its deemed inefficent, but it does its job and it shouldnt leak or cause lag. But if you must you can find their versions somewhere. Part if invex or dt4a or whatnot.
If anonymous or weaaddar or vexorian have alternate versions of this type of system, can someone tell me where I can download em?
As far as i can tell my system does everything your system can do (and maybe more).

Im still figuring out what your triggers actually do. They seem more complex than what is required.

What is the problem of using if statements inside the loop? As i correctly see you use if statements in side your loops.

One function per ability, although as with the hero attributes, i could have just limited it all down to one function, but it would be the same in the end (if not more difficult to understand).
And the string system in my opinion is easier to remeber and use than say integers. Also my system does not use any variables.

And yes my code is a bit erratic, although it is not finalised. This is my first fully working version and it should be optimised in the near future.
Well, I'll say its ineffecient, you shouldn't have the if statements inside the loop, why do you use strings, when ints are far easier on war3? You also ahoulsn't need seven different functions to get to your ability sets. I still think that it would be best for anyone to use the bonusmod versions made by me or vex.

People, don't think its a horrible thing to use other's code. Very often in real work scenerios the benefit of having somebody else having written a clever algorithm to solve a problem is immeasurable. BonusMod is a very simple system, but because of its simplicity, vex and I have killed many unneccessary bits of code.
This is a system that allows you to edit unit statistics that cannot be edited using triggers. It can give units health, mana, armour, damage and hero stats (int,agi,str).

Im aware that Vexorian and Weaadaar made their own versions of this, although i am no where near stealing it. This is my own version and it was 100% triggered by me.