[TF] Random Number Generator

Tagflag

Villager
Member
Joined
Nov 29, 2015
Messages
16
Reaction score
5
First Language
German
TF_RandomNumberGenerator v1.0.0
by Tagflag

 

About this plugin
This plugin creates a random number and stores it into a in-game variable.
You can also call the wait command to use variables (like a random one).
 
So you can combine both functions to let birds sing at random intervals.
 
You get a random number based on min-max values, remember min and max values are included that means that a random value between 5 and 10 can be:
5, 6, 7, 8, 9 or 10.

How to Use
Use as plugin commands in events:

TF_RandomNumber x y zx = min, y = max, z = variable id to store the random number example: TF_RandomNumber 5 10 2
this stores a random number between 5 and 10 (example: 7) in variable id 2 you then can access the variable with the escape sequence: \V[2]
 
 

TF_Wait variable_idJust replace variable_id with variable number, example: TF_Wait 2
ececutes the wait command for variables's value in frames.

Demo
Here is a example project, best you open it in RPG Maker and look at it (after you played it first if course :p ).

It's very short < 1 minute. File size: ~ 20MB

http://www.mediafire.com/download/xeci2qaiorqgetg/RandomNumberExample.rar

Script
You can download the plugin here:

http://www.mediafire.com/view/0jadyb3a3cp9v3t/TF_RandomNumberGenerator.js

Legal stuff

You can use this plugin in commercial and non-commercial projects.

You are free to duplicate, distribute and modify this plugin however you want.

To give credits to me is optional.

In case of ditribution: don't claim to be the creator of this script. f you modified it, leave my name in the plugin ("@ author:" you can change of course).

If you use it in a game, then it would be nice if you tell me about it. I would love to try it :D

FAQ
Q: Will "TF_RandomNumber" also work with only 2 argument, like "TF_RandomNumber x y"?
A: No, it has to be 3, otherwise it will get ignored. If you have more arguments (like 4), then it will work but only use the first 3.

Q: Why no screenshots?
A: There is nothing much to show.

Q: Will you add more to this plugin?
A: Yes, there are still a few things I want to add/change.

Q: Are the commands like "TF_RandomNumber" case-sensitive?

A: No, you can even write "tF_RaNdOm_NuMbEr" if you have the time  :)

Q: Why do you add TF infront your plugin name?
A: So I can find it in my plugins list, you can change this plugins file name without breaking it.

Extra Notes
If you have questions/problems, find erros/typos or have praise/complaints then let me know! I answer everything I can.
 

Rito

Veteran
Veteran
Joined
Jun 29, 2015
Messages
107
Reaction score
50
First Language
French
I have a question :

Why its so that we can do so without plugin ? ^^ "

 

 
Last edited by a moderator:

Tagflag

Villager
Member
Joined
Nov 29, 2015
Messages
16
Reaction score
5
First Language
German
Thank you Rito! I just learned something new.

To tell the truth: I totally missed that one! :o

I was looking for that random option for so long, but it appears I just skipped over it. Now that I had a hint, I actually found it. Well, at least it was a good exercise.

But the plugin allows also to use "wait" with variables, so it's not useless just yet. :p

Maybe I should rename it?
 

Rito

Veteran
Veteran
Joined
Jun 29, 2015
Messages
107
Reaction score
50
First Language
French
Yes I think it would be better ^^

I started using rpg maker since its XP version (2003 if I remember correctly) and it already existed.
 

Janusz

Veteran
Veteran
Joined
Jul 4, 2015
Messages
26
Reaction score
4
Primarily Uses
You can always improve your script with arrays example: five different random values from 1 to 5 -> array = [1, 5, 3, 4, 2]

and/or adding sorting system for those numbers for example:  array = [23, 34, 17, 28] then sorted_array_by_value = [17, 23, 28, 34] or by array position: pos_arrays_by_lowest_value = [2, 0, 3, 1].

This could be used for tournament draws or other similiar things with one or two code lines instead multiple script calls.

Sorry for bad english.

Editi: Typo error from [2, 0, 4, 1] to [2, 0, 3, 1]
 
Last edited by a moderator:

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
383
Reaction score
175
First Language
English
Primarily Uses
RMMV
You could try to come up with a 'Seed' system, like in The Binding of Isaac, where the player can access & input seeds that determine how things are randomly generated. It's rather difficult to implement this by default because games like rogue-likes tend to heavily use randomly generated variables & inputting a single seed from the 'Input Number' event command & using it to pre-set multiple variables would be a difficult task (especially since the Input Number option only lets the player enter numbers & not letters or symbols).
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Humans are fallible creatures, we all know that. It's when we're forced to look at ourselves that we start to disagree. :p
Expectation: Working on boss battle.
Reality: "Look at how awful are these code and database organization. Let me clean this mess", *yet, casually adding more modules that I have no idea if I would use it later*
Trying to learn to read Japanese so I read my manga. I like to buy them without all the edits made during translation.
The only thing getting me through today so far is coffee. And lots of it.
Amazing. I had seen it more than 10 years ago, but seeing Monster this year was an incredible experience. It was certainly one of the best endings I've ever seen in anime.

Forum statistics

Threads
97,851
Messages
947,379
Members
129,078
Latest member
onpeex
Top