I'm sorry if this issue has come up before. I searched the forums and Google, but couldn't find anyone with my specific issue.
When I give an actor the Auto Battle special flag, he will only do the basic attack and nothing else. I've added skills to both the class and the actor, made them cost no MP/TP, and even controlled the actor manually just to make sure the skills were usable and that I wasn't screwing up there somehow.
I even used this script along with a dummy enemy with the skills I wanted to use, but nothing has changed:
http://forums.rpgmakerweb.com/index.php?/topic/12535-enemy-ai-state-ace/
Am I missing something completely obvious?
Edit: Minor aside - Just now sealed his Attack skill as a test, and now he does nothing at all, despite having the Sleep Breath skill.
Edit2: Further testing shows that he will use other attacks if they have at least 1HP of damage in the formula. That seems weirdly cumbersome when I want my actor to just occasionally cast status effect spells without it actually dealing (or more importantly showing) that it dealt 1HP of damage.
Edit3: He'll also cast heal spells, so as long as the formula ends in a non-zero number it works. This is still a problem, unfortunately! Waaah
Auto Battle flag only uses Attack and nothing else
● ARCHIVED · READ-ONLY
-
-
Well, I think I actually solved it!
In the script "Game_Action" there is this definition:
#-------------------------------------------------------------------------- # * Evaluate Value of Action (for Auto Battle) # @value and @target_index are automatically set. #-------------------------------------------------------------------------- def evaluate @value = 0 evaluate_item if valid? #Currently modified so that every skill works, not just ones that #deal damage. @value += rand if @value > 0 self endI found that if I comment out the @value > 0 like this, it'll use every valid skill, not just the ones that deal damage:
def evaluate @value = 0 evaluate_item if valid? @value += rand #if @value > 0 self endSo there we are. Kind of weird that it had to be like that to begin with! -
Riffy Law, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.
just edit your post to add extra info.
I would be wary about changing the scripts unless you're certain that it's an actual game bug ...
And goodness knows what ELSE you're breaking in the process ...
EVERY action by EVERY battler uses that script, so you're changing it for EVERYONE, not just for your own party members on autobattle.
I am not moving this to Script Support yet because I question your claim that it's a bug, and would like to rule out the possibility that it's just the way you've set up your actors/classes/skills.
Edit: it looks like Game_Actor.make_auto_battle_actions simply gathers all possible actions, and then chooses the one that's going to do the most damage. So I'm guessing either your skills aren't usable (and that may be where the issue is), or the Attack skill simply outperforms them.
Rereading your post, it seems what the game thinks a battler should do on autobattle is not the same as what YOU think it should do. Why would autobattle choose skills that don't do any damage? -
I double posted because I thought the solution should go in a different post so people could see there was a reply and have hope.
Why wouldn't auto battler choose non-damaging skills?
If it were choosing the one that did the most damage, it wouldn't have chosen the one I set to 1 damage over the basic attack approximately half of the time (since I only had Attack and the 1 damage attack on that actor for testing purposes.)
Also, I never said it was a bug. I simply pointed out that it created an undesirable effect for what I wanted it to do, and I was sharing that info.
And you said that effects everyone, but it's specifically the auto battler section.
If you have any idea of how to create the desired effect without editing the main script, I'd be glad to hear it.
It's obvious if you had a non-controllable NPC fighting with you, you might want them to cast effects like sleep/paralysis that don't deal damage. -
I've looked at the scripts and, while I don't know if Riffy's fix is the best solution, I do believe he has the right general idea.
"Evaluate" is only used by Auto-battling Actors, not Enemies (and obviously not player-controlled Actors), and appears to be (somewhat) more complex AI than the way it determines enemy behavior if the designer gives the Enemy random skills. And I agree that it is questionable behavior that it only assigns value to direct offensive and healing skills; not one iota of priority is given to statuses, and the way "evaluate" is written, they'll never be chosen.
The "rand" does, in fact, guarantee that your auto-battler will pick a suboptimal move occasionally, but still only if it does direct damage or healing.
No idea why it would do nothing if all offensive skills are Sealed, though. I'd think selecting the max of a bunch of "zeroes" would still pick a zero.
I would imagine that the designers' excuse was that they had no idea which states would be positive or negative and so ignores them all.
My fix wouldn't be to "evaluate" but to "evaluate_item_with_target", to apply values to skills that deal zero damage/healing.
EDIT: But as counterintuitive as it is to me that it would never select a skill with zero "value", it's true. I have an auto-battle character but hadn't defined his skills yet. I just gave him one of my debug abilities that applies a bunch of statuses, and even the command under which said debug ability would appear, and he'd never use it even if I disabled his regular attack. -
Autobattle needs some criteria to select which skill to use.
In default, the programmer decided to make that criteria "most damage" - if they had made it a random choice, other people would have protested.
If you want the autobattle to make the choice based on something else, you can easily make a script request - but then, you would have to tell the scripter what criteria to use.
So what would be your choice of the selection criteria? how would you decide which skill (of every possible skill in the entire database) should have preference over which other skills? -
I see where you're coming from, but there's no excuse for ignoring all skills that do no damage/healing if you literally can't use any other skills. Funny thing is: I can't find where in the scripts that behavior would be defined that way, yet as I said, I have confirmed for myself that it does, in fact, work that way.
EDIT: Actually, I think I know why. My guess: if Attack is disabled, it's still put into the "action" list with a value of zero. Then, when it looks for the maximum value, if everything is zero, it sees "Attack" at the top of the list and picks that. But Attack is disabled, so when the actor's turn comes around, it does nothing.
FURTHER EDIT: Yup, that's exactly what's happening. If you change the way it builds the list so that Attack is at the END of the list, it'll pick whichever zero-value action instead comes first (of course, it will always be the SAME zero-value action, presuming the list doesn't change. So really, the solution is to define "value" for non-offensive non-healing skills.) -
I would create a new method in the Action class that evaluates according to YOUR criteria, then overwrite the method in the Actor class to use the new method instead. Or, if the skills get pulled into the usable_skills array even if they have 0 HP damage, just change where it chooses by value to choose by a new method in the class, and make it return 1 for skills that generate 0 damage.
I'd spend more time looking into the values that are generated though. I'm guessing max_by is an rgss3 thing, as I couldn't find it in the help file OR in my Ruby 9 manual (and didn't look too much further after that). I'm surprised you said giving it a HP damage of 1 makes it choose that over attack, which likely has a far higher HP damage. So if max_by DOES choose the skill/attack with the highest value, the formula it uses isn't so straightforward, and 1 might not be the best value to return.
That way - creating a new method - you are affecting ONLY the party's battlers who use autobattle, and not every other battler who might need to call that method (maybe that method IS only called by the party's battlers who are on autobattle - I'd have to check again to see)