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.
[04:32 pm]
lil-Inferno -- "I think they doubled these limits. (not dimensions)" -NudeRaider
[2026-7-30. : 7:12 am]
NudeRaider -- cwinowich
cwinowich shouted: guys does anyone know, what is the max unit limit on extended now ?
don't quote me on it, but I think they doubled these limits. (not dimensions)
[2026-7-30. : 7:10 am]
NudeRaider -- Ultraviolet
Ultraviolet shouted: these guys may as well be pissing in the wind
sounds liberating
[2026-7-30. : 4:43 am]
cwinowich -- i cant quite remember, and cant find it anywhere, 2400 or something? idk
[2026-7-30. : 4:43 am]
cwinowich -- guys does anyone know, what is the max unit limit on extended now ?
[2026-7-30. : 2:47 am]
Ultraviolet -- these guys may as well be pissing in the wind
[2026-7-29. : 12:59 pm]
Vrael -- 1
[2026-7-29. : 10:32 am]
NudeRaider -- too much text. i cant tell which one yuo want removed. tell me 1, 2 or 3 for the one you want to keep.
[2026-7-29. : 3:16 am]
Symmetry -- that is a serious crime
[2026-7-29. : 3:11 am]
O)FaRTy1billion[MM] -- right to jail
Please log in to shout.


Members Online: Zycorax