Nacoles

Veteran
Veteran
Joined
May 11, 2015
Messages
38
Reaction score
7
First Language
Korean
Primarily Uses
Question Level: Hard

How do I add/take away roll modifiers from my variables? (Gamble advantages and disadvantages)

I.E. : 1 ~ 100 roll

I need to roll over 25 to win but I need a +10 modifier to increase my chances. :p
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,296
Reaction score
8,745
First Language
German
Primarily Uses
RMMV
Use the mathematical operations inside the control variable command


I suggest searching for the "variables guide" tutorial to learn how to use variables
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,088
Reaction score
2,681
First Language
Greek
Primarily Uses
RMMZ
What @Andar told you is right, you just can not understand what he says, because you need to know first about variables and stuff.

If you PMed me to just get an answer, without trying things yourself, I assure you it will not work always. I do not reply on fundamental questions.

Of course, in this case, because it is a complex issue, I will spend time to give you a solution.

A variable guide is what I will suggest you to study too.

It is really highly suggested to learn basic stuff first, before attempting doing complex things.

I will give you a solution but if you can not understand what I say, you should learn first about how to use "Control Variables" and what you can do with it and "Conditional Branch" at least.

If you already know how to use these stuff, go on and read.

If not, read @Andar's tutorials.

Press Spoiler Show button to read the solution.

Control Variables and set two variables to 0 as seen below.

RandomNumber = 0

RandomFinal = 0

Control Variables: Set the variable named RandomNumber with a Random number from 1 To 100. So far so good.

Now let's say you got a variable named Modifier (+10 or -20 or whatever you want that has been set from before).

Now you have to control the last variable RandomFinal.

RandomFinal = add RandomNumber

RandomFinal = add Modifier

We need a random number that should stay in range 1 to 100 no matter what.

A roll of 7 with a modifier -10 will result -3 thus it will not do.

A roll of 99 with a Modifier +7 will result 106 thus it will not do either.

How can we prevent that from happening on RandomFinal variable?

Conditional Branch:

IF RandomFinal < 1 Then

RandomFinal = 1

End Conditional Branch

Conditional Branch:

IF RandomFinal > 100 Then

RandomFinal = 100

End Conditional Branch

Thus you get an algorithm that will return you a number from 1 to 100, using the modifier, without it being broken. Hopefully.

Then and only after this algorithm you can check RandomFinal if it is above 25 to win or else to lose using conditional branch.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,125
Reaction score
15,530
First Language
English
Primarily Uses
RMMV
I've moved this thread to VX Ace Support. Please be sure to post your threads in the correct forum next time. Thank you.
 

Latest Threads

Latest Posts

Latest Profile Posts

Synchronizing bust and sprite expressions! Plus using a phone behaviour :kaopride:
BVadZby.gif

Long gif tho, let it load first :kaoswt2:
Wondering how to force a Save State in VNMaker with a name and how to call it with a scene event in order to double check if this Save State exists or not. Phew... Leaving breadcrumbs for chapter DLCs to pickup would be more than half the fight in order to finish this visual novel :LZSsad:
Making games is the only thing I'm good at. Real talk.
So, uh... where's the RPG Maker MZ update with the MV animation system? Is there a release date confirmed?
Also I'm kind of brave enough to admit this. I... I have a crush on Sephiroth.
Please don't call me anything offensive. I'm naturally crazy.
thanks to a lot of lunatic coding... my game finally has a stun mechanic that I feel really good about. damage enemy's mental psyche (mp), and once empty, hitting with certain attacks trigger combos that can stack the damage.

Forum statistics

Threads
117,113
Messages
1,104,687
Members
153,150
Latest member
dekikii
Top