# Playmaker Forum

## PlayMaker Feedback => Action Requests => Topic started by: wheretheidivides on January 28, 2015, 02:22:27 PM

Title: probability calculator
Post by: wheretheidivides on January 28, 2015, 02:22:27 PM
So I can code this in javascript or BASIC real easily.  In playmaker it takes some work with the states and checks and all.  So it'd be cool to have an action to do this.  Many newbees will want this.

So you have a powerup that pops up.  25% of the time it boosts speed, 25% of the time it doubles the firepower and 50% of the time it gives a shield.  In playmaker you have to set up a random number generator between 1-100 (0 is not needed and 1 is included and 100 is included).  Then you have to do a series of checks and branches.  Wouldn't be easier just to have an action to do this so people won't have to keep re-doing it?  Of couse it would.  That is why you are using playmaker and not C#.

- pick a random INT with low at 1 and high is at 100.  If you need to do a percent less that 1 increments.....OK, you don't need to.  So we'll use an INT.
- array number that you tell number of entries (3 entered will be 3 entries)
-each entry has a name (something for programmer to use)
- each entry has a LOW and a HIGH percent (the low of the current array number has to be 1 higher than previous high amount.  This number can be auto generated).
- each entry has an exit to go to next state
=================================
so it would look like this:

3

1
Speed Boost
1
25
Goto speed state

2
Double Fire power
26
50
goto fire state

3
Shields
51
100
Goto shield state

Title: Re: probability calculator
Post by: jrDev on May 11, 2017, 10:49:54 AM

I was just looking for something like this...
Title: Re: probability calculator
Post by: terri on May 12, 2017, 10:04:09 AM
you can just use "send random event" for this
the only thing is that the weights would be 0-1 instead of 1-100
Title: Re: probability calculator
Post by: jrDev on July 23, 2019, 12:45:23 AM
you can just use "send random event" for this
the only thing is that the weights would be 0-1 instead of 1-100
Hello,

This is great!

Thanks,
jrDev
Title: Re: probability calculator
Post by: djaydino on July 23, 2019, 07:26:17 AM
Hi.
@jrDev

On the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) you can find now many different Random Weighted that might be useful.

Search for 'Random Weighted' and you will get a list of several actions :)