Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Flying Robot on September 16, 2013, 09:03:35 AM

Title: Offset Float By Percentage
Post by: Flying Robot on September 16, 2013, 09:03:35 AM
Hi,

This would be my first PlayMaker custom action. Let me know if you like it.

It takes a float (input) and offsets its value within a random range of a percentage (input) of it's value.

May come useful if you want to add a little random variation to a float value.
Title: Re: Offset Float By Percentage
Post by: jeanfabre on September 17, 2013, 02:50:44 AM
Hi,

 Nice! You got action writing standard  well executed, well done.

I would add a small feature: everyframe. So thyt this action can generate a random float in that range constantly, might be useful for such thing as noisy animations and stuff.

bye,

 Jean
Title: Re: Offset Float By Percentage
Post by: Flying Robot on September 18, 2013, 02:20:32 AM
Thanks Jean,

I've Updated the attachment with everyframe option.
Title: Re: Offset Float By Percentage
Post by: jeanfabre on September 18, 2013, 02:28:13 AM
Hi,

 Cool.

one important advice as a general way of scripting. Avoid duplicating code. Instead, create a new method ( ie "ComputeRandom()") where you will have your code, and call that method form the onEnter and OnUpdate methods. This way you only have one set of commands for your feature. In more complex programming this is essential to not fall into bad bugs and totally painful refactoring. In our case, it's minor, but still, if you need to edit this featurem you will have to do it twice, and you may forget or make a small typo and then it will work differently is eveyframe is checked than if not...

Bye,

 Jean
Title: Re: Offset Float By Percentage
Post by: Flying Robot on September 18, 2013, 03:15:02 AM
Thanks Jean,

I'll follow you suggestions and pack the code into a new method and call it from the enter or update.
Title: Re: Offset Float By Percentage
Post by: 4ppleseed on February 10, 2015, 05:02:38 PM
There's an error in the Tooltip section for this action. Can it be fixed please? :)