playMaker

Author Topic: OK so how would I...  (Read 4182 times)

MGB

  • Playmaker Newbie
  • *
  • Posts: 4
OK so how would I...
« on: February 22, 2014, 12:36:52 PM »
New to Playmaker, had a little play with it but not sure how I can get the flow control I'm looking for (and if it's possible).

I have an AI with idle and path-following states among others.  I want a global transition to defensive state when threats are near, stay in that state for a min time then pop back to whatever state we were in previously if no threats are near any more.

I see there are Wait and GotoPrevState actions, but can't see how to use them for my needs above.  It's like I want some sort of flow control to GotoPrevState on an event rather than an action..?

Is this possible?  I know can write custom actions that do the control but I was hoping to accomplish it on the high-level visual PlayMaker level so our non-coders can tweak it more easily.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: OK so how would I...
« Reply #1 on: February 22, 2014, 02:52:04 PM »
Try this action:
http://hutonggames.com/playmakerforum/index.php?topic=6442.0

It's GoToPreviousState with the Wait delay. This should fix your issue with leaving the state with Wait and compromising the previous state log.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

MGB

  • Playmaker Newbie
  • *
  • Posts: 4
Re: OK so how would I...
« Reply #2 on: February 23, 2014, 08:07:23 AM »
Thanks for that Lane - it could be useful...

The main problem for me persists though - wanting to return to the previous state on an event rather than an action.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: OK so how would I...
« Reply #3 on: February 23, 2014, 08:41:32 AM »
Firing an event means leaving the state, so unless its a global event then it won't work because the previous state becomes the one you fired the event from. You can setup other conditions in a custom action pretty easily of course but it seems like the basis of using an event contradicts what you want to do.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

redikann

  • Full Member
  • ***
  • Posts: 174
Re: OK so how would I...
« Reply #4 on: February 23, 2014, 06:07:55 PM »
Is this not what you mean? Kinda tuff unless we could see where you are stuck at and a little better understanding on what your trying to accomplish.

MGB

  • Playmaker Newbie
  • *
  • Posts: 4
Re: OK so how would I...
« Reply #5 on: February 24, 2014, 10:50:20 AM »
Hi red; it's almost that, except the blue arrow wouldn't lead to a particular state, but perform a 'GotoPrevState' instead.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: OK so how would I...
« Reply #6 on: February 24, 2014, 11:31:19 AM »
Use a global event, then GoToPrev will work.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

redikann

  • Full Member
  • ***
  • Posts: 174
Re: OK so how would I...
« Reply #7 on: February 24, 2014, 04:08:53 PM »
Ok, well take what Lane just said and think of it like this, State 3 would be entered just like you said with the global event and when it was done could go back to an AI loop (or whatever). Global Events are powerful because they let other FSMs dictate the control of another FSM or in the case of animation you can jump around states without directly linking them.

*I think I get what you want now. You want to string together some States for AI but at anytime an enemy is detected you want to jump to a defensive state and when the threat clears jump back into the previous state whichever it may be.
You could easily setup another master fsm that would simply monitor for threat. When it's conditions are met it could force your other fsm to go to your global defensive state. That state could have the Goto previous state action or whatever logic before it returned.
« Last Edit: February 24, 2014, 04:22:17 PM by redikann »

MGB

  • Playmaker Newbie
  • *
  • Posts: 4
Re: OK so how would I...
« Reply #8 on: February 25, 2014, 04:53:38 PM »
That's the idea redikann :)

Unfortunately I can't now view Playmaker editor window in my project for some reason, so will have to sort that out before trying this :-/

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: OK so how would I...
« Reply #9 on: February 25, 2014, 04:55:26 PM »
You can bring it back by going to the menubar PlayMaker then choosing PlayMaker Editor. That should bring the editor back. It goes away if you open a project that doesn't have it imported and the place it was just says Failed to load.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: OK so how would I...
« Reply #10 on: February 25, 2014, 04:57:29 PM »
There's also a Unity bug where third party editor windows can get "lost" and you need to reset the layout to get them back...

redikann

  • Full Member
  • ***
  • Posts: 174
Re: OK so how would I...
« Reply #11 on: February 25, 2014, 06:25:43 PM »
Yeah sometimes a lot of editor windows will cause havoc. I seem to have most of my problems with Pro builder and pro grids. I love those assets as much as I love Playmaker but they can be troublemakers sometimes.