Select Multiple Targets, v2.0.2

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
Created from this thread.

Version 2.0.2: Github Link

Description
This plugin allows the user to mark a skill as capable of selecting multiple single targets, so that it repeats, but not against random enemies. For example, you could have a skill target 3 enemies, but you select which 3 targets instead of having to choose "3 random enemies" for your scope.

Terms of Use
This Plugin is available for commercial and non-commercial use, as long as credit is given to the author listed in the @ author section of the Plugin. Credit must be listed in-game, as well as in any additional credits documentation provided with the game.
This Plugin may be modified in any way by any author, most notably for compatibility fixes with specific projects or other Plugins, as long as credit is provided to the original author and to whichever author made said modifications, according to the above-stated rules.

Installation
Either right click the Github link above and save as "SelectMultipleTargets.js", or create a new text file called "SelectMultipleTargets.js" and copy-paste the text from the link into it.
Move the file into your project's js/plugins folder.

Instructions
Have the scope of your skill or item be set to either 1 enemy or 1 ally. If you use a scope that doesn't open up the actor selection window or the enemy selection window, then this Plugin will not work.

In the note box of the skill or item, put <multipleTargets: x>, where x is the number of targets you want to be able to select. For example, in a default project, if you put <multipleTargets: 4> in the note box for the heal skill, then you will be able to select 4 targets.

If you select a target that is no longer valid by the time the battler's action begins, then a random target will be selected instead. As an example, if Harold chooses to heal Harold, Therese, Marsha, and Lucius, but Marsha dies before Harold's turn comes up, then Harold will heal Harold, Therese, a random living party member, and Lucius.

EDIT: V 1.0.1 released, fixing an issue where select all skills was causing an error to be thrown because undefined was being added to the multipleTargets array.
EDIT: V 2.0.0 released, adding selection indicators to mark which targets you've already chosen and in what order.
EDIT: V 2.0.1 released, fixing an issue where cycling to a previous actor was not resetting their action selection.
EDIT: V 2.0.2 released, resolving an issue where the target confirmation method should only be used if more than one target is specified.
 
Last edited:

Drifter92

Veteran
Veteran
Joined
Aug 9, 2017
Messages
122
Reaction score
82
First Language
English
Primarily Uses
RMMV
Hi Zevia!

Thanks for taking the time to put this together.
I've been looking for a plugin that does exactly this! :D I'll give it a go in my project :)
I've not found any issues so far.

One thing i thought of that would be a good extra feature (More of a visual thing). When selecting multiple enemies it would be nice if the enemies that have been selected stay flashing white, so that the player can easily see which enemy has already been selected. Hopefully this makes sense :)

Cheers!
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
@Drifter92 Finally got around to adding in your suggestion! I made it so that when you select a target, it will now add a triangular indicator over their head to indicate that you've selected them previously and what order you selected them in.

The indicators use gradient colors which are customizable through Plugin parameters. You can also choose not to use indicators, if desired. Indicators will not show up on Actors if side view battle is not enabled in System settings.

Here are a couple example GIFs of the new feature:

 

Drifter92

Veteran
Veteran
Joined
Aug 9, 2017
Messages
122
Reaction score
82
First Language
English
Primarily Uses
RMMV
Hi Zevia! This is a super cool addition to the plugin :D Thanks for taking the time to add this. It really helps to display what is going on.
:kaoluv:
 

DisManAZ

Villager
Member
Joined
Sep 6, 2019
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMMV
Zevia,

This doesn't play well with Yanfly's TargetCore and SelectionControl plugins. I don't know if you would like to focus on making them play nice together as your plugin is what I've been looking for. But if you're interested in getting them to play nice, let me know and I can help test with you.

When you have yours and Yanflly's enabled, you get:
TypeError
Cannot read property 'length' of undefined

Right after you make your first target selection.

I'm sure it's something with array building. It appears this also breaks the "x random enemies" functionality.
 
Last edited:

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
@DisManAZ I'm not currently planning to work on any compatibility fixes with other Plugins. Yanfly's code often performs some fairly major overhauls to the battle system, so it's often a lot of time to figure out how to get things to play nice.

However, you're welcome to have someone else work on a compatibility fix with my Plugin, as long as credit is given to authors.
 

DisManAZ

Villager
Member
Joined
Sep 6, 2019
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMMV
@Zevia - Thank you for the response. This is a great plugin and I definitely wasn't going to abandon using it. :) It's too good! Going from rage like skill training to focused training and targeted dual cast to higher levels is a great feature in a game. Makes your actors more skilled as they go along.

I actually figured out a setting in Yanfly's engine that was the cause for this. Hopefully this will help somebody in the future.

