[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
347
Reaction score
162
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 Posts

Latest Profile Posts

suspended on twitter for calling an ahole an ahole & appealing the tweet; furious at myself for being even slightly upset with my suspension: oh no, you've been temporarily banned from hell. GET OVER IT, me.
how can you download the tiles from a forum post here? HELP
That moment when you post the wrong download link to your game and wonder why it got so few downloads... :mad:
Trying to make it so my map is cleared of "random" events after the player leaves the map... to little success >.< I think I might need to ask help for this.
Had my first interaction with a legit homophobe concerning one of my games today. Tempting to engage, but pointless.

Forum statistics

Threads
94,245
Messages
919,368
Members
123,959
Latest member
CecilGP
Top