HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

UnitMaxState

08-31-2009, 08:12 PM#1
Earth-Fury
Zoom (requires log in)
Version 2.1
Introduction
UnitMaxState is written in vJass and requires the NewGen editor, or Jass Helper with PitzerMike's Object Merger configured for it. UnitMaxState requires the latest version of Jass Helper.

UnitMaxState is a library which allows you to modify a unit's maximum life, or maximum mana. To achieve this, the library abuses a bug with the AIlf and AImz abilities, explained by PitzerMike in his ability guide. I do believe it was indeed Blade.dk who initially found this bug. If not, it's still his system I stole and rewrote. Further, let me thank Deaod for writing up his version of this system, which inspired both the reality of this rewrite, and the method abilities are handled within it.

This library provides two functions for modifying a unit's maximum states:
function SetUnitMaxState takes unit target, unitstate state, real targetValue returns nothing
function AddUnitMaxState takes unit target, unitstate state, real additionalValue returns nothing
More information on the API is available in the libraries documentation.
Credits
The UnitMaxState Library
Requirements:
To add UnitMaxState to your map, copy and paste the below library in to a custom-text trigger in your map.

You will want to close your map after the first time you save it with UnitMaxState in it, reopen it, and disable ability (re)generation in the configuration section. If you fail to do that, a small delay will be added every time you save your map.

UnitMaxState Test Map 2.1.0.w3x
Expand UnitMaxState:

Change Log

Change Log

  • 2.1:
    • Switched ability creation to lua
    • Switched to optionally using external preload libraries
  • 2.0:
    • Complete rewrite
  • 1.0:
    • Ancient version

Attached Images
File type: pngUnitMaxState header.png (37.9 KB)
Attached Files
File type: w3xUnitMaxState Test Map 2.1.0.w3x (25.1 KB)
08-31-2009, 09:08 PM#2
Karawasa
Could you be kind enough to explain the differences between the systems? Why should I use your system over his, and vice versa? I notice the difference in the base, perhaps you could elaborate on that too.

I also think that you should give more credit to Deaod. Let's face it, your system didn't handle the abilities the way it does now. It used one giant dummy ability, and it's only this new version that has this change (in response to Deaod doing it). Please correct me if I am wrong...
08-31-2009, 10:10 PM#3
Rising_Dusk
EF's system not being submitted here was the reason Deaod submitted his. I have a funny feeling that Deaod would not feel hurt at all if his was graveyarded in light of this being submitted.
09-01-2009, 12:00 AM#4
Earth-Fury
Quote:
Originally Posted by Rising_Dusk
EF's system not being submitted here was the reason Deaod submitted his. I have a funny feeling that Deaod would not feel hurt at all if his was graveyarded in light of this being submitted.
I certainly hope I've created no animosity with this submission. I simply got thinking about better ways to do it, and ended up with a full implementation.

Quote:
Originally Posted by Karawasa
I also think that you should give more credit to Deaod. Let's face it, your system didn't handle the abilities the way it does now. It used one giant dummy ability, and it's only this new version that has this change (in response to Deaod doing it). Please correct me if I am wrong...
I did try to give Deaod a good measure of credit. You'll note that his name is the 3rd mentioned, and is mentioned separately from the list of much more indirect contributors. If he himself feels he deserves more credit than is currently given to him in this post and library, I will be more than happy to oblige. :) Though, I will add a mention for him in the first post of this thread right now, as opposed to just in the documentation for the library.

For the record, you are not wrong.

Quote:
Originally Posted by Karawasa
Could you be kind enough to explain the differences between the systems? Why should I use your system over his, and vice versa? I notice the difference in the base, perhaps you could elaborate on that too.
They are functionally identical, except in a few border-cases. (Eg: Handling unitstates other than max ones.) I would imagine most of those border cases are irrelevant to 99.9% of users.

As for which is superior... I've not examined the matter closely enough. I'll get on to doing a benchmark and such in a while. (Mayhaps later today)

Further comments welcome! :)
09-01-2009, 02:06 AM#5
Karawasa
Quote:
Originally Posted by Earth-Fury
Though, I will add a mention for him in the first post of this thread right now, as opposed to just in the documentation for the library.

I'm a nitpick for these type of things, so thank you for doing it.

Quote:
Originally Posted by Earth-Fury
I certainly hope I've created no animosity with this submission. I simply got thinking about better ways to do it, and ended up with a full implementation.

I can't speak for Deaod, but my experiences with the guy tell me there is probably no animosity at all. As a mapper, I like the competition :). I hope nothing gets graveyarded until we get benchmarks though.

Quote:
Originally Posted by Earth-Fury
As for which is superior... I've not examined the matter closely enough. I'll get on to doing a benchmark and such in a while. (Mayhaps later today)

That would be very much welcomed. I've been wondering about this ever since he posted his version (I was using your old version previous to that).
09-01-2009, 01:47 PM#6
Rising_Dusk
Is there any particular reason you went against all indentation standards and made the globals and englobals keywords at the beginning of your script right-justified?
09-01-2009, 02:21 PM#7
Earth-Fury
Quote:
Originally Posted by Rising_Dusk
Is there any particular reason you went against all indentation standards and made the globals and englobals keywords at the beginning of your script right-justified?

Yes. It fit the layout of the configuration block better. (In my opinion, of course.)
09-01-2009, 06:35 PM#8
Karawasa
Quote:
Originally Posted by Earth-Fury
Yes. It fit the layout of the configuration block better. (In my opinion, of course.)

