Don't worry, I got you covered. I just made it so it works right instead
this is the revised passive code. Just replace the current one.
//Does this at the beginning of the battle
<Custom battle effect>
//Sets up a variable that is equal to the value of the battler's TP
//(other changes to this are very predictable i.e. -- user.mp for MP or user.mmp for max MP)
//Also since this part happens at the beginning of the battle there's no need to set anything for if they have 9 or less.
var currentTp = user.tp;
//"if" lines are pretty easy to understand. The first condition checks if it's less than to equal to 35.
//after the "&&" if then makes sure that it's over the amount of the previous tier. I'll be annotating this with "Apply logic" from now on to save time
if (currentTp <= 35){
if (currentTp > 9){
//If the condition is met, it will apply the state number in the "()" this line will be annotated as "Add it" in future note lines
user.addState(84);
}
}
//Apply Logic
if (currentTp <= 50){
if (currentTp > 35){
//Add it
user.addState(85);
}
}
//Apply Logic
if (currentTp <= 80){
if (currentTp > 50){
//Add it
user.addState(86);
}
}
//Apply Logic
if (currentTp <= 100){
if (currentTp > 80){
//Add it
user.addState(87);
}
}
//end of the beginning of battle code
</Custom battle effect>
//These actions happen when battlers regen HP/MP/TP
<custom regenerate effect>
//setting it up again for this part of commands. New notetags, new operations, more of defining the same ol' variable.
var currentTp = user.tp;
// Since this happens during the course of combat, some code for tier 0 is needed. (also, Apply Logic)
if (currentTp < 10){
//now we're making the list of states we want to check for and get rid of based on their TP total.
//9 and less is tier 0 so that'll be all of them.
var stateRowList = [84, 85, 86, 87];
// this is setting up a new variable that calls on the "length" of the list on the list(a.k.a. Array) we made earlier
var total = stateRowList.length;
//This is a for loop..... I'll explain at the bottom what these do.
//the rest of these are the same line repeated with different conditions and slightly different lists, so go ahead and skip to the bottom
//for a lesson on for loops.
for (var i = 0; i < total; ++i) {
var deleteMe = stateRowList
;
if (user.isStateAffected(deleteMe)){
user.removeState(deleteMe);
}
}
}
if (currentTp < 36){
if (currentTp > 9){
//If the condition is met, it will apply the state number in the "()" this line will be annotated as "Add it" in future note lines
user.addState(84);
}
}
//Apply Logic
if (currentTp < 51){
if (currentTp > 35){
//Add it
user.addState(85);
}
}
//Apply Logic
if (currentTp < 81){
if (currentTp > 50){
//Add it
user.addState(86);
}
}
//Apply Logic
if (currentTp < 101){
if (currentTp > 80){
//Add it
user.addState(87);
}
}
//end of "regen" effect commands
</custom regenerate effect>
//okay, so... for loops.
// you know what this line does!
// var stateRowList = [85, 86, 87];
// You know what this one does too!
// var total = stateRowList.length;
//This is complex a bit. Basically what this does is go through "total" one array item at a time and repeats the command until
//it's gone through the whole list with the variable "i" representing item on the list being processed
// for (var i = 0; i < total; ++i) {
//so now it checks if the user has the state currently being processed from our "stateRowList"
// if (user.isStateAffected(i)){
//and if they are, it removes it.
// user.removeState(i);
//by the way, JS uses "{}" to enclose different processes. (such as if branches and for loops)
// }
// }
THIS is the code you'll put in all the tiers of heat. (it wont remove itself)
<custom apply effect>
var stateArray = [84, 85, 86, 87];
var total = stateArray.length;
for (var i = 0; i < total; ++i) {
currentStateCheck = stateArray;
if (target.isStateAffected(currentStateCheck)){
console.log("it knows" + currentStateCheck + " it's there")
if (currentStateCheck != stateId){
console.log("it knows it's not the state ID");
target.removeState(currentStateCheck);
}
}
}
</custom apply effect>
I've tested it out. it functions correctly
you can delete the console.log commands if you want, those were just to help me find what was broken while I was fixing things