playMaker

Author Topic: Looping Event while waiting for trigger  (Read 2487 times)

k2kshard

  • Playmaker Newbie
  • *
  • Posts: 9
Looping Event while waiting for trigger
« on: June 25, 2012, 10:00:22 PM »
Hi,

I have a 'NPC' with an Start State, where he plays a waving animation (to get the players attention)

He is also setup to have a Trigger Event with 'On Trigger Enter' so that when the player walks up to him he initiates dialog.

What I would like to do is have it loop back to the waving animation until the player activates the trigger but I am not sure the best way to do this.

Ideally I would like to not have the animation itself set to loop incase I want to have it as a one-off play (as the wave is a once action.)

Any ideas?

Thanks

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Looping Event while waiting for trigger
« Reply #1 on: June 26, 2012, 07:50:44 AM »
You can have the wave anim loop by default, but set it to play only once when you want use it that way.  You can do the opposite as well.  Just use the Animation Settings action to set the desired play mode for whatever situation you're using it in. 

I recommend having the animation loop, and then using this method to set it to play once in the appropriate circumstances in the future.  Does that help?


k2kshard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Looping Event while waiting for trigger
« Reply #2 on: June 26, 2012, 08:12:00 PM »
In a way yes. but it isn't really ideal for the overall setup as I also want to play an audio clip in that event.

ie. NPC Waves and says 'Hey, Over here' with a random delay and then loops to repeat this (Audio + Anim) until the player hits the trigger

Looping the animation means that the animation keeps playing without any delay - ie. His arm flaps up and down every half a second to perform the wave action, and then this doesnt take care of the Audio either :(


artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Looping Event while waiting for trigger
« Reply #3 on: June 27, 2012, 03:51:39 AM »
This should be a pretty simple matter of just making a series of states using the Wait action (for time delay), and something that switches things on and off depending on player interaction and time passed.  Once you've had the player fulfill their part of the interaction you can just flip a boolean on the NPC that sends his behavior to another part of the FSM.  Hope that helps!