- Joined
- Mar 27, 2020
- Messages
- 542
- Reaction score
- 255
- First Language
- German
- Primarily Uses
- RMMV
I want to make a Function where it checks if the Battler has any state affected that has the Note "<Speed_State>" or if thats required i would also use "<Speed_State:true>"
I tried several things ,for example :
( the battler has 2 States ,1state has the note the other state doesnt)
Example_1
Example_2
I think i need to use the ".some(function(state) {" from Example_1 but i cant make it work correctly..
I am thankfull for any help
I tried several things ,for example :
( the battler has 2 States ,1state has the note the other state doesnt)
Example_1
JavaScript:
Game_Battler.prototype.hasSpeedStates = function() {
this.states().some(function(state) {
if (state.meta.Speed_State) {
return true;
} else {
return false;
}
});
};
// this returns "undefined"
JavaScript:
Game_Battler.prototype.hasSpeedStates = function() {
for (var i = 0; i < this.states().length; i++) {
if (this.states()[i].meta.Speed_State) {
return true;
}
}
};
// this will return true but this way i cant set it to false ..
// if i add a similar Condition for "return false".. or if i use "else"
// .. the state that has the Note will make it true and
// the next state in line that doesnt have the note will set it to false..
I am thankfull for any help
Last edited:

