YesNoOk
avatar

Custom Health System for Character (Anybody good at math?) (Read 1319 times)

Started by XxJRushxX, May 14, 2020, 02:13:05 am
Share this topic:
Custom Health System for Character (Anybody good at math?)
#1  May 14, 2020, 02:13:05 am
  • avatar
  • *
  • I like pancakes
  • Lol no
    • USA
Hello, again. I have yet another problem that I want to solve. This is all in ONE character. I want to make a system where the health would be divided up between the main character and his partner. (The character and partner can swap positions by pressing a button). The character in control would take damage and the amount of hp in his pool would decrease, and once it runs out, he dies. BUT the partner takes the position of the main character once he dies, and now the partner will take damage, and so on.

Unfortunately, I suck at math, and can't seem to get a system working for this type of thing. It's not impossible, just very difficult for me to figure out.

Here's an example of my plan:

Guy 1 has 500 HP
Guy 2 has 500 HP
(which is half of the total health set in constants)
Guy 1 takes some damage and has 300 HP left, then swaps with Guy 2
Guy 2 is defeated, prompting Guy 1 to come back in.
Guy 1 still has 300 HP.
The actual life bar should have 300 HP left as a result, going from 1000>800>300.

I'm asking for a bit much, so if nobody wants to help or failed trying, I'll switch to a different method. One where you lose health based on the attack attribute.
oh ok
Re: Custom Health System for Character (Anybody good at math?)
#2  May 16, 2020, 07:27:53 am
  • *****
  • Shame on you!
    • USA
This actually should be pretty easy. You helper character, "P1B", SHOULD have his own "life" that you can't see.
I found out making Yun&Yang.  But clone helpers can be killed by attacking them. So all you really need is a variable to monitor the main character's life, "P1A". Then when you swap back in, you'll use a Statedef -2. You use the trigger to check P1A is active, then check if the life != Var(718) and set the life value to var(718).
When you swap back in the life _may_ update to reflect P1B's health. Otherwise, do the same thing, set a var in it. Check if Parent,life != life and set the value to life.
vVv Ryuko718 Updated 10/31/22 vVv