What is wrong with this bit of code?

MagicPizzaGuy

Mother of All Omelettes
Veteran
Joined
Jul 16, 2014
Messages
50
Reaction score
44
First Language
Portuguese
Primarily Uses
RMMV
I used this script, but it doesn't seem to work when playing. Anyone has any idea why?

Code:
$gameVariables.setValue(28, Math.round(Math.random()*3));
switch ($gameVariables.value(28)){
    case 0:
    $gameVariables.setValue(25, ($gameVariables.value(23) + Math.round(Math.random()*6 + 4));
    $gameVariables.setValue(26, ($gameVariables.value(24) + Math.round(Math.random()*6 + 4));
    break;
    case 1:
    $gameVariables.setValue(25, ($gameVariables.value(23) - Math.round(Math.random()*6 + 4));
    $gameVariables.setValue(26, ($gameVariables.value(24) + Math.round(Math.random()*6 + 4));
    break;
    case 2:
    $gameVariables.setValue(25, ($gameVariables.value(23) + Math.round(Math.random()*6 + 4));
    $gameVariables.setValue(26, ($gameVariables.value(24) - Math.round(Math.random()*6 + 4));
    break;
    case 3:
    $gameVariables.setValue(25, ($gameVariables.value(23) - Math.round(Math.random()*6 + 4));
    $gameVariables.setValue(26, ($gameVariables.value(24) - Math.round(Math.random()*6 + 4));
    break;
    default:
    $gameVariables.setValue(25, ($gameVariables.value(23) + Math.round(Math.random()*6 + 4));
    $gameVariables.setValue(26, ($gameVariables.value(24) + Math.round(Math.random()*6 + 4));
    break;
}
 

MagicPizzaGuy

Mother of All Omelettes
Veteran
Joined
Jul 16, 2014
Messages
50
Reaction score
44
First Language
Portuguese
Primarily Uses
RMMV
Im retarded! I forgot a lot of ) everywhere, thanks for pointing out the ) I wouldn't have noticed hahahaha
 

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

Latest Threads

Latest Profile Posts

This time around I don't have early access to the new maker, so I have to wait like everyone else to look under the hood. I really hope we get to soon though, I'm pretty excited :D
Chaos17 wrote on Poryg's profile.
Hi, I am following your videos tutorials serie about coding on MV and I am at the third video. Thank you for making it but's a bit hard to follow since you don't show the whole plugin at the end. I had to screenshot the lines between 110-159 because you scrolled so fast on them.
:rtear:
I'm not sure if I should be happy for MZ, or sad for MV.
Not going to lie.... The update's cool and all, but I immediately ran to Mog's site and was like, "Update! Update! Update!" while breathing on the page of his Star Ocean Battle System plugin. :kaoswt:
Ho boi. I can already see the storm of ugly actor faces RTP customizable facesets from MZ are gonna flood. XD

Forum statistics

Threads
99,463
Messages
965,684
Members
131,073
Latest member
James1998
Top