Help with increasing HP by a precentage.

Zonagle

New Member
Reaction score
1
I'm working on an RPG map, and one of the heroes has a morph spell.

This trigger runs when he changes into his new form (ignore some of the set variables, I know I don't use all of them, but they're there for messing around).

Trigger:
  • Events
    • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fire Form |cffeee24f[E]|r
    • Actions
      • Set Fire_Form_Caster = (Triggering unit)
      • Set Fire_Form_Point = (Position of Fire_Form_Caster)
      • Set Fire_Form_Level = (Hero level of (Triggering unit))
      • Special Effect - Create a special effect at Fire_Form_Point using Units\NightElf\Wisp\WispExplode.mdl
      • Special Effect - Create a special effect at Fire_Form_Point using Objects\Spawnmodels\Human\HCancelDeath\HCancelDeath.mdl
      • Player - Disable Circle Spell for (Owner of (Triggering unit))
      • Player - Disable Freezing Field |cffeee24f[W]|r for (Owner of (Triggering unit))
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Fire_Form_Point)


The return to normal trigger.

Trigger:
  • Events
    • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Fire Form
    • Actions
      • Set Fire_Form_Caster = (Triggering unit)
      • Player - Enable Circle Spell for (Owner of (Triggering unit))
      • Player - Enable Freezing Field |cffeee24f[W]|r for (Owner of (Triggering unit))


Now, I'm wondering how I'd go about increasing his HP by a percentage.

Example.

His max HP is 1000 (including bonuses from strength/items etc), then I want to increase that by say, 5%. Then, once he returns to normal, have his HP decrease back to what it was (down by 5%).

Thanks for taking the time to read this, and I'm grateful for any assistance you provide.
 

Yoshii

New Member
Reaction score
74
You will need to use jass to do such a thing as t here are no ability that let you gain a % of HP and then take it away.

You thread gave me an idea that I did not know was possible; I changed the tome of HP item from +50HP to -50 HP and it worked kinda strange so it might be a possibility there.

You could try adding/subtract to the hero stats also but that would affect his dmg if hes a strenght hero or the hero would gain regen on top
 

Zonagle

New Member
Reaction score
1
You will need to use jass to do such a thing as t here are no ability that let you gain a % of HP and then take it away.

You thread gave me an idea that I did not know was possible; I changed the tome of HP item from +50HP to -50 HP and it worked kinda strange so it might be a possibility there.

You could try adding/subtract to the hero stats also but that would affect his dmg if hes a strenght hero or the hero would gain regen on top

Well, perhaps if someone is feeling extra nice, they might write me the JASS script required for what I want. I can only hope. Thanks for letting me know though, now I won't sit there looking through all the GUI stuff trying to figure out a way.
 

trees123

New Member
Reaction score
6
It is possible to do it in GUI, albeit a very poor alternative. In order to do it, you make 2 upgrades, using the HP Bonus %. (One using a negative value, the other positive) Whenever the hero casts your spell, you order a dummy unit to research the positive upgrade, and when the timer expires, research the other upgrade. Problem is, it shows the message "Completed: Upgrade" You could bypass this by editing the game interface though. (Or at least I think so.) If no one helps you, or you can't find it, this would be the easier way out. :p
 

Yoshii

New Member
Reaction score
74
there are no HP % as far as know; there is animal war training but its not % based only +HP
edit: it seem you can edit animal war training to give % based instead but Im doubting the negative value
 

Yoshii

New Member
Reaction score
74
Look harder.

Edit to your edit: Go try it out then...

indeed i just saw, i didnt think it was possible as I havent used research much, the player would have to edit the % tho cause heres the scenario

you have 100 HP
you gain 3% your at 103%
if u make the upgrade gaining -3% then your at back to below 100 as 3 % of 103 is 1.03x3 or 3.09 for a total of 99.91 HP
now to make a working trigger out of this let me see.
edit: the problem with upgrade if they cant go down so you would need to have enough lvl in the ability for each time the player use the ability. as action wise you need to increase the lvl of the researcgh/tech everytime
 

trees123

New Member
Reaction score
6
I forgot to add to set the level to 100. If it isn't enough then use another upgrade. Like I said, very crude.
 

Emu.Man00

New Member
Reaction score
41
You can do this with Blade.dk's SetUnitMaxState system (from wc3c.net)

I attached his system that i added two triggers to: one to increase max hp by a percentage, and one to reverse that change.

With the code you have now you can use the 2 custom scripts from my triggers (named Increase and Decrease) and replacing the part "udg_i" with any real (i.e. 5 for 5%)

From what little I tested, it will work for anything under an 8671% increase.
 

Attachments

  • SetUnitMaxState.w3x
    19.8 KB · Views: 98

Zonagle

New Member
Reaction score
1
You can do this with Blade.dk's SetUnitMaxState system (from wc3c.net)

I attached his system that i added two triggers to: one to increase max hp by a percentage, and one to reverse that change.

With the code you have now you can use the 2 custom scripts from my triggers (named Increase and Decrease) and replacing the part "udg_i" with any real (i.e. 5 for 5%)

From what little I tested, it will work for anything under an 8671% increase.

Thank you, I'll test it out a bit later. +rep.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top