Because Zevia's plugin requires a targeting method, Yanfly's Battlecore gets in the way a little. When you have an attack that doesn't have targeting, such as all or random, Yanfly's engine by default has a setting that interrupts the sequencing.

This is located under the following in Yanfly's Battle Core
--- Selection Help ---
Select Help Window

Change Select Help Window from True to False and the compatibility with this plugin is there. Personally, I don't think that help window on selection being disabled is going to be a big deal, but some may. I hope this helps somebody in the future who may want to use this plugin like I did. This plugin is too cool to pass up IMO.

Thanks again Zevia! I love this plugin!
 

DisManAZ

Villager
Member
Joined
Sep 6, 2019
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMMV
I hate to double post...but I found a bug and I don't want to water down my other post or bury the bug in it. Here's how to reproduce:

1. Create a skill. Set appropriately.
2. Enter battle.
3. After selecting your targets, back out by cancelling then do target selection again.
4. Notice you can now select any QTY of target. (This happens whether or not triangles are turned on)

I've been playing around with the JS and can't quite figure out where to reset this. I believe this one is a game breaker as once you enter the state, you have to go back to a different selection (attack) then back out and do you skill again. Most players won't think of that.

I've attached some screenshots. Yes, I turned off all plugins before posting to ensure this is base game incompatibility.
 

Attachments

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
@DisManAZ I'm unable to reproduce the problem in my test project.

I ensured that SelectMultipleTargets is the only Plugin enabled:


Here's my skill:


And here's a GIF of me following your steps:

1. Select Fire
2. Choose 2 of the 3 maximum targets
3. Cancel
4. Select Fire again
5. Select 3 targets
6. Skill works as expected

Are you sure all Plugins are disabled and that you have the most recent version of the Plugin from Github? Alternatively, have I made a mistake in the reproduction steps?
 

DisManAZ

Villager
Member
Joined
Sep 6, 2019
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMMV
@Zevia - Thank you for continuing to look at this. It may be sequence or that you don't have multiple actors in the party, or both are required and I didn't specify that. :) It could also be that I run LInux and use RMMV through Steam with a Proton layer...but I'm doubting that so far.

Here's a gif that shows all. Notice this effects both magic and special skills.



1. Select Skill
2. Choose all targets to get to next character. <--Sequence better explained.
3. Cancel next character attack
4. Select Skill Again
5. Select all the targets you want and plea with RMMV to let you go to next attack! :)
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
@DisManAZ I was able to reproduce the issue when I had more than one party member. The issue was that resetting the multipleTargets of an action didn't occur when calling changeActor.

I've updated the Plugin on Github with a fix that includes the following addition:

Code:
SelectMultipleTargets.changeActor = BattleManager.changeActor;
BattleManager.changeActor = function(newActorIndex, lastActorActionState) {
    var previousActor = $gameParty.members()[newActorIndex];
    if (previousActor) {
        previousActor._actions.forEach(function(action) {
            action._multipleTargets = [];
        });
    }
    SelectMultipleTargets.changeActor.call(BattleManager, newActorIndex, lastActorActionState);
};
You can download the updated version from here.
 

DisManAZ

Villager
Member
Joined
Sep 6, 2019
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMMV
Fix confirmed! Awesome job and thank you @Zevia
If I run into anything else or come up with something to improve it myself, I'll post it here.
Beautiful plugin!
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
it seems a nice plugin, but got 2 question about it.

if you select a skill -> target 3 enemies -> select a different skill -> does it work?
why not select up to 3 (may be enter to comfirm) and perform skill directly after chosen the skill
instead of re-select the skill?

Im not sure if I can use it in this project, but maybe in some other project ^^
But keep it up.
 

kkiittuuss

Villager
Member
Joined
Aug 16, 2015
Messages
10
Reaction score
3
First Language
Spanish
Primarily Uses
Hello @Zevia,

First of all I want to thank you for this awesome plugin. It absolutely saved my life.

Problem is I found a rather strange compatibility bug when using the plugin.

Somehow, when trying to create a simple aoe skill, said skill acts like a single target one.

Im not saying I do want to do a “multiple selected” aoe skill. Just a simple, plain vainilla one.
It simply doesn’t work.
Any aoe skill on you database reacts as a single target.

Any idea on why this may happen?

I am using Yanfly’s and Olivia’s scripts and I confirm that the root of this strange effect is your script because when turning it off everything goes back to normal.

Here you can see a screenshot of some of the plugins I am using.

1643E72F-C59C-4FE5-A15E-E7AE0AE84816.jpeg

