Nawfanial

Warper
Member
Joined
Oct 8, 2021
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm trying to program a skill that has a 50% chance to apply debuffs to either your enemy or yourself. I'm somewhat familiar with javascript and wrote up a simple if x = 1 do this, or if it's = to 2 do that, but I keep getting the above error. It changes from a to b every once in a while, so at least the if statement works, but the rest of it just breaks down. Can anyone help me out? I've attached a picture of the code for reference.
 

Attachments

  • takeachance.PNG
    takeachance.PNG
    60.2 KB · Views: 6

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,736
First Language
English
Primarily Uses
RMMV
a and b are only valid in the context of damage formula and maybe plugins. They mean nothing in a common event.

Also get rid of the == 0 in the top line. That is setting x to a true/false value. Technically, true equates to 1 (or anything other than 0) but if you're comparing x == 1 then you shouldn't be setting x to a boolean.
 

Nawfanial

Warper
Member
Joined
Oct 8, 2021
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
a and b are only valid in the context of damage formula and maybe plugins. They mean nothing in a common event.
In that case, how can I go about applying a state through a common event?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,877
First Language
English
Primarily Uses
RMMV
Yeah, that whole thing should just be in the damage formula of the skill.

It doesn't affect your code working, but your x variable is pointless - especially since you only use it once, you can just say
Code:
if (Math.floor(Math.random()*2)==0)
{
...
}
else
{
...
}
 

Latest Threads

Latest Posts

Latest Profile Posts

I have been enjoying a game on my iPhone, called Wonderbox. It is just a little game where you create adventures, share them, whilst also being able to play others. It's a bit zelda-esque. I have started some youtube for those, gonna start with RPG maker things soon as well. So if you wish to see, do check it out :)
SF_People3_3 added!
index.php

ScreenShot_1_3_2022_1_32_12.png
I feel QSprite for MV is underrated. I basically am able to use my chibi sideview battlers I drew on the maps and have all the motions available. this'll help a lot with cutscenes.
I've figured out how to reasonably tall-ify chibi sprites on my editor. I like that making tall sprites gives me control on expressing how tall characters seem on the field relative to each other as well as better differentiate adult sprites from child sprites.
doing some wacky experimental stuff in MV right now :kaoluv: I cannot wait to drop what I've been working on

Forum statistics

Threads
118,562
Messages
1,116,958
Members
155,604
Latest member
Freedom1987
Top