playMaker

Author Topic: Health Regen - what have I done wrong now?  (Read 1871 times)

GuinUK

  • Playmaker Newbie
  • *
  • Posts: 6
Health Regen - what have I done wrong now?
« on: July 06, 2017, 03:53:55 PM »
Hi guys,

I've made a very simple FSM that works on the basis that my character has a health regeneration suit on.

Basically I have a global int variable called playerhealth.

I want to check health is below 10000
If it is I want it to regen 24 per frame until it hits 10,000 again where it needs to remain idle.

Can anyone see what I've done wrong?

Thanks in advance

Guin

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7517
    • jinxtergames
Re: Health Regen - what have I done wrong now?
« Reply #1 on: July 06, 2017, 10:56:18 PM »
Hi,
i tested the state you are showing and that seems to work on my end,
although i would not recommend doing it this way.

i would split it into 2 states and from int compare point Less Than' to the int add state and also add a wait action (set to 0.1 or so)

because if you do this by every frame, it will differ from each machine it is played on.
For example on a old computer it might be 24 frames per second and on a new computer it might be 120 frames per second.

If you can't get it to work, can you show the check health state.

GuinUK

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Health Regen - what have I done wrong now?
« Reply #2 on: July 07, 2017, 04:07:42 PM »
Ah of course - damage/health regen  would be proportional to fps rate.

Thanks - that would have been quite an imbalance.
I'll let you know how I get on

GuinUK

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Health Regen - what have I done wrong now?
« Reply #3 on: July 07, 2017, 04:51:04 PM »
Ok I have managed to get it working.

It wouldn't work with the int that I had set up as the global.
Basically converted it from an int into a float during an earlier step and it all worked fine.

Not sure why it went squiffy but working now, thanks