Meh, I'd prefer to see it follow convention but I'm just one guy. Your constants also aren't indented correctly.
09-01-2009, 06:48 PM#9
Rising_Dusk
Other than weird indentation in spots, I don't see anything wrong with the code. I will wait until Ani has a look at it, though, and if after that no problems are spotted then this will be approved.
09-01-2009, 09:30 PM#10
Earth-Fury
Quote:
Originally Posted by Rising_Dusk
Other than weird indentation in spots, I don't see anything wrong with the code. I will wait until Ani has a look at it, though, and if after that no problems are spotted then this will be approved.
I'd like to hold off on approval/rejection until benchmarks are done. Of course, I can't seem to find working stopwatch natives anywhere... If anyone has a combination of stopwatch natives + war3.exe that work together, send em my way.

(If I can't get stopwatch for benchmarks in a few days, and if no one else does benchmarks, then I guess my request to hold off becomes a bit of a moot point...)
09-02-2009, 09:41 AM#11
Karawasa
Quote:
Originally Posted by Rising_Dusk
Other than weird indentation in spots, I don't see anything wrong with the code. I will wait until Ani has a look at it, though, and if after that no problems are spotted then this will be approved.

Since we have two submissions that accomplish the same thing but via different methods, don't you think it's a bit unwise to rush into approval?

Quote:
Originally Posted by Earth-Fury
I'd like to hold off on approval/rejection until benchmarks are done. Of course, I can't seem to find working stopwatch natives anywhere... If anyone has a combination of stopwatch natives + war3.exe that work together, send em my way.

Thank you for being reasonable. I hope you find what you're looking for soon.
09-02-2009, 01:17 PM#12
Rising_Dusk
These are the best that we have at current, and I've no clue if they still apply to the most recent 1.24b patch.
09-04-2009, 06:12 PM#13
Rising_Dusk
I tested this library and like it very much. I have only a few concerns.
  • Your preload libraries suck. What you should do is in the main library's initializer, create a dummy footman and add the abilities, then remove the footman. This would eliminate the whole overwhelming-ness of having the preload libraries.
  • call InitializeAbilitiesArray() is useless. Simply do everything in the Initializer and comment it to tell users what is going on.
  • You shouldn't make your error messages configurable. If a user screws up, you as the library author know where he screwed up, so you will tell him how he screwed up. If he plays with that configuration error function and is some terribad noob, he may confuse himself. It is our job as library authors to protect users from themselves.

    I say inline your ErrorMsg function and remove it from configuration entirely.
If you fix these things, this will be ready for approval.
09-05-2009, 07:37 AM#14
Earth-Fury
Quote:
Originally Posted by Rising_Dusk
  • Your preload libraries suck. What you should do is in the main library's initializer, create a dummy footman and add the abilities, then remove the footman. This would eliminate the whole overwhelming-ness of having the preload libraries.
Is it so overwhelming to add a second library to a map if you want preloading, with the option to use the xe library in the event you aren't a crazy ass NIHilist?

I'm perfectly willing to concede this point if you are not willing to concede it. It's a rather trivial matter.

Quote:
Originally Posted by Rising_Dusk
  • call InitializeAbilitiesArray() is useless. Simply do everything in the Initializer and comment it to tell users what is going on.

Yes. A relic from the way I initially wrote the system. (A whole lot of variable initialization...)

Quote:
Originally Posted by Rising_Dusk
  • You shouldn't make your error messages configurable. If a user screws up, you as the library author know where he screwed up, so you will tell him how he screwed up. If he plays with that configuration error function and is some terribad noob, he may confuse himself. It is our job as library authors to protect users from themselves.

    I say inline your ErrorMsg function and remove it from configuration entirely.

You've spent time in the acrid halls of the eternally vile Hive Workshop. You have seen the horrors stupidity can do to a man. One minute he's just sitting there, drinking an energy drink, coding a spell. Then, the idiocy comes. His guts laid bare. Flesh sundered from bone and soul to rot in the stench of the perverted den know as "The world editor help zone".

You can fight it as hard as your body will allow. Rend your arms through the almost solid wall of stupidity. Fight with every ounce of strength, until your body lies bruised and beaten; broken and defeated on the shores of some distant land of horror. Barely beyond the wet of the ocean before the idiocy has won.

We can't win against it. No one can. We can, however, lose. We lose by removing useful functionality which can only be abused by true stupidity. We lose by diminishing the works of the great, for the sake of those too tiny to even grasp the magnitude of the creation, let alone use it in the fabrication of the awe-inspiring. We lose by destroying ourselves for fear that we are of no use to those that would doom us to a fate no better than the eternal fires of hell!

TL;DR: It is out job to protect users from crazy unexpected border cases, by preventing undefined behaviour in every way possible. It is not our job to protect users from utter stupidity.
09-05-2009, 09:48 AM#15
Karawasa
Quote:
Originally Posted by Earth-Fury
You've spent time in the acrid halls of the eternally vile Hive Workshop. You have seen the horrors stupidity can do to a man. One minute he's just sitting there, drinking an energy drink, coding a spell. Then, the idiocy comes. His guts laid bare. Flesh sundered from bone and soul to rot in the stench of the perverted den know as "The world editor help zone".

Best description of THW I've seen.

Any luck with benchmarking? I only persist because I am dealing with insanely high health bonuses so...