• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] GUI Health Regen

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
It will be inefficient as hell to create 100 level of ability for Health Regen and dynamically changing its level to adapt the missing Health.

So, I created the ability without the 100 level parts, but still requires a function that increases health regen through function SetUnitLife, it's better than having 100 levels ability right.

Here's the test map.

Blood Mage has 5%, 25%, 50% current health at the start of the test respectively.

I don't know how the unit is registered to the system, I'm just assuming picking unit at the start of the map which has certain ability will register the unit.

I hope you can adjust the registration, if you can't just give me the conditions for unit to be registered to the system, I'll try to adjust the code.
 

Attachments

  • Health Regen.w3x
    14.5 KB · Views: 37

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
If you wanna it triggered, based on a item, you can do it like this

Trigger 1
  • Add to group
    • Events
      • Unit - A unit gains an item
    • Conditions
      • Item picked up = 10 hp regen pr 1% hp lost
    • Actions
      • Unit Group - Add (Triggering unit) to Regen10Group
      • Trigger - Turn on Regen Set <gen>
Trigger 2
  • Regen Set 10
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Regen10Group and do (Actions)
        • Loop - Actions
          • -------- Convert real value percentage to integer makes it a round number --------
          • Set Temp_Integer = (100 - (Integer((Percentage life of (Picked unit)))))
          • Unit - Set life of (Triggering unit) to ((Life of (Picked unit)) + (10.00 x (Real(Temp_Integer))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Regen10Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
If you trigger it, you would exclude every referance to health regeneration.
If you have for example another item that doubles your health regeneration, this wont work.

In the solution I offer, you also can make it percentual... if that is proper english at least :D

You just make 2 abilities based off a health regen ability (depends on what type of regen you want) and you give them both 10 levels.
level 1 has 0 regen, level 2 has 1 regen, level 3 has 2 regen, etc, etc, etc.
The second ability has the same but then 10 times as much.
Level 1 has 0 regen, level 2 has 10 regen, level 3 has 20 regen, etc, etc, etc.

With this you can fake 100 (0-99) levels while only having 20 levels in total.
Now you only have to set the proper levels once in a while... I think 1 second would be enough.

With this, you could use your 100 levels that you could have wasted into a better system that has 10.000.000.000 fake levels
Can you imagine how strong this is?
 
Status
Not open for further replies.
Top