Hello everyone, I'm using the action sequence to play SE.
if target.result().hpAffected
se: SE_07, 100, 100, 0
else
se: SE_21, 100, 100, 0
end
The problem is, how do I make if statements within if statements.
I have tried the following: (All three below does not seem to work)
if target.result().hpAffected
se: SE_07, 100, 100, 0
else
if Math.randomInt(3)+1 <= 2
se: SE_12, 100, 100, 0
else
se: SE_18, 100, 100, 0
end
end
AND
if target.result().hpAffected {
se: SE_07, 100, 100, 0
}
else {
if Math.randomInt(3)+1 <= 2 {
se: SE_12, 100, 100, 0
else
se: SE_18, 100, 100, 0
}
end
}
end
AND
removed the "end" and/or added ";" and/or used a script call to play the SE (without the qoutes)
NOTE: The 1st code works fine. It plays a hurt voice SE if the enemy attack is greater than 0, otherwise if the character evaded or counter attacked or the enemy missed the code will play a snarky laugh SE. I don't want to play the snarky laugh everytime since it gets kind of annoying especially if the character is fighting a low leveled monster, thus the randomizer I'm trying to achieve/make.
if target.result().hpAffected
se: SE_07, 100, 100, 0
else
se: SE_21, 100, 100, 0
end
The problem is, how do I make if statements within if statements.
I have tried the following: (All three below does not seem to work)
if target.result().hpAffected
se: SE_07, 100, 100, 0
else
if Math.randomInt(3)+1 <= 2
se: SE_12, 100, 100, 0
else
se: SE_18, 100, 100, 0
end
end
AND
if target.result().hpAffected {
se: SE_07, 100, 100, 0
}
else {
if Math.randomInt(3)+1 <= 2 {
se: SE_12, 100, 100, 0
else
se: SE_18, 100, 100, 0
}
end
}
end
AND
removed the "end" and/or added ";" and/or used a script call to play the SE (without the qoutes)
NOTE: The 1st code works fine. It plays a hurt voice SE if the enemy attack is greater than 0, otherwise if the character evaded or counter attacked or the enemy missed the code will play a snarky laugh SE. I don't want to play the snarky laugh everytime since it gets kind of annoying especially if the character is fighting a low leveled monster, thus the randomizer I'm trying to achieve/make.
Try using an else if statement. Something like this example.
<Pre-Damage Eval>
if (user.isStateAffected(45)) {
var rand = Math.random();
if (rand < 0.4) {
user.gainMp(-5);
}
else if (rand > 0.6) { <-------else if....acts like an if statement when there is more then 2 outcomes like an if or else.
user.gainHp(-100)
}
else {
user.gainHp(-100), user.gainMp(-5);
}
}
</Pre-Damage Eval>