Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Haserhud on February 21, 2020, 12:22:30 PM
-
Hi all,
This is a weird one.
I have a Damage FSM set on objects, and I have a Health FSM set on my Player. The Damage FSM on objects affects player health by adding -1 to the global health variable I have set up, which in turn affects the player health FSM by using int switches.
Everything works great until I apply the damage-causing FSM to an object in motion (using the Move Towards action).
When the object is in motion and the player hits it, it's fine until it gets to the last heart. Once it gets to the last heart and they collide, the global variable for health goes crazy and rapidly decreases from 1 to negative hundreds, thousands, etc. And then the FSM for Health on my Player remains stuck on 1 health. I don't understand what the hell is going on here. I will supply the screenshots. I am highlighting where in the Health FSM it gets stuck.
Remember, this all works perfectly when the object the player collides with is not moving.
-
Adding an extra screenshot to show what I have on my WaitForCollision state.
-
Solved it.
Silly me. That final state of damage, I didn't have it going to another state after it was done. So it would sit on that state, adding -1 to the health variable every frame, which confused the health FSM and got it stuck.
I just told it to go to finished and then to a final state when done and it seems to work great now.
-
Hi.
I can see on 'Collision 3' that 'int add' is set to every frame.
This means that every frame it deduct 1.
also maybe its better to use a 'int compare' instead of switch
-
Hi.
I can see on 'Collision 3' that 'int add' is set to every frame.
This means that every frame it deduct 1.
also maybe its better to use a 'int compare' instead of switch
Man, you've saved my butt so many times now ;D
Thank you!