Having issues with multi-hit attacks

I've got an enemy in the game I'm working on that has two attacks it can do:
  • Spitting 1-3 needles at a single target
  • Spitting 2-5 needles at random targets
And I'm trying to get this to work in the game but I'm finding a few issues. The naive solution is of course to make use of the "X random enemies" clause, but the issue with that is it only allows for up to 4 attacks, and using the repeat doesn't seem to actually target randomly. Additionally, using that method doesn't let me really vary the number of times the enemy attacks.

As such I considered turning to common-events as a solution, but there are problems there too. firstly, it means that the attack that calls the event to do its thing always ends up with that "it has no effect on [target]" message, because the initial skill is just calling a common event to actually do the attacks. The second problem comes from the fact that the "force action" event command requires a user to be hard-specified, meaning that I'd have to lock the enemy into 1 specific place in the formation every time and only be able to use one copy of them per fight.

If there is a better way to do this to handle the issues I'm finding, I'd really appreciate being told. Cheers.

(fig 1: the current common event I tried for the first of two attacks)
1720965495121.png
You can do whatever you like if you program the skill with Yanfly's Action Sequences.

There's an extension for it to add commands to loop:

and to easily select random targets
Apologies if I am necro posting, but I would suggest using Target Core from YEP and use their Chain Lightning Tips and Tricks here for the random targets skill: http://www.yanfly.moe/wiki/Chain_Lightning_(MV_Plugin_Tips_&_Tricks)

You can simply remove the Damage Formula note tag as well as the <Actor or Enemy Select> notetag.

Change this part of the notetag:
var extraTargets = 3;
to
var extraTargets = Math.randomInt(3) + 2;

Math.randomInt(4) will generate a number between 0 and 2, so adding 2 makes it 1 to 4 extra targets. Plus the initial target, this will cause the total random target of 2 to 5.

Unfortunately, I am not using my personal PC with my template game so I can't quite check the notetag I used, but the above is the gist of what I have (except I kind of use agility to determine the number of extra targets).
I would suggest using Target Core from YEP and use their Chain Lightning Tips and Tricks here for the random targets skill
Note that this will only target that many random unique enemies - it can't fulfill the number of hits by hitting the same enemy more than once.

The OP didn't say they wanted it to be impossible to hit the same enemy twice.

(also, the OP hasn't been back on the site since I gave a suggested solution two months ago)
Note that this will only target that many random unique enemies - it can't fulfill the number of hits by hitting the same enemy more than once.

The OP didn't say they wanted it to be impossible to hit the same enemy twice.

(also, the OP hasn't been back on the site since I gave a suggested solution two months ago)
I think you are right. I believe that the code to be removed would be the below portion to stop the removal.
// Remove the target from the group of candidates.
members.splice(members.indexOf(target), 1);

I do have to check my template to confirm as I have tested it a couple of years back and saved it.

@zelanius, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

If OP comes back and still needs help, please report the thread to be reopened.

Original thread: https://forums.rpgmakerweb.com/threads/having-issues-with-multi-hit-attacks.170285/