How to random stats?

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
616
Reaction score
145
First Language
English
Primarily Uses
RMMV
So I want to make a common event that will grant a total of 100 random stats from atk, def, m.def, m.atk, luck and agility.
So it will randomly give any number of stats from those 6 until it reaches an accumulated total of 100.
I know I have to tie a variable to each stat but apart from that I'm lost.
Not sure how to go about the rest to make sure it doesn't go over the sum total of 100 or even go about getting it to be random.

Anyone have any idea?
 

rechronicle

Mystvaldia
Veteran
Joined
Oct 30, 2013
Messages
137
Reaction score
109
First Language
Bahasa
Primarily Uses
RMMV
You just need to count, make 'isItAHundredAlready?' var or something like that.
When you randomly add 3 ATK stat, add 3 to the var.
When you randomly add 5 LUK stat, add 5 to the var.
And so on.
Then do a conditional branch the var if isItAHundredAlready? >= 100.

Voila!
 

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
616
Reaction score
145
First Language
English
Primarily Uses
RMMV
You just need to count, make 'isItAHundredAlready?' var or something like that.
When you randomly add 3 ATK stat, add 3 to the var.
When you randomly add 5 LUK stat, add 5 to the var.
And so on.
Then do a conditional branch the var if isItAHundredAlready? >= 100.

Voila!
Would using a range for variables that have that, work doing random? Since var 1-6 are my stats.
 

rechronicle

Mystvaldia
Veteran
Joined
Oct 30, 2013
Messages
137
Reaction score
109
First Language
Bahasa
Primarily Uses
RMMV
Hmm, it should work fine, add var 1 to 6, check if the sum of it all is 100, then you can stop adding more stats to them. No more need a new variable to count.
 

J-G

Veteran
Member
Joined
Oct 4, 2019
Messages
616
Reaction score
145
First Language
English
Primarily Uses
RMMV
Okay thanks. I'll give it a shot n see if I can set it up properly lol if not I'll be back
 

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly! I will be beginning a play-through of Resident Evil 4! Feel free to drop by!

1st iteration on castle interior in Tiled.
I've started up Pillars of Eternity. It's interesting how the game does a "select choice" cutscene using still image art for dramatic flair. I wonder if that might work for my RPGMaker project.
The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.
Gamedev for relaxing? yes or no?

Forum statistics

Threads
107,744
Messages
1,031,802
Members
139,882
Latest member
MoBard
Top