playMaker

Author Topic: Stop Animation in AI [Solved]  (Read 1688 times)

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
    • View Profile
Stop Animation in AI [Solved]
« on: March 03, 2013, 12:44:43 AM »
Hello everyone,

I have trying for the past few days battle with creating an AI for a game I am working on.

The idea is that I have an enemy that doesn't moved and fixed to the ground (as if it is a turret), now what I want to do is what when the player is near the enemy it would taunt the player and keep looping the taunt. Once, the player gets closer, it starts attacking. If the player backs up and in enters the taunting distance the enemy goes into taunting loop again. If he exits, the enemy disappears.

What I have done so far is that I created 2 box triggers one inside the other (the first is large, the second is small) and then I created the FSM and actions to play the roar animations and such and it works perfectly fine (even with the exit animation).
The problem comes when the player enters the second trigger, in that case, it plays the animation for attacking (on the second trigger) and the roar/taunt animation (on the first trigger). I tried everything with "Stop Animation" action but it never worked.

I tried another thing, keeping all actions in one trigger instead of dividing things over two triggers and making the second trigger (smaller one) to just send an action to the larger trigger's FSM to play attack animation (instead of the first setup where each trigger handled his own animations separate from the other). Unfortunately when I did that, the attack animation never plays and it is the main loop with roar/taunt with no other changes.

Any ideas how I go about tackling this one?

Thank you very much.
« Last Edit: March 05, 2013, 12:17:49 PM by Vallar »

KozTheBoss

  • Full Member
  • ***
  • Posts: 150
  • You dont fail unless you give up trying to succeed
    • View Profile
    • Pixel Life - portfolio
Re: Stop Animation in AI
« Reply #1 on: March 03, 2013, 06:51:12 AM »
Hi, I don't have any specific solution for this as i haven't tried anything like that before, but i think it would be better to use a GetDistance to measure the distance from the AI to the player, and if player is closer than XX then play taunt, but if player is closer than YY play the attack

seems like a better solution than 2 hitboxes inside each other

just a thought
Remember, you don't fail unless you give up trying to succeed!

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
    • View Profile
Re: Stop Animation in AI
« Reply #2 on: March 03, 2013, 12:52:51 PM »
I never thought there is an action like that in Playmaker, that is why I pulled the trigger move.

Thank you SO MUCH for pointing this out, it seems a much better shot. I'll give it a go.

Thank you again!

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
    • View Profile
Re: Stop Animation in AI
« Reply #3 on: March 03, 2013, 11:59:22 PM »
Well, I have managed to test what you have mentioned and it worked so far as intended. However, I came across another problem.

My setup is as follows:
1- Get the distance between the player and the enemy.
2- If the distance is equal to or less than 11.2 then show the enemy and after that play the idle animation.
3- If the distance is less than 11.2 and bigger than 7.5 play the roar/taunt animation.
4- If the distance is less than or equal 7.5 then play the attack animation.

So far all of the above work except for the last step. When the distance is less than 7.5 or equal to 7.5, it still goes through step 3 without going to step 4 and I checked the transitions and they are correct, checked the logic and they are correct.

I am not sure what I can do to be honest to get the float compare to flow from step 3 to step 4

I have attached this part from the FSM.

Not sure if this helps or there is something I did wrong...