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,102
Reaction score
15,524
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
2,746
Reaction score
1,611
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


Finally was able to record the rest of the game demo! I added some edits here and there, this is why it takes me so long to do stuff cuz I find a problem and have to fix it asap. x.x
Game: https://dj990j.itch.io/region-of-mythos
Databasing. Just with what I consider "bare minimum", I have listed over 200 skills. That's not all of it, and isn't even considering skills that only 1 class would realistically have. lol

It's a Spanish devlog don't get scared!.
Just read the forum rules just for kicks and rule 14 reminds me of this:
150.jpg
I'm in the process of converting all locks and intimidate/persuade dialogue options into D20 DC based success/fail (modified by player skill). Before, it required a certain flat amount you had to meet, but with rolls, it offers more freedom. For instance, you can repeatedly try to unlock a door instead of just not meeting the requirement to unlock it.

Forum statistics

Threads
117,060
Messages
1,104,191
Members
153,025
Latest member
PHzinho
Top