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.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: Zycorax, Roy