So I'm using Buffs & States to create a "flight" state where flying enemies can only be hit by long range skills. If the attacks are not long range, they miss. Yanfly has written some example shield states that are very similar to what I need, so I used those as examples.
Of course, I'm here, so that means that my code does not work. Oddly enough, neither do Yanfly's examples when I test those in my own game. Thought it might be some plugin incompatibility or something, so I double checked that my plugins were in the right load order. They're as suggested. I loaded only Yanfly's plugins into a fresh test project and tested it there. No luck there either. Thought maybe the Custom Select Effect itself wasn't triggering, but if I set this.item().successRate to zero on its own without conditionals then the success rate is indeed set to zero.
So to recap:
1. Notebox code very close to original code, but doesn't work.
2. Original code does not work either.
3. Fresh project exhibits the same issues.
4. Custom Select Effect IS working... but it's allergic to conditionals.
Mysterious!
Here's my notebox code for reference:
Of course, I'm here, so that means that my code does not work. Oddly enough, neither do Yanfly's examples when I test those in my own game. Thought it might be some plugin incompatibility or something, so I double checked that my plugins were in the right load order. They're as suggested. I loaded only Yanfly's plugins into a fresh test project and tested it there. No luck there either. Thought maybe the Custom Select Effect itself wasn't triggering, but if I set this.item().successRate to zero on its own without conditionals then the success rate is indeed set to zero.
So to recap:
1. Notebox code very close to original code, but doesn't work.
2. Original code does not work either.
3. Fresh project exhibits the same issues.
4. Custom Select Effect IS working... but it's allergic to conditionals.
Mysterious!
Here's my notebox code for reference:
<Custom Select Effect>
if (this.item() && DataManager.isSkill(this.item()) && this.isForOpponent()) {
// create a list of valid skill types.
var validtypes = [];
// Add the skill type ID's to that pool.
validtypes.push(4, 6, 8);
// Create a pool of valid skills.
var validskills = [];
// Add the individual skill ID's to that pool.
validskills.push(16,17,20);
// check to see if it's a valid move
if (!validtypes.contains(this.item().stypeId) || !validskills.contains(this.item().id)) {
// store the original success rate.
this._formerItemSuccessRate = this.item().successRate;
// set the attack to miss.
this.item().successRate = 0;
}
}
</Custom Select Effect>
<Custom Deselect Effect>
// if the success rate has been changed, restore it
if (this._formerItemSuccessRate !== undefined) {
this.item().successRate = this._formerItemSuccessRate;
}
</Custom Deselect Effect>