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

Associate Object Editor properties with variables?

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
107
Is it possible?
Suppose I have custom attributes like Attack Power, Spellpower, Stamina, etc.

Those attributes are managed by using variables of the type "Real" with 8 arrays (1 for each player).

So, I have the variable Stamina[player number of owner of unit].
Can i associate this variable to the unit's total Hit Points and Hit Point Regeneration, in the Object Editor?

If not, is there any practical way of doing this, besides setting a "Set life of unit" trigger for every possible situation when Stamina is gained or lost?
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Well how exactly do you want to associate it with the unit? If you want Stamina to increase health, you can just do that with a small math formula (like Set (Life of YourUnit) = (Life of YoutUnit + (Stamina[(Player number of (Owner of YourUnit))] * 100)) whenever Stamina changes.

The only way this would be impossible is if you make it really, really complicated. But I doubt something thát complicated will ever be needed, so I can pretty much guarantee you that you can easily make custom stats.
 
Level 5
Joined
Feb 1, 2009
Messages
107
Well how exactly do you want to associate it with the unit? If you want Stamina to increase health, you can just do that with a small math formula (like Set (Life of YourUnit) = (Life of YoutUnit + (Stamina[(Player number of (Owner of YourUnit))] * 100)) whenever Stamina changes.

That's exactly what I want to avoid =P
What I want to do is not exactly what you said (Stamina increases health). It's more like "Health is in function of Stamina". This way, anytime a unit gains OR LOSES stamina, the game would update the Health value for itself, without the need of a trigger for every possible situation when Stamina is gained/lost.
The way i thought this would be possible was if variables could be understood by the Object Editor, or something like that. Like editing the "Hit Points Maximum (base)" property of a unit and instead of giving it some number, giving it something like "=Stamina * 100" (Stamina being an already created variable).

Something I was thinking of was...

I could make a trigger that checks for conditions every 2 seconds or so. The action for this trigger would be "Set life of unit to Stamina(number of owner of unit) *100"
This way, everytime the game runs other triggers that modify Stamina, it would adjust the Life of the unit properly (or every 2 seconds).

But that would mean at least 6 triggers running every 2 seconds (I want 6 custom attributes). Would that overload my map?
 
Status
Not open for further replies.
Top