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.
[03:42 am]
RIVE -- Hellooooo, Nurse
[04:19 pm]
NudeRaider -- Hello World!
[2026-6-01. : 4:03 pm]
IskatuMesk -- no Hello World? No Hello . jpeg? Not even ddosing some government website? smh my head
[2026-5-31. : 10:02 pm]
Symmetry -- I was really just figuring out how to compile
[2026-5-31. : 10:02 pm]
Symmetry -- I didn't make it do anything
[2026-5-31. : 9:17 pm]
Ultraviolet -- hell yeah. did you have trouble making the button functional, or just haven't gotten there yet?
[2026-5-31. : 8:29 pm]
Symmetry -- I made the marine shoot lasers and gave the medic a nonfunctional button
[2026-5-31. : 8:07 pm]
Ultraviolet -- Symmetry
Symmetry shouted: I did my first EUD thing today. Feels like me finding arsenal at age 8 again
haha for sure. in some ways it's even more exciting because you can play EUD maps on regular battle.net, don't need to convince someone to download your mod to play with you. what did you do?
[2026-5-31. : 6:47 pm]
Symmetry -- I did my first EUD thing today. Feels like me finding arsenal at age 8 again
[2026-5-31. : 3:20 pm]
l)ark_ssj9kevin -- le reddit
Please log in to shout.


Members Online: jun3hong