playMaker

Author Topic: Creating AI with Patrol[Solved]  (Read 5176 times)

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
Creating AI with Patrol[Solved]
« on: March 11, 2013, 06:06:01 AM »
Hello,

So I hit a snag again, unfortunately!

I have a mob that I am creating that needs to patrol a specific area and when the player would come to a certain distance from this mob the mob would play the alert animation and then when the player comes closer, would taunt the player.
Finally, when the player comes close enough, he would attack the player.

Here is my setup.

1- The patrol system:
I created an empty game object called "Waypoint Manager" and created 6 boxes (with deleted collisions and meshes) and added a FSM that randomly picks one of the boxes and plays the "walk" animation on the mob and sends it to that direction. The FSM is attached to the Waypoint Manager

So far that system works perfectly fine.

2- The state system:
I created an FSM on the mob itself and have a state with the "Get Distance" action which measures the distance every frame between the mob and the player. Float compare was used then to compare the distance and then flow through 1 of the three states (alert, taunt and attack).
In each of the states, I have the "Stop Animation" action that stops the animation from playing. However, I would like the mob to stop the movement however (as it still moves). I can't find a "Stop Action" or "Over rule Action" in the list of actions that I can make it stop the actions in "Waypoint Manager" from playing until the distance of the player is far more than what is required for the different states (alert = 11.2; taunt = 6; attack = 4.2).

Is there a way to do this?

Thank you very much in advance.

EDIT: Thank you everyone you have solved it all :D
« Last Edit: March 14, 2013, 07:40:23 AM by Vallar »

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: Creating AI with Patrol
« Reply #1 on: March 11, 2013, 07:40:34 AM »
I'd have a string switch, and only do waypoint wandering if the string = "wandering".. and have the state manager change the string according to the state.

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
Re: Creating AI with Patrol
« Reply #2 on: March 11, 2013, 12:55:40 PM »
That does sound like a good work around.  I will give it a try, thank you very much!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Creating AI with Patrol
« Reply #3 on: March 11, 2013, 01:08:20 PM »
You can use Get FSM State to check if the targeted fsm it's in a state named "whatever" or a string variable.

Used it yesterday, i think that was the name of the action. It works great.

edit: spelling errors from phone
« Last Edit: March 11, 2013, 01:14:28 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Sobek

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Creating AI with Patrol
« Reply #4 on: March 12, 2013, 11:01:38 AM »
Here is a link to some Playmaker AI tutorials that might can help you:


Vallar

  • Junior Playmaker
  • **
  • Posts: 90
Re: Creating AI with Patrol
« Reply #5 on: March 12, 2013, 11:18:17 AM »
Hello,

Thank you very much all of you. I am trying everyone of your suggestion to see which is the best that suits my setup.

Thank you very much.