Help with Display MsgBox Dice Roll System

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
Hi, im trying to create a dice roll system for battle. Where you roll 6 sided dice, 4 sided dice, 10, 12, and 20. The dice rolls are multipliers to damage and defense. The code below works but im having trouble figuring out how to display in messagebox, "You" and "Monster" when its your turn or monsters turn, right now, both you and monster get "You" and during monsters turn, you are "Monster", how would i code it so that, They switch back and forth, so that Monster is Monster's turn, and You is actors turn? I'm using yanfly's skill core for damage evaluation since its the only one i know that allows you to enter javascript and script calls.

<Pre-Damage Eval>
x = (Math.floor(Math.randomInt(6) + 1));
$gameVariables[28, x];
y = (Math.floor(Math.randomInt(6) + 1));
$gameVariables[29, y];
$gameMessage.add("You rolled " + $gameVariables.value(28));
$gameMessage.add("Monster rolled " + $gameVariables.value(29));
</Pre-Damage Eval>
 

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
Here's a turn change js code but its not working. The $gameMessage.add variable returns zero and not the stored dice roll. the above one does though... any help plz.

<Pre-Damage Eval>
t = 1;
x = (Math.floor(Math.randomInt(6) + 1));
$gameVariables[28, x];
y = (Math.floor(Math.randomInt(6) + 1));
$gameVariables[29, y];

if (t == 0){
t = 1;
$gameMessage.add("Monster rolled " + $gameVariables.value(29));
}
else {
t = 0;
$gameMessage.add("You rolled " + $gameVariables.value(28));
}
</Pre-Damage Eval>
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,065
Reaction score
7,042
First Language
German
Primarily Uses
RMMV
Please give links to the website of the plugin(s) you're using for that eval notetag
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,065
Reaction score
7,042
First Language
German
Primarily Uses
RMMV
try
if (t===0)
 

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
thank you andar for trying to help. still returns zero. i actually think the way yanfly wrote his script you can't call $gameMessage.add within if else statements. this is downer =-( I was trying to give my battles an old fashion D&D feel to it. if anyone solves this, it would open a tremendous amount of variation in the skills i've implemented.
 

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
Problem solved. just had to store "You" and "Monster" in control variable script, simple as that!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Hi, there.
I'm Creta Park, as Software engineer and Indie game developer.

Profile : creft.me/cretapark
GitHub : github.com/creta5164
Blog : creta5164.tumblr.com


My stuff

Who shares/sells their scripts/plugins on itch.io? Can I pick your brain?
If you ever need fantasy names and you're bored, make a fictional alphabet. Switch around the letters and see what you get :p
I JUST GOT PROMOTED TO 9TH GRADE BOIS!

Forum statistics

Threads
98,170
Messages
949,965
Members
129,459
Latest member
thanhlan
Top