Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Any Scope crashes when an escape fails under certian conditions) #379

Open
weso12 opened this issue May 9, 2021 · 1 comment
Open

Comments

@weso12
Copy link

weso12 commented May 9, 2021

To replicate the issue here's what I did

  1. Create a New Project
  2. Install the Hime Target Any scope plugin (and nothing else)
  3. Give the attack command "<scope: any one>"
  4. Give the goblins 999 speed to ensure an escape fails
  5. Initiate a battle with said goblins (make sure escape is possible)
  6. Attempt to escape
  7. See crash (line 154)
    Reading the source code and testing the console (I have mild programing knowledge but enough to know how to fix it) it seems
    that what happens is that the battler variable in this context will attempt to index an array when the _targetIndex is at -1 which creates undefined array.
@HimeWorks
Copy link
Member

Thanks for the report.
I looked at the issue and found that the problem is related to "random" targeting in general.

When I wrote the plugin I had intended it to be used for skills where you would select a target and hadn't considered what happens if the skill picks a random target.

So for example you pick an ally, and then if the ally is dead, it would apply the skill to another ally. And if you pick an opponent, it would apply the skill to another opponent. This is to match the default targeting behavior.

Problem is, for random targeting, this logic doesn't work, because we don't actually have a specific target at this point (an actor or an enemy). How "any" target should be determined is open to interpretation at this point. Would it randomly decide to attack allies or opponents, and then from the selected team, pick one random target?

The issue could be fixed if a specific team were to be determined for a random target, but I'm not sure what would be the best way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants