Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: artfish on September 12, 2013, 02:58:14 PM

Title: How do I set a random number for a value in itween for example[SOLVED]
Post by: artfish on September 12, 2013, 02:58:14 PM
Hello everyone! Just getting started with Unity and Playmaker here. Coming from one of those "Other" engines. I'm getting up to speed watching all the tutorials I can and scouring google and such.

So I've been searching for a while now, and I'm not having much luck.

Here's one of the first things I'm trying to figure out. Using a random number for a value.

Ok, for example, I have a FSM on a plane that has a texture of a cloud mapped on it. I've added an itween move add.I want this cloud to move to it's destination at a random speed.

How would I type this into the speed box? Or, is this even how I should be doing it?
Basically trying to do speed=random( .1,.8 )
Thanks! ;)
Title: Re: How do I set a random number for a value in itween for example
Post by: jeanfabre on September 13, 2013, 02:58:22 AM
Hi,

 create a float variable on that fsm, and name it "speed" and set its value to 1.

in the itween action, instead of manually inputing the speed, select that variable instead.

and now, just before the itween action use an action called "Random Float" and define your range there. your speed will then be randomized, and used within the itween action.

 Does that make sense?

bye,

 Jean
Title: Re: How do I set a random number for a value in itween for example
Post by: artfish on September 17, 2013, 11:15:59 AM
@jeanfabre Thanks!