If you need any further information I can provide you anything you need.

Id be very appreciated if you can look into the matter.

Thank you in advance!

EDIT: Solved here.

@Zevia - Thank you for the response. This is a great plugin and I definitely wasn't going to abandon using it. :) It's too good! Going from rage like skill training to focused training and targeted dual cast to higher levels is a great feature in a game. Makes your actors more skilled as they go along.

I actually figured out a setting in Yanfly's engine that was the cause for this. Hopefully this will help somebody in the future.

Because Zevia's plugin requires a targeting method, Yanfly's Battlecore gets in the way a little. When you have an attack that doesn't have targeting, such as all or random, Yanfly's engine by default has a setting that interrupts the sequencing.

This is located under the following in Yanfly's Battle Core
--- Selection Help ---
Select Help Window

Change Select Help Window from True to False and the compatibility with this plugin is there. Personally, I don't think that help window on selection being disabled is going to be a big deal, but some may. I hope this helps somebody in the future who may want to use this plugin like I did. This plugin is too cool to pass up IMO.

Thanks again Zevia! I love this plugin!
 
Last edited:

FireDragis

Warper
Member
Joined
Oct 4, 2019
Messages
1
Reaction score
0
First Language
Czech
Primarily Uses
RMMV
Hi @Zevia , I would like to use your plug in, but it doesn't at all even though I tested it with all plug ins off.
Here is the skill seting of the skill I'm using.Multiattack.PNG
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Hi @Zevia - I noticed that your plugin appears to be incompatible with YED_InvertTarget, probably because you overwrite Game_Action.prototype.targetsForOpponents and Game_Action.prototype.targetsForFriends without aliasing them. (Or to be more precise, your aliasing call is never reached because the _multipleTargets array always has at least 1 element.)

Since I have no skills that are both invertible and multi-target, I've just worked around it by adding "> 1" to the length check, but I thought you might like to know about this issue and fix it in a more general way.

EDIT: Almost forgot to say how it's broken. If I set a skill to "1 Ally", but when casting I press shift and select an enemy instead, then it casts on the ally of the same index as the selected enemy. This is even without any note tags for your plugin on the skill. I didn't test it, but I would guess setting it to "1 Enemy" but selecting an ally would still affect an enemy.
 
Last edited:

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
I noticed that your plugin appears to be incompatible with YED_InvertTarget
While I know Yanfly's Plugins are incredibly ubiquitous around the community, I am not currently planning to make any compatibility fixes to anything I write. I know I worked some in for previous threads / Plugins (including this one), but it's not an enjoyable activity and I'm choosing to focus my efforts elsewhere.

I haven't looked at this Plugin for a long time, but it's an interesting point about finding unreachable code - I may review it and remove unnecessary lines if I'm adding guard clauses that are never reached. I appreciate the effort you put in to review the code and see where there might be a conflict.

That being said, any Plugin in the Plugin-Requests repo on Github is free to use however anyone sees fit, as long as the original author is credited in game. If you want to work on a compatibility patch or find someone else willing to, I'll happily update the description of the Plugin with the link to the modified version for those interested.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Just for the record, that's Yami's plugin (YED), not Yanfly's (YEP). In any case, I think the unreachable code could cause problems with other plugins too. I understand that plugin-specific compatibility patches might not be enjoyable, but this particular one seemed more general to me.

I did look into modifying your code to actually fix it (rather than just a half fix that's good enough for my use case), but it seemed to be somewhat complicated so I gave up (since I only need it to not interfere with my single-target invertible skills). My initial thought was that perhaps your override function could call the base function in a loop, but their logic seems subtly different so I chose not to follow that thought further.
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
I understand that plugin-specific compatibility patches might not be enjoyable, but this particular one seemed more general to me.
it seemed to be somewhat complicated so I gave up
These pretty well sum it up for me - my Plugins are written to work with the default engine and other Plugins that I write. Trying to add compatibility fixes for any other author's work is always more difficult than it may seem at first glance, especially since we don't write unit tests or have community standards. Authors can also have widely variable skillsets, plus the default engine is already poorly documented and does not have unit tests included. Even my own code isn't documented or unit tested in most cases because I choose to save that effort for my professional work.

I typically only spend about 30 minutes to maybe an hour a week writing RMMV code at all and I've chosen to focus that time on my own project.

However, I fully support anyone who wants to take the time to try and create whatever compatibility fixes they need. It's difficult and time-consuming work and I will happily credit them for whatever they've done to contribute.
 
Last edited:

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ

I've moved the thread to Plugin Releases.


@Zevia Now that your plugin is completed, could you add your terms in the opening post?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top