Hi, I'm trying to figure out how to apply a random state after using a skill. That and maybe check to see what states it has and clears any possible state that could be applied by this skill(So you can't just stack it).
I looked around and found a post that kinda gave a base idea but doesn't seem to work. In part because it's probably not set up to work with mine but could someone take a look. Right now i'm just trying to apply a random state;
<Pre-Damage Eval>
var rr = Math.floor(Math.random() * 3);//Get a random number
if(rr==0){
target.addState(34);//state ID
}
if(rr==1){
target.addState(35);
}
if(rr==2){
target.addState(36);
}
</Pre-Damage Eval>
I might need to fixe the "Math.random" part but unsure of how to go about it.
you might something like this:
Math.randomInt(X) return to a random integer. (from 0 to X - 1)
Math.randomInt(15) will return a number from 0 to 14
X + Math.randomInt(Y) for a range from x to y
Example would be: 2 + Math.randomInt(8) will give you a result from 2 to 9
do you have yanfly skill core? that notetag isn't part of buff/state core its from skill core
edit: the things you would change is the * 3,
the number of if statements,
and the state numbers.
look at the * 3 as * X with X being the number of possible states the skill can inflict.
make a separate if statement for each possible state starting with if rr = 0.
and of course match the state numbers to the state IDs in your database.
since you want this skill to also clear any older states so they don't stack you should make it
<After Eval> so that the effects section of the skill can be used to cure all old states
Also when I first stumbled across this code, it was listed as Buff/state core so that might be why I'm having trouble. I DO have skill core but.
Trying
<Pre-Damage Eval>
var rr = Math.randomInt(3);//Get a random number
if(rr==0){
target.addState(34);//state ID
}
if(rr==1){
target.addState(35);
}
if(rr==2){
target.addState(36);
}
</Pre-Damage Eval>
What I think should happen; game makes a number from 0 - 2(0 counts as an integer).
It then generates a state based off which number it came up with.
Could the code be making EVERY number from 0-2? Is that the problem, that I'm getting something like 1.32434214?
can you post a screenshot of the skill? the notetag should be working but there could be something else in the skill thats causing the problem
Ah I seemed to have found the issue. It only works if I have the damage set to HP damage(Though it probably would work for any damage types besides None).
Kinda don't want a 0 pop up of "No damage" each time they try to use the ability.
have you tried changing it to Before Eval or After Eval instead of Pre-Damage Eval and Post-Damage Eval?
skill core plugin has a footnote about how the damage evals can effect the damage formula.
Before and After don't effect the formula.
edit: i just read headnote though stating before and after doesnt even matter if the skill hits or not.
but since the skill is "certain hit" anyways that wont be an issue for this 1 skill in particular.
I could try. Message you back later about it.