playMaker

Author Topic: Health pickup FSM[SOLVED]  (Read 1557 times)

unearthly

  • Junior Playmaker
  • **
  • Posts: 62
Health pickup FSM[SOLVED]
« on: December 14, 2016, 05:41:21 AM »
Hi

I have made an Health Manager FSM which works fine for showing damage to the player using float values into a health bar, but I have been unable to feed in health pickups. Can anyone suggest how I can do this?

Thanks.
« Last Edit: December 15, 2016, 03:06:08 AM by jeanfabre »

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Health pickup FSM
« Reply #1 on: December 14, 2016, 06:30:36 AM »
Well, it's actually quite simple if you think about it :P. So a health pickup is nothing more than a gameobject with collider on it. So what you need to do is, setup a collider trigger action, set collider as the health pickup and then on trigger do various stuff, like if you players enters the health pickup trigger then add extra 20 health or so.

You can put two trigger actions in one state, but use different events for each, rather than just "FINISHED". You can also use local/global events to do this. There is a few ways to approach this... You can even use Get Trigger Info action to get the last trigger event, for example last game object hit, and then perform various actions based on which gameobject has been collided with.
« Last Edit: December 14, 2016, 06:32:14 AM by elusiven »

unearthly

  • Junior Playmaker
  • **
  • Posts: 62
Re: Health pickup FSM
« Reply #2 on: December 15, 2016, 12:23:00 AM »
 :) Fixed everything by using a Global Float Variable. Tried it before but it wasn't there under the pull down menu in the state on my Health Bar FSM, so I had thought it was not available. This time I just typed the name in, added it elsewhere as appropriate and everything works. Also got confused with tags, don't need them on objects with the trigger events already on them. Have been confused about many other things.

Added a Float Clamp on that variable to stop it adding beyond a certain limit and making the Health Bar graphic nonsensical when combined with health reductions via enemies.

Thanks for your response elusiven.