playMaker

Author Topic: Newbie Question: How do i Interrupt "Move Towards?"  (Read 5183 times)

Red

  • Hero Member
  • *****
  • Posts: 563
Newbie Question: How do i Interrupt "Move Towards?"
« on: June 18, 2011, 08:38:49 AM »
the title pretty much says it all... i've been working on AI and i like how the "move towards" function is compact, easy to use and all that... but, it seems not to allow me to set in some conditions such as the range for ranged attacks and melee attacks and branching out to them. it's almost like the Move Towards action does it's thing until it reaches the end distance. (which isn't really going to help me with the conditional statements i need to set up the actions that branch from it.)

am i missing something rather fundamental or is that action just plain uninterruptable?

Xtopher

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 71
    • Well Played Games
Re: Newbie Question: How do i Interrupt "Move Towards?"
« Reply #1 on: June 18, 2011, 05:49:30 PM »
I haven't tested it to be absolutely sure, but you should be able to stop the move by simply changing states.  Do you have an appropriate event on that node where you are doing the moving?  If you don't the move will happen until it's done, then the state will change to whatever one is actually listening for other events.  If that doesn't make sense let me know and I'll set up and example.

Also, from your example it sounds like you might want to look into "iTween Move Update".  Instead of moving from one specific place to another, it lets you update your move conditions each game cycle.  This is useful if your moving object is trying to track another moving object.  If you use a standard "move to", the mover will move to the position the target was at when the action was started, but the target could be long gone by then!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Newbie Question: How do i Interrupt "Move Towards?"
« Reply #2 on: June 19, 2011, 12:40:16 PM »
Xtopher is right. You need to grasp a little more about how playmaker works to better control its behavior.

 You can insert in the same state several other actions that checks wether or not the move toward action should continue or readjust, etc etc. when you want to interupt something, you simply trigger an event featured as a transition of that state and anything that was happening on that state will stop and cease to function, until you enter that state again.

The way you describe your need calls for a lot more then a state and few actions. I think you will need to cut down the problem into chuncks and adress each one of them, and glue that together to get there.

Could you give a precise example of how the move could be interrupt, and I'll look into doing a working example.

 Bye,

 Jean