06-14-2011, 04:23 AM
Script's Purpose
The script I'm writing is supposed to prevent enemies from using pointless state-only skills that don't have a damage factor, also supposed to prevent enemies from random targeting actors whom the skill would be useless on, etc.
Symptoms
Iteration bug: With the method Game_Enemy#actions, I run an iteration that is supposed to filter all actions, check which is a skill, check if skill has power 0, check if skill has valid +/- state sets, then remove skill if conditions are all met and the action is pointless against the offending party. The problem sort of defies logic, and I have no other meddling scripts to cause this glitch.
I can print the default method, which returns all RPG::Enemy::Action objects just fine.
Right after that, I iterate through the script with actions.each {|action| ...}, but for some reason there are certain actions that get skipped. From the tests I ran, it appears that it only skips state-skills which target all (ie, Mass Venom) while at the same time others are successfully iterated through (ie, Mass Fire).
Target Random bug: The script is set up to fix random targeting methods so that a pointless state-skill won't be used on somebody whom the skill would be pointless on. It does have a DBS limitation I'm not really worried about (the same actor might be targeted during the same turn even though an enemy who acted before it inflicted actor with [state].) The one thing that is bugging me though is once in awhile, on a new turn, enemies might target an actor with a pointless state-only skill, I'm not sure where I slipped up.
Demo
I've got a ton of scripts on this, so I've isolated the problem script to its own demo.
http://www.mediafire.com/?g2x031be8g8z3w4
You can go into the script itself to set testing = true/false, which will give you a printout of whats going on behind the scenes.
The script I'm writing is supposed to prevent enemies from using pointless state-only skills that don't have a damage factor, also supposed to prevent enemies from random targeting actors whom the skill would be useless on, etc.
Symptoms
Iteration bug: With the method Game_Enemy#actions, I run an iteration that is supposed to filter all actions, check which is a skill, check if skill has power 0, check if skill has valid +/- state sets, then remove skill if conditions are all met and the action is pointless against the offending party. The problem sort of defies logic, and I have no other meddling scripts to cause this glitch.
I can print the default method, which returns all RPG::Enemy::Action objects just fine.
Right after that, I iterate through the script with actions.each {|action| ...}, but for some reason there are certain actions that get skipped. From the tests I ran, it appears that it only skips state-skills which target all (ie, Mass Venom) while at the same time others are successfully iterated through (ie, Mass Fire).
Target Random bug: The script is set up to fix random targeting methods so that a pointless state-skill won't be used on somebody whom the skill would be pointless on. It does have a DBS limitation I'm not really worried about (the same actor might be targeted during the same turn even though an enemy who acted before it inflicted actor with [state].) The one thing that is bugging me though is once in awhile, on a new turn, enemies might target an actor with a pointless state-only skill, I'm not sure where I slipped up.
Demo
I've got a ton of scripts on this, so I've isolated the problem script to its own demo.
http://www.mediafire.com/?g2x031be8g8z3w4
You can go into the script itself to set testing = true/false, which will give you a printout of whats going on behind the scenes.