Hello, I am currently working on a Gambler class, and need to be able to loop a script call for the skill "Burnout". The skill relies on a coin flip, and for every heads performs an additional attack, with the sequence ending upon the first tails. This is the script I currently have:
How would I repeat this sequence until reaching the else { cause? I would think there would be a loop or repeat function I could put at the bottom of the first if, but was unable to find anything with the terminology I used. Just a bunch of JS tutorials that honestly leave me with more questions than answers.
While I could loop the attack into itself based on Math.random(), this would mean the first attack would always hit if I am not mistaken. I suppose this could be a backup option but I think this should be relatively easy enough with the right JS.
Thank you in advance for your help.
Code:
<before eval>
if Math.random() < .5 ) {
var skill = $dataSkills[851];
entity = BattleManagerTBS.activeEntity();
BattleManagerTBS.forceAction(skill, entity);
}
else {
var skill = $dataSkills[47];
entity = BattleManagerTBS.activeEntity();
BattleManagerTBS.forceAction(skill, entity);
}
</before eval>
How would I repeat this sequence until reaching the else { cause? I would think there would be a loop or repeat function I could put at the bottom of the first if, but was unable to find anything with the terminology I used. Just a bunch of JS tutorials that honestly leave me with more questions than answers.
While I could loop the attack into itself based on Math.random(), this would mean the first attack would always hit if I am not mistaken. I suppose this could be a backup option but I think this should be relatively easy enough with the right JS.
Thank you in advance for your help.