RPG Maker Forums

Hi all! :)

I have some question about JavaScript code;

1. How to get a random number instead to use in-game variables?
Is there any script code to get a random number instead of using one of the in-game variables?

2. How to add % chance for both var line?
Like each number decrease chance to get, so item ID 410 would be 1% chance to get, meanwhile 400 would be 100%.

3. * Sorry... I got this questions when I did start posting here, and now I did forget my third questions :(


My code that I use for my test project;
Code:
var item = $gameVariables.value(1);

var nr = $gameVariables.value(2);

$gameParty.gainItem($dataItems[item], nr)
(Value 1 = random 400-410 ( = item ID beteween 400-410).
(Value 2 = random number 1-5 ( = how many item you can get ).

''''

My point for this script;

I trying to make a common event that will be available 1 times for every in-game month and will be there until 2-3 days, after that you can't access that until next month.
Inside that Common Event would be that script code.
You can then roll for a random item/weapon/armor from the database from x to y % + chance for extra loot!.
x = higher chance to get that loot
y = lower chance to get that loot
__________________________________________________________________________________________________

How to best setup that Common Events are my next problem :p
Right now I want to focus on how to get best possible Script code.
(If you have good idea/tips about the common event, please :) , not necessary because this topic focuses on my script setup.)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top