playMaker

Author Topic: playmaker beginner: question for a state machine [solved]  (Read 2520 times)

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
playmaker beginner: question for a state machine [solved]
« on: April 14, 2014, 12:54:16 PM »
Hi Guys,

I'm new to Playmaker (downloaded it a few days ago) and still testing it out. I build some little state machines and watched a lot of tutorials to learn the fsm process. Now i want to build a statemachine which does the following:

1. enter triggerzone
2. press the E button, animation starts playing (switch turns on)
3. if the animation ends another animation starts playing
4. if you toggle the switch (press E again) the same animation on point 3. stops
5. if you're still in the triggerzone you can press E again and the process starts again

rulse:
- if you exit the trigger zone you can't press the E button (or nothing happens)

I have build different state machines for that, but the problem keeps the same (my actual FSM solution is attached below). If the player enters the triggerzone press E and exit it really fast, the switch animation isn't completed and the following animation does not start, because the Trigger Exit is set to global.

My question is now: is it possible to add an action event which says "play the States to the end"? or is my solution to complicated or not complicated enough? :D

thanks guys,
I'm looking forward to any answers :)

« Last Edit: April 30, 2014, 05:20:09 AM by Blubbfischtier »

MrShoestore

  • Playmaker Newbie
  • *
  • Posts: 7
Re: playmaker beginner: question for a state machine
« Reply #1 on: April 14, 2014, 03:29:39 PM »
so I'm new as well, and there maybe someone with a better suggestion… just throwing this out there as an idea

create a global boolean variable for the trigger.

have an fsm that does:
check Trigger_Enabled Boolean = True
then send to next state, which is
get "E" button down
that enables the animation fsm

in the animation fsm, the play animation action can send to a next state on finish. this state should check to see if Trigger_Enabled is still true (Bool Test), if so, it moves on to the next animation state. if not, it disables the fsm. that should let the first animation finish even if you walk off, because it's not looking to deactivate until after the finish event happens.

if I'm wrong, I'm sorry  :P

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
Re: playmaker beginner: question for a state machine
« Reply #2 on: April 15, 2014, 08:13:10 AM »
MrShoestore your'r right!

important is to split triggers/animations on two FSMs.
first FSM: press E and Set a Fsm Bool of the second FSM to True.
In the second FSM check if this bool is set to true, then play the animations.
Now if the player exit the trigger zone it doesn't affect the animations anymore because the global trigger exit is defined in the first FSM :)

thanks for your inspirations :)