• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Increases a summoned unit's HP by the amount of hero attributes

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2012
Messages
158
Hello everyone!
As the title says, i'm trying to figure out how I can increase a summoned unit's HP by the amount of the Intellect + Agility + Strength of the Hero. The unit is spawned by triggers. Initially I just made hp-bonus item spell that had 200 levels and set the level of the ability to the total amount of attributes the Hero had. But it doesn't work.
Do any of you have an idea on how to solve it? :) Thanks!
 
Level 7
Joined
Jul 9, 2012
Messages
158
Thank you very much. This might belong to the triggering section, but I used a system made by Blade.dk
Link: http://www.wc3c.net/showthread.php?t=80490

And I can't get it to work. This is the trigger shown in his demo-map:
Help.png

In my own trigger, the custom script is:
  • call SetUnitMaxState(udg_ForceOfNature_treant, UNIT_STATE_MAX_LIFE, udg_ForceOfNature_integer2)
, where the ForceOfNature_treant is the spawned unit and ForceOfNature_integer2 is the total amount of attributes of the Hero. Blade.dk mentioned in the demo map that you had to copy the raw-code of the life-modifier ability and insert it into your code. Yet, I can't figure out how/where and why.

He exclaimed this in the demo-map:

Also copy the two abilities, and find the places where it asks for rawcodes in the code you just copied.
Replace the rawcodes there with the rawcodes of the two abilities in your map.

To know what the rawcode of an ability is, open Object Editor, select the object and press CTRL+D.
Now all object names has changed, the first four characters (case sensitive) of the object is the rawcode.
_______________________________________________________________________________________________________
function SetUnitMaxState takes unit whichUnit, unitstate whichUnitState, integer newVal returns boolean
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
You use the function in the exact same way as SetUnitState, the arguments are the same.
Just only use UNIT_STATE_MAX_LIFE or UNIT_STATE_MAX_MANA. If you use another unitstate there, the function
will do nothing and return false, else it will return true.

Do you perhaps have any knowlegde in this code or system? :) Thanks!
 
Level 7
Joined
Jul 9, 2012
Messages
158
Sorry for asking lots of questions - I really appreciate your help. I tried reading raw-code tutorials, but I couldn't find any that exclaimed how to change or modify raw codes within the object editor.
The raw code of the demo map is A000, and the raw code of the ability in my map is A01|.

EDIT:
Never mind, I got it now! Thanks alot for your help :)
 
Last edited:
Status
Not open for further replies.
Top