Using a forced action to attack when no enemies are present crashes the game: this is a massive problem for my game

In my game, I use forced actions to make my character's attacks have multiple parts or do multihits (without wasting hits on enemies that should be gone but aren't until the attack is over) (like shown below). It seems like that when doing this when no enemies are present, it crashes the game. Does anyone know of a workaround or fix? Possibly a (simple) way to prevent performing the forced action if 0 enemies are on the field?
As far as I can tell, the action system in the unmodified shouldn't crash if an action is attempted with no targets. It looks like it would just end the action immediately with no effect. So, I think you may need to give more information about your situation, like what plugins you're using.
As far as I can tell, the action system in the unmodified shouldn't crash if an action is attempted with no targets. It looks like it would just end the action immediately with no effect. So, I think you may need to give more information about your situation, like what plugins you're using.
Here's all the plugins I'm using. If it's one of the plugins causing the crash, I bet it'd be EllyeSimpleATB, but I'm not sure.
I've been trying out Ellye_ATB too, so I took a look at its code and managed to find at least one place that may be able to crash if there are no targets. To be precise, it would be a crash if any of the <self_atb>, <target_atb>, or <cast_time> note tags use the b variable, as that variable will be undefined when there are no targets. Ellye uses an eval for these formulas, but unlike the damage formula (or even ATB formulas in other places in the plugin), the eval is not guarded to catch errors in the formula, so I think it could crash the whole game. This happens in the Display Turn Order logic, so if that's the cause, disabling turn order display would probably fix the crash. Of course, there are surely better ways to fix it, but that could be a quick test to verify whether it's the cause.

By the way, where did you find that Show All Icons plugin? It sounds like it might be useful for my game as well, assuming the author allows edits.
I ran a test in the troops menu battle test thing and with the display turn order off, it still crashed the game. (Btw the crash message is something like "Cannot get Scope of Null")

By the way, where did you find that Show All Icons plugin? It sounds like it might be useful for my game as well, assuming the author allows edits.
This should be it, and I'm pretty sure that they do.
Btw the crash message is something like "Cannot get Scope of Null"
Huh? That's odd. That shouldn't have anything to do with targets. Scope is something that an item or skill has, so that seems to imply it tried to use a nonexistent skill or item (most likely, skill or item 0).

Could you maybe post the full error message with stack trace? You can probably see it by pressing F8 while testing and looking in the Console tab of the window that opens. In the unlikely event that nothing happens when you press F8, just press it before the crash and make the game crash with that window still open. (Though, I doubt that would be a problem – I've only seen F8 fail when the game crashes at launch.)
Huh? That's odd. That shouldn't have anything to do with targets. Scope is something that an item or skill has, so that seems to imply it tried to use a nonexistent skill or item (most likely, skill or item 0).

Could you maybe post the full error message with stack trace?

Here it is, not sure what this means though.

Edit: Could the forced skill's targeting being set to "random" have something to do with it?
Okay, so it definitely occurs during a forced action. Although I see Ellye_ATB in the stack trace, it doesn't seem like it's directly the cause… though I can't be certain. It definitely looks like it's trying to force a "null" action somehow. But that's really odd, because the Force Action event command doesn't even allow you to put skill ID 0 in – it forces you to choose a valid skill.

…

Okay, I think I may have found it. The decideRandomTarget function sets the skill ID to 0 if it doesn't find any valid targets. It then tries to execute skill 0, which doesn't exist, and crashes. Looks like your guess of "random target" being the culprit was correct.
Okay, I think I may have found it. The decideRandomTarget function sets the skill ID to 0 if it doesn't find any valid targets. It then tries to execute skill 0, which doesn't exist, and crashes. Looks like your guess of "random target" being the culprit was correct.

Simply changing the Force Action setting to last target fixes the issue. I think having the skill set to "1 Random Target" should preserve the random targeting effect I want on the move.

Thank you so much.

Original thread: https://forums.rpgmakerweb.com/threads/using-a-forced-action-to-attack-when-no-enemies-are-present-crashes-the-game-this-is-a-massive-problem-for-my-game.181543/