playMaker

Author Topic: [SOLVED] Idle Animations: how to wait random amount of time  (Read 6293 times)

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
[SOLVED] Idle Animations: how to wait random amount of time
« on: February 06, 2013, 06:54:12 AM »
Hey everyone.

i have made a simple blink animation using TK2d and now I want to make my character blink occasionally and randomly. How would I go about doing this? I suppose it doesn't have to be random, just not seem like the blink is on a constant loop where you can predict when it will blink if that makes sense.

thank you

WB
« Last Edit: February 07, 2013, 11:16:37 AM by will_brett »

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #1 on: February 07, 2013, 07:17:29 AM »
...BUMP...

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Idle Animations: how to wait random amount of time
« Reply #2 on: February 07, 2013, 08:05:12 AM »
You can make random delay with two simple actions:
With <Random Float> you generate specified random number and save it to variable.
Next you use that variable in delay field of <Wait> action. You loop states and it's done.
(animation must be set to play Once)
« Last Edit: February 07, 2013, 08:08:06 AM by Andrew_Raphael_Lukasik »

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #3 on: February 07, 2013, 08:12:59 AM »
Thank you so much.

I will get on this right now.

All the best

Wb

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #4 on: February 07, 2013, 08:39:55 AM »
I can't seem to get that to work.

What i did was have randomfloat under start that would generate a number between 5-30 and store result as a float names "Random_Number". I then created a new state with 'Wait' which looked for Random_Number, i left finished event blank and real time unchecked. Next I had a new state with TK2D Play Animation. Game object use Owner and clip name as "idle".

Where have I gone wrong? Im sure its something obvious. I also made sure animation is set to play once.

Thanks

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #5 on: February 07, 2013, 08:47:54 AM »
I have also tried first state Random_float between 5-30 then having a wait state that uses Random_number for time and then loops back into the "Random_float" state

This also doesn't seem to do anything.


Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Idle Animations: how to wait random amount of time
« Reply #6 on: February 07, 2013, 10:29:22 AM »
Oh it simply don't work now because in <Wait> you should fill Event field with relevant event. In this case shown above - named "Wait". Then it will proceed.

ps: In this "Random_Float" state, action that plays blink animation should fire finishing event as well.
« Last Edit: February 07, 2013, 10:36:10 AM by Andrew_Raphael_Lukasik »

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #7 on: February 07, 2013, 10:31:41 AM »
Im not 100% clear what you mean. Do you mean fill the finish event with a "wait" event or that I have gotten the events set up wrong?

Thanks again

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Idle Animations: how to wait random amount of time
« Reply #8 on: February 07, 2013, 10:46:21 AM »
Take a look at this example (attachment below). After filling <Play Animation>'s target object and animation name fields then it should work and self-explain this process a bit.

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #9 on: February 07, 2013, 11:09:03 AM »
Thank you that has made things much clearer and I can see the issue now.

In your example you have used a Play animation action, but I am using TK 2d for the animations so this will not work and if i use the TK 2D play animation action it doesn't have a finish event option

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: Idle Animations: how to wait random amount of time
« Reply #10 on: February 07, 2013, 11:15:41 AM »
SOLVED!

All I needed to do was add TK 2d play animation with Events and not TK 2d play animation

Thank you for your help much appreciated