• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Best SetUnitMaxState type system right now?

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
BonusMod gotta be the first one that comes to mind and thus the most common one.

Nest tried to make his version but I don't think it was appealing to the general crowd. It's highly possible that it's better performance wise though.

edit:

Ap0colypse sent me a GUI version which I assume he made himself, this was a few years back but I still have it. Hardly the best one performance wise since it's GUI but if you prefer GUI I can send it to you.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
The one by earthen fury (or something like that) has got two flaws which I must mention.
1. The main function (the one that does the work) and the redirecting function (the one that redirects to the main function as a wrapper for easy usage) are flipped.
The systems method is to increase/decrease he or mp.
However, the main function seems to be "SetUnitMaxState ()"
2. When you are changing a lot of hp/mp, the system will either crash or come to the op limit because the abilities that are used do not get to high enough.

Iirc, he did create the abilities with the preprocessor functions, but if not, that wouldoesn't also be a must.

Nestharus' one will probably be the best performance wise cause he uses based numbers.
But apart from that, changing the one in BonusMod by the two changes above would do fine.
 
Dat-C3 came up with a pretty cool method if you only need to set max hit points:
JASS:
function SetUnitMaxLife takes unit u, real newLife returns nothing
    local player p = GetOwningPlayer(u)
    call SetUnitOwner(u, Player(14), false)
    call SetPlayerHandicap(Player(14), GetUnitState(u, UNIT_STATE_MAX_LIFE) / newLife)
    call SetUnitOwner(u, p, false)
    call SetPlayerHandicap(Player(14), 1)
endfunction

Player 14 is Neutral extra. But it is usually nice to have the other features of BonusMod, so I just end up using that instead. I just figured I'd throw this out there as an option.
 
Status
Not open for further replies.
Top