playMaker

Author Topic: [SOLVED] Global transitions problem  (Read 589 times)

Vaskel

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
[SOLVED] Global transitions problem
« on: February 23, 2017, 11:20:12 AM »
Hi everyone,

I'm in a big trouble with global transition and multi state.

In my project, I have a simple monster, which can attack or being hit by the player.

I have tested two different approach. Here's my FSM :

In the "Wait Next Atk" state I have a Wait action with the attack speed of the monster in parameter.



With this FSM, the Wait action continue to trigger the "Prepare Atk" state even if the monster is hit, but sometimes the Wait action stop and the FSM is blocked on the "Get Damage" state.




With this FSM, anything is ok but the attack speed is reset each time the player hit the monster.



And with this FSM, the monster attack each time he's being hit by the player. So the monster attack very quickly.


Do you have any ideas how I can setup this multistate (casting attack + being hit) ?


Thanks in advance, a nice day for everyone !
« Last Edit: February 24, 2017, 01:39:06 AM by Vaskel »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14471
  • Official Playmaker Support
    • View Profile
Re: Global transitions problem
« Reply #1 on: February 24, 2017, 01:08:23 AM »
Hi,

 yes, the key is to have several Fsm, that's all. an Fsm is a one task at a time only, since you can only have one active state at a time, so when you have such conflict, simply make one fsm for each individual tasks.

 you can possibly create a third fsm that will manage the common features like input reception or triggers and then it will send an event to the gameobject hosting both fsm implementing the particular features and so these feature Fsm are simply waiting with global transitions, they both receive the same global event at the same time and you can start having really distinct behavior working together.

This is KEY to master PlayMaker, so if you don't get this, let me know, you need to understand this to make the most out of PlayMaker.

Bye,

 Jean

Vaskel

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: Global transitions problem
« Reply #2 on: February 24, 2017, 01:38:03 AM »
Ok Jean, its seems logical. I will implement different FSM for this situation.

Thanks for your quick reply. Have a good day !