Help with Display MsgBox Dice Roll System

Discussion in 'Javascript/Plugin Support' started by Nerdboy, Feb 3, 2017.

    Tags:
  1. Nerdboy

    Nerdboy Veteran Veteran

    Messages:
    78
    Likes Received:
    7
    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>
     
    #1
  2. Nerdboy

    Nerdboy Veteran Veteran

    Messages:
    78
    Likes Received:
    7
    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: Feb 3, 2017
    #2
  3. Andar

    Andar Veteran Veteran

    Messages:
    28,134
    Likes Received:
    6,372
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Please give links to the website of the plugin(s) you're using for that eval notetag
     
    #3
  4. Nerdboy

    Nerdboy Veteran Veteran

    Messages:
    78
    Likes Received:
    7
    I'm using yanflys skill core. Like i said, the above one works, but the one later returns zero. Actually anything i experiment with within If Else statements returns zero if i try to call $gameMessage.add

    http://yanfly.moe/2015/10/13/yep-8-skill-core/
     
    #4
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,134
    Likes Received:
    6,372
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    try
    if (t===0)
     
    #5
  6. Nerdboy

    Nerdboy Veteran Veteran

    Messages:
    78
    Likes Received:
    7
    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.
     
    #6
  7. Nerdboy

    Nerdboy Veteran Veteran

    Messages:
    78
    Likes Received:
    7
    Problem solved. just had to store "You" and "Monster" in control variable script, simple as that!
     
    #7

Share This Page