Automatic Attack Targeting

How can I bypass target selection for the attack command? In my game:

  •All skills (including attack) and items have a scope of either None, All Allies, or All Enemies

  •There is only one hero

  •Each troop only has one enemy

When I select Attack, I'm forced to choose a target, even though there is only one target to choose. Just like all other skills and items, the scope of attack is set to all enemies. Clearly, the attack skill behaves differently than the others.

I'd like for attack to automatically target the lone enemy, bypassing the target selection window entirely.
Wouldn't this have the unintended consequence of not letting your player "take back" an attack if it auto-attacks? This window you want to do away with could be another chance for reconsideration to use a different ability/item/run?
Yes, technically that's correct. The game is as close functionally to Dragon Warrior as possible. This means that the severely limited amount of options in combat essentially makes the loss of a takeback feature negligible.
@Dymdez - I don't think it matters since there's only 1 actor anyways...


@rapier - why not just remove the attack option then just add it as a skill? you can easily do that via commenting out the part of the set-up for the actor command window where you add the attack command
I have to say thanks to Engr. Adiktuzmiko for getting me on the right track! Problem solved with the simplest of modifications.

No extra attack skill was required; all I had to do was comment out the select_enemy_selection call in Scene_Battle, and add a next_command call under it to continue processing. My guess is that, without a target selected for the action, the engine defaults to the first available target in its array of targets. I haven't looked far enough into it to be sure, but it's a reasonable guess.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.


Next time you need something done with scripts, please post in the RGSS3 Script Requests forum (if you're wanting a whole script created) or the RGSSx Script Support forum (if you're doing it yourself or already have a script, and just need some help)

Original thread: https://forums.rpgmakerweb.com/threads/automatic-attack-targeting.25922/