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.
[05:25 pm]
Ultraviolet -- in EE2 you just open DatEdit, go to the flingy tab, and make whatever changes you want. Though if you want to do dynamic shit, you have to use the trigger editor with the setdatfile action. And of course you have to inject your changes when done. Can give more specific troubleshooting advice if you provide more details
[05:20 pm]
Ultraviolet -- Symmetry
Symmetry shouted: why can't I seem to make eud editor change flingy.dat D:
Are you using EE2 or EE3?
[04:57 pm]
Symmetry -- wdym
[02:24 pm]
Apos -- :wob:
[04:16 am]
NudeRaider -- files in c:\program files\ are protected
[08:11 pm]
Symmetry -- why can't I seem to make eud editor change flingy.dat D:
[2026-7-11. : 4:33 pm]
Ultraviolet -- :wob:
[2026-7-10. : 11:00 pm]
Vrael -- :wob:
[2026-7-10. : 5:18 pm]
IskatuMesk -- :wob:
[2026-7-10. : 7:29 am]
Zycorax -- :wob:
Please log in to shout.


Members Online: Ultraviolet