• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

How to adjust unit property?

Status
Not open for further replies.
Level 31
Joined
Jun 27, 2008
Messages
2,557
Hello.

1. How to, for example, set unit's life and mana to the amount that is equal to another unit's life and mana? I tried to Set Value, but it didn't help.

2. How to set unit's attack base damage, for example, that is equal to 10% of hero's hit points.

Thanks.
 
Both can be done by implementing Bonus Mod and SetUnitMaxState.

1) use the lines
call SetUnitMaxState( unit1, UNIT_STATE_MAX_LIFE, GetUnitState( unit2, UNIT_STATE_MAX_LIFE ) )
call SetUnitMaxState( unit1, UNIT_STATE_MAX_MANA, GetUnitState( unit2, UNIT_STATE_MAX_MANA ) )
This will change "unit1"s HP/Mana to be equal to that of "unit2".

2) use the line
call UnitSetBonus( unit, BONUS_DAMAGE, R2I( GetUnitState( hero, UNIT_STATE_MAX_LIFE ) * .1) )
Of course, this is bonus damage, so the base damage has to be 1-1 (and then just subtract 1 from the bonus damage).


Of course, you will need JNGP for that (those systems can be made with GUI if necessary, but if using vJass isn't a problem for you, then this would be easier).
 
Level 31
Joined
Jun 27, 2008
Messages
2,557
Ah, alright. Yes, only those. So how to do it with GUI?

Edit: I managed to deal with hit and mana points. I used a GUI system made by Snippet, it works concerning hp and mana. If someone would be willing to help me out with damage issue, I would appreciate it, even though I could be fine absent it.

Edit: Nevermind. Solved it all. Thanks for the help, ap0.
 
Last edited:
Status
Not open for further replies.
Top