Strange Game_Enemy#actions iteration bug
#1
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.
[Image: Button-BOTB.png]
[Image: Save-Point.gif][Image: Button-You-Tube2.png][Image: Button-Sound-Cloud2.png][Image: Button-Audio-Mack2.png]
[Image: LS-Banner.gif]
NEW ALBUM OUT NOW!

Reply }


Messages In This Thread
Strange Game_Enemy#actions iteration bug - by Kain Nobel - 06-14-2011, 04:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Strange behavior RGSS Charlie Fleed 10 16,833 03-15-2009, 04:11 PM
Last Post: woratana



Users browsing this thread: 1 Guest(s)