Help! Random States in Damage Formula or Yanfly Buff/state Core

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
hi im trying to create a curse skill that randomly picks 1 out of 6 types of states. but im having trouble with it. none of my code works in the damage formula box. 


example.


x = Math.floor(Math.randomInt(6) + 1); x = 1 b.addState(2); x = 2 b.addState(3);  x = 3 b.addState(4);  x = 4 b.addState(5);  x = 5 b.addState(6);  x = 6 b.addState(7);


no errors but no state is applied. the code to me looks right but maybe its syntax got wrong idk. please help.


ive also tried using yanfly's buff state core using lunatic mode. but it pops up error messages when i enter a similiar but slighty different code then above.
 
Last edited by a moderator:

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
445
Reaction score
209
First Language
English
Primarily Uses
RMMV
Are you using if statements?  If not, that's the problem.  It's hard to determine much without seeing the code you used.  Post the lunatic mode code you used and maybe we can figure out the problem.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,824
Reaction score
7,888
First Language
German
Primarily Uses
RMMV
That code doesn't look right to me, because no matter what, you never used the x if that is exactly the code you placed, because all x is used in are assignments, there isn't a single if or any comparison using x (which would be x===2, not x=2)


That said, why using X at all?


b.addState(Math.floor(Math.randomInt(6) + 1));


Such a code will require you to have the states in a consequitive ID-sequence in the database, but ordering them is easier than placing half a dozen if-sequences in the damage formula.
 
Last edited by a moderator:

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
thank you ANDAR!!! that code works like a charm!


b.addState(Math.floor(Math.randomInt(6) + 1));


I spent hours trying to figure this out.
 

Nerdboy

Veteran
Veteran
Joined
Jan 4, 2017
Messages
78
Reaction score
7
Primarily Uses
if anyone wants the code for it. this skill i  call "Plague". it inflicts 5 types of states at random. and hits all enemies.


x = Math.floor(Math.randomInt(5) + 1); if (x === 1) {b.addState(46);} if (x === 2) {b.addState(47);} if (x === 3) {b.addState(49);} if (x === 4) {b.addState(50);} if (x === 5) {b.addState(51);}


im having so much fun with Math.randomInt here's another skill called, "Roulette". it adds a random multiplier with luck as its base damage type from 1-100 minus 0-25 of enemies luck stat. very fun skill to use. 


a.luk * (Math.floor(Math.randomInt(100) + 1)) - b.luk * (Math.floor(Math.randomInt(25)));
 

Latest Threads

Latest Posts

Latest Profile Posts


And the beginning of a nearly complete grid system dawns.

I want to add a thin pixel border around the entire region. Like across all blue highlights that connect and red attack highlights that connect.
Ami
--- Remake ---

Hero: Hey,look! Some Artist will Remake us to 3D!
M.Knight: Really? Then i hope they make me so Cool & Handsome
Heroine: I hope they make me Cute & Sexy,too
(6 Months Later,The 3D Model Are Revealed With Unexpected Yet Horrible Model)
Hero: (Spit The Water)
M.Knight: What the Hell?!
Heroine: I'm Dissapointed...
my battle system is REALLY coming together. I can already see strategies between 2 of my party members forming lol. helps that battles are 2 at a time. but the combo of these two is really fun.
@taarna23's status just made me realise I haven't had any scam calls since that guy who hung up on me before he even began reading his script. How quiet it's been ... they were pretty much the only people who ever called!

Forum statistics

Threads
107,778
Messages
1,032,112
Members
139,925
Latest member
yosihuta
Top