playMaker

Author Topic: Limiting the health bar [Solved]  (Read 2408 times)

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Limiting the health bar [Solved]
« on: August 25, 2014, 03:20:16 AM »
Hi.

I got a working health bar. However I need it to stop growing at its max (let's say 200). So whenever it's let's say 190 and I pick up a med kit worth of 20, it will stop at 200 and not become 210. Is there an action or combinationof actions I could use?
« Last Edit: August 25, 2014, 07:25:30 AM by jayf »

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Limiting the health bar
« Reply #1 on: August 25, 2014, 06:28:28 AM »
One of the clamp actions...  Either Float Clamp or Int Clamp.

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Limiting the health bar [Solved]
« Reply #2 on: August 25, 2014, 07:25:52 AM »
That's it! Thanks :).

mankind1

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Limiting the health bar [Solved]
« Reply #3 on: November 25, 2014, 09:04:34 AM »
Hi jayF,

How are you?
You wrote: I got a working health bar.
Could you please show me how you built your working health bar.
I have tried so many of the posts I found to no avail.
Thanks in advance for your help and understanding.


jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Limiting the health bar [Solved]
« Reply #4 on: January 03, 2015, 08:14:46 PM »
Hi mankind1

Sorry, I didn't know people would still post stuff on this thread. But here's how I did it incase you still need it (or somebody else out there needs it and stumbles upon this :) ).

1) Make a status bar graphic and import it. (I gave it 200 width pixels)

2) Give it an FSM

3) State 1 has a Wait action ( I can't remember why I gave it that though...)

4) State 2 has a Float Operator action. Float 1 contains the actual health amount I store in a a Global Float var, in my case I called it Hedeghog Health (give it any name). This Health Float gets divided by 200, the width of your health bar graphic and gets stored in another Float variable called Division_Results.

5) State 3 is simply another Float Operator. Which takes the above mentioned Division_Results and this time you multiply it by 200 (again the width of health bar).
Store results in another Float variable called Healthbar_Length.

6) State 4 is what actually changes the size of your health bar graphic. Apply a Set Property action. Target Object is your health bar graphic. For Property look at attachement to see what I used. For the width use the Healthbar_Length results of State 3.

That's it. Not sure exactly how it works myself since I'm basing this on a tutorial I found somewhere, forgot where.

By the way every time your character gets damaged make sure the damage subtracts from the "main health". In my case it's Hedeghog_Health in State 1. Any other questions PMing me would be much better :). Good luck!