Staredit Network > Forums > SC2 Assistance > Topic: [Solved] Arithmetic helps :( (maybe triggers)
[Solved] Arithmetic helps :( (maybe triggers)
This topic is locked. You can no longer write replies here.
Nov 2 2010, 2:36 pm
By: NicholasBeige  

Nov 2 2010, 2:36 pm NicholasBeige Post #1



So yeah, I havn't done any sort of serious calculation in ages... and this is just frustrating me more than anything else.

What I have is this:
  • A Dialog of 25 width, and 300 height.
  • A unit which starts on 120 hitpoints (the maximum value can change over time)
  • An item which increases current hitpoints by 25.

So, basically a health bar which represents my hero units currentl hitpoints.

This works perfectly fine when I am doing the following
  • Events
    • Hero unit takes non-fatal any damage (from any effects)
  • local variables
    • damage taken = real, default value 0.0
    • factor = real, default value 0.0
  • Conditions (none)
  • Actions
    • Set Variable (factor) = (300 / (Hero Unit's Maximum Life (Current))
    • Set Variable (damage taken) = ((Triggering Damage Amount) * Factor)
    • Dialog - set Health Bar size to (25, ((Height of Health Bar) - (Integer(damage taken)) for (All Players)

But, the problem arises when I want my Hero unit to be able to heal himself through a) items and b) sleeping/fountain type scenarios. Since there is no event for 'Unit takes Healing effect' - I tried using Unit Property Changes but this conflicts with the (already working) unit takes damage event.

Any hints, clues, tips?



None.

Nov 2 2010, 2:45 pm NicholasBeige Post #2



Nevermind. I feel like an idiot now.

I engaged my brain properly to the problem and now I just do this:
  • Events
    • Every 0.0 seconds of game time
  • Actions
    • Set Factor = (Hero Unit's current hitpoints / 300)
    • set Health Bar size to (25, (Hero Unit's current hitpoints / Factor)


Still feel like an idiot.

Post has been edited 1 time(s), last time on Nov 2 2010, 2:51 pm by Cardinal.



None.

Nov 2 2010, 2:58 pm NicholasBeige Post #3



Okay, I can redeem myself now...

set factor (real variable) == Unit Current hitpoints / Unit maximum hitpoints
set height of health bar == 300 * Factor

Cookies please!!



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-9-14. : 3:21 pm]
Oh_Man -- Racoon City Remastered*
[2026-9-14. : 3:21 pm]
Oh_Man -- Join the front line SEN, DEFEND MANKIND. 2030 is just a number! https://scmscx.com/map/2fHHj96p
[2026-9-14. : 3:21 pm]
Oh_Man -- from the maker of the legendary Architect RPG, the peerless Racoon City, the capitvating One Piercing Note, comes another creation minutes in the making
[2026-9-14. : 11:15 am]
Oh_Man -- heh heh thanks for the minerals suckers, now it's time to quit while i'm ahead
[2026-9-14. : 1:01 am]
Oh_Man -- Heroes of the Storm literally died and was revived before we got next SC game. Wb Loveless, u cooking any UMS for us?
[2026-9-13. : 11:35 pm]
LoveLess -- getting diablo 5 and wow 4 before starcraft ghost
[2026-9-13. : 9:22 pm]
RIVE -- To be fair, I used to post custom emotes back when I still used the forums.
[2026-9-13. : 12:54 pm]
l)ark_ssj9kevin -- RIVE
RIVE shouted: 💯
holy shit did you just use an emoji on SEN that feels illegal 🍆
[2026-9-13. : 10:24 am]
Moose -- Heinermann
Heinermann shouted: new era of SC and it's just some shooter they're gonna cancel before 2030
StarCraft 2: Ghost 2, The Reghostening
[2026-9-13. : 3:38 am]
Symmetry -- :wob:
Please log in to shout.


Members Online: l)ark_ssj9kevin, LoveLess