Random Roulette Plugin/Mechanic?

leoroura

Veteran
Veteran
Joined
Feb 14, 2017
Messages
32
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hello! It's me again :p This time i want to make something similar to a roulette that stops randomly...
Now, i know there are some plugins out there but i couldn't find a way to recreate exactly what i'm aiming for...
Ever played a mobile game where you spin a roulette to get an item? Well, it's something like that.
example.jpg
So this is the "Roulette" (WIP) (Technically it's a Tetramorph but whatever)
The red letter (A) means that i will have to make 5 images in total. One for the "Roulette", and four for each highlighted letter. The roulette will spin by colouring the letters, when it stops, im planning to trigger a switch to give you a random item related to the letter where the roulette stopped at.

I'm sorry if it's hard to understand, i don't have the programming knowledge to make a script for this but i thought that there might be a way to show and hide the images of the letters with some kind of mechanic and then ask which image is showing so i can trigger the event. If you guys know a script/plugin/mechanic for this it'd be reaaally helpful >.<
Thank you for reading! :)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
The way I would probably do something like this is to make the inside of the letters on the image transparent, then show the highlight colour behind the main image in the appropriate location for the letter it stopped on. That way you'd only need two images, possible three (the main image, the highlight block, and a background in case you need to have the letters be a certain colour when not highlighted)
 

leoroura

Veteran
Veteran
Joined
Feb 14, 2017
Messages
32
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hey! Thank you for your answer ^^
The letters i used just as an example, they will be replaced by orbs with symbols when i finish drawing the tetramorph -(I stopped at this point since i'm still trying to figure out how to make it work)
 

Fugama

Means well, but messes up sometimes.
Veteran
Joined
Jun 7, 2014
Messages
158
Reaction score
90
First Language
Fake English
Primarily Uses
RMMV
Well, the base code for grabbing the result would look something like this (including some plugin setup as well)
Code:
YourObject = YourObject || {};
YourObject.thisPlugin = YourObject.thisPlugin || {};
Imported = Imported || {};
Imported.Your_PluginName = true;
/*
*@param Database
*@default 1, 2, 3
*@desc Your database values go here
*/

YourObject.thisPlugin.convertNumbers = function (stringArray) {
newArray = []
for (var i = 0; i < stringArray.length; i++) {
num = Number(stringArray[i])
newArray.push(num)
}
return newArray;
};


YourObject.thisPlugin.Parameters = PluginManager.parameters('Your Plugin Name Here');
YourObject.thisPlugin.Param.thisDatabase = YourObject.thisPlugin.convertNumbers(YourObject.thisPlugin.Parameters['Database'].split(","));

YourObject.thisPlugin.getResult = function() {
var array = YourObjectHere.Param.thisDatabase
randomResult = array[Math.floor(Math.random() * array.length)];
return randomResult;
};

The harder part that idk how to do is make the wheel spin and display a certain way based on the result.

but with the way it's written you'd setup an array of numbers in the plugin manager parameters, and when you wanna do the wheel spinning to find the result it'd just be this

Code:
YourObject.thisPlugin.getResult();
 
Last edited:

leoroura

Veteran
Veteran
Joined
Feb 14, 2017
Messages
32
Reaction score
5
First Language
English
Primarily Uses
RMMV
Thank you for your answer ^^
But i didn't understand anything about that code T-T Sorryyy i'm still a noob to this programming language and rpgmaker in general, what is that script supposed to do? Or is it a plugin?
 

Fugama

Means well, but messes up sometimes.
Veteran
Joined
Jun 7, 2014
Messages
158
Reaction score
90
First Language
Fake English
Primarily Uses
RMMV
Ah, basically I figured you may want a plugin for this where you could just store a bunch of values for a bunch of results but IDK how to make it spin or anything like that, so I guess it's a bare bone setup for someone who knows how to do the rest of the plugin to finish if they so desired to
 

leoroura

Veteran
Veteran
Joined
Feb 14, 2017
Messages
32
Reaction score
5
First Language
English
Primarily Uses
RMMV
Oh, ok, Thank you :)
I guess what i need is something to make it spin a random number of times, so the result can differ... Each spin would set a picture visible and hide the rest (so it looks like it spinning), and then when it stops there should be something like "If this picture is visible, then.." and then a switch is activated. If i get there i'm good, cause all that is left is to set a random item to be given according to the switch that got activated. I can do that without any scripts so that's the easy part ^^

On the other side, if we do what Trihan suggested then it would be easier, cause less pics but then the script should ask something like "if the picture is at a certain coordinate..." and i don't know if that will affect the game if i change the screen resolution :o
 

Fugama

Means well, but messes up sometimes.
Veteran
Joined
Jun 7, 2014
Messages
158
Reaction score
90
First Language
Fake English
Primarily Uses
RMMV
With the bit of code I made you, the plugin method would be something like

Call a spin animation -> Use my code to find the result -> show the regular wheel still ->draw an icon based on the result from my code as the one it landed on -> Add items based on result

I should note that the code I made will use numbers you put into it with the plugin manager and pick one of them at random when called
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top