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

Trigger Not Setting HP Correctly

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
This is a trigger I am having run to set the life of a unit. Is there a leak in it or is it a math issue? What's going on with this trigger. It's only leaving base hp.
  • Grubmunch HP
    • Events
      • Unit - A unit enters Wave 1 through 15 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Grubmuncher
    • Actions
      • Set Boss_unit[1] = (Triggering unit)
      • Unit - Set life of Boss_unit[1] to ((Max life of Boss_unit[1]) x (Real(PlayersAvailable)))
 
Level 7
Joined
Oct 13, 2008
Messages
300
Wait, are you trying to change the unit's MAX LIFE via triggers? cuz that doesn't work out. ''Set Life of >unit<'' means that you'll be healing the unit, not giving increased max health.
 
Level 7
Joined
Oct 13, 2008
Messages
300
Propably not. I've only used GUI so i wouldn't know if it was possible via JASS... But no, its not possible with gui. All u could do is to make an research that increases the boss's health and run it via triggers...

Edit: yeah, or that. Don't double post btw :D Nawt cool dawg
 
Level 13
Joined
Sep 13, 2010
Messages
550
There is no way to edit ANY unit related thing in both GUI and Jass. The only way is to create abilities based on a unit max hp increaser ability( dunno name and WE not open ) for example it gives 10000 HP. You create 12 of it( Max player ) and add as much of them to the Boss as many player here. This is the only known way and I recommend it for you too.
 
Level 5
Joined
Sep 1, 2010
Messages
168
You could add an ability to the boss, giving it an amount of hitpoints depending on the number of players.
When you got 4 players, you need 2 abilities (from item ability changed to unit ability; levles don't work here).
1hero: do nothing (boss base hp)
2heroes: ability+1000hp
3heroes: ability +2000hp
4: +both abilities
 
Level 9
Joined
Apr 23, 2011
Messages
460
I don't know if this is proper or not, but this is the trigger I came up with to fix this.
  • Grubmunch HP
    • Events
      • Unit - A unit enters Wave 1 through 15 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Grubmuncher (1 Player)
    • Actions
      • Set tempLoc = (Position of (Triggering unit))
      • Set Boss_unit[1] = (Triggering unit)
      • Unit - Remove Boss_unit[1] from the game
      • Unit - Create 1 Grubmuncher[PlayersAvailable] for Neutral Hostile at tempLoc facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_tempLoc)
Players Available is an integer variable set by my initialization counting all players. Grubmuncher is a Unit-Type variable set in intialaization to 4 different Grubmuncher creeps with the base hp needed (My map is only 4 players) I think this should work no?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
1. Use tomes (warning, tome items are not removed after use and so can be called a leak).
2. Use the broken mechanic of how the +HP item ability levels to permantly change the unit's health as it does not remove the correct HP at levels greater than 1. (Warning, this will bug and can crash under certain conditions such as if the unit undergoes a chaos morph).
3. Use a series of parallel single level HP bonuses to increase the hitpoints as you wish. Usually done in powers of 2 and is the most common way to boost HP.
4. Make the unit a hero and boost his strength as strength usually is set to add HP.
 
Status
Not open for further replies.
Top