Trigger target selection for a skill immediately after using another skill?

Hey all,

I've been struggling with a somewhat complicated issue for a while now. With Visustella, I'm trying to use a skill to target an enemy and store their index, then immediately trigger targeting for a separate skill without going back to the command menu and requiring another skill input .

I'm aware of force skill, but to my knowledge, there's no way to allow the player to select their target when you force a skill. Any ideas? A lot of my skills hinge on being able to do this. Thanks!
Your description is a bit vague.

I'm not a VisuStella guy, but I'd be surprised if what you're describing is part of the normal "action sequence" shenanigans.

As-is, the description in your post would require some additions to Scene_Battle's input handling. You'd need a way to determine which skills would trigger a secondary skill target selection, and all of the additional handling that entails.

You also might consider something that's incredibly rare on this forum, which is actually sharing some details about these skills that you want to implement. Rather than zeroing in on a specific method of implementation, if you describe your goals in broader strokes, you might get some more ideas.
what you have is not a question of the skill, but a question of the battlesystem.
it can't be done in default turnbased at all, because the default seperates the turn into a decision phase and an execution phase, and you cannot go back between them.

other types of battlesystem are working differently, you might try out ATB or CTB type battles.


that said, there is a way to control force action, it just requires a much more complex common event.

Example:
The skill is set to one target, but only places an invisible state named "target" that does nothing on said target. (no message, no icon, no effect) before calling the common event.

in the common event, you'll have eight conditional branches checking the eight possible enemies for which has that state. if the conditional branch is true, the commands (including force action) inside that branch are targeted on that enemy index before removing the state again (to prevent multiple effects).

If you have several different skills with this mechanic each needs a different target state - but each single skill can be used multiple times by multiple actors (that is handled by removing said state above)
Can you make a fake select target? At the end of skill action sequence show arrow picture above first member of troop alive members and control variable, then put a loop that checks up down ok and moves the arrow between enemy sprites and controls variable and breaks loop at ok. That gives you a target for the force action or whatever (you can just continue the old actionS).
Can you make a fake select target? At the end of skill action sequence show arrow picture above first member of troop alive members and control variable, then put a loop that checks up down ok and moves the arrow between enemy sprites and controls variable and breaks loop at ok. That gives you a target for the force action or whatever (you can just continue the old actionS).
YES! This works!!! Thanks so much homie. And thanks to the others who have replied. This solution is pretty laggy but I'm sure I can find a way to optimize it. Woohoo!
Cool!

Don't know why there would be some lag though, show how you did it and maybe people can give some advice what to change.
Cool!

Don't know why there would be some lag though, show how you did it and maybe people can give some advice what to change.
I scrapped my current method — I think I'm overcomplicating it on the scripting side. I can get the loop to work no problem with little to no lag as far as just hitting the buttons to scroll the number from 1 to 8, and when I hit the OK button it deals damage to the appropriate enemy index (I use HUD Maker to show the variables at play). So mechanically we're set. My issue right now is making sure that the variable is only being set to the index of a valid enemy.

The stuff that was lagging my game was a very convoluted chain to check whether an enemy index was appropriate to set the variable to — so seeing whether an enemy of that index exists in the troop, whether it's alive, and whether it has a state. If it didn't meet those requirements, I had it set to either subtract from or add to the variable based on a variable I set on button press that tracked whether it was left or right, then jump to evaluate whether the new index value was valid. And finally, setting coordinates based on the enemy index that the variable is set to to place a picture there.

However, I couldn't get the picture to change location, and for that matter the coordinate variables to change at all (this stumped me) so I think that I had some massive errors and just need to totally scrap what I was trying before — was there a specific method for setting up the variables and moving the picture that you'd recommend? (Sorry for the lack of pictures, but I sense that I was going about this the super wrong way and there was a lot).

You mentioned checking the first alive member of troop — I looked up how to do that, and I found this post, which mentions that checking aliveMembers returns an array. So I'm guessing that's the key, but I'm not sure the most efficient way to utilize an array like that. Any way for the variable to be set to the next value in the array in a certain direction maybe? Building on that, I was thinking perhaps there might be a way I could return an array of enemy indexes that filters all my state requirements to only leave the indexes of valid targets available?

I'm not really sure the absolute most efficient way to check those things. I had them in a separate section outside of the loop that I used label jumps to navigate, but yeah, it just lagged to death. I feel like I'm way overcomplicating this.
I feel like I'm way overcomplicating this.

You are. You are too far into the technical weeds and have yet to put into basic words what you want to do and how you expect it to work. You've mostly talked about how you think you should implement it and/or how you've tried.

Are you trying to trigger a secondary target selection for a separate skill after you initially select a target for a specific skill?

For example:
  • Let's say that you have a skill, called Healing Strike: attack one enemy, and immediately heal one ally afterwards.
  • After selecting Healing Strike from the skill menu in battle, the player can select an enemy to target—exactly as per default.
  • After selecting an enemy, the player is prompted with a window to select an actor—this is where your custom handling comes in.
  • On selecting an actor, the skill input is finished, and you'd advance either to the next actor command or the next battle phase.
If that's what you want to do, then you realistically need a custom plugin to modify the command input handling. You should also consider custom UI prompts, because immediately jumping from an enemy selection window to an actor selection window with no context would be jarring for a player.

You could probably do this with some kind of after-turn common event that prompts the player to select a target after the action actually occurs, but your latest post's description seems to imply some image positioning requirements which tells me that you have more or less skipped over all of the relevant information needed for someone to give you any kind of actionable recommendation.

Edit: I'll also add that making major changes or introducing major interrupts to the battle input system / flow really sucks, so it'd be productive if you actually presented your skill concept for potential implementation suggestions beyond what you are describing.
You are. You are too far into the technical weeds and have yet to put into basic words what you want to do and how you expect it to work. You've mostly talked about how you think you should implement it and/or how you've tried.

Are you trying to trigger a secondary target selection for a separate skill after you initially select a target for a specific skill?

For example:
  • Let's say that you have a a skill, called Healing Strike: attack one enemy, and immediately heal one ally afterwards.
  • After selecting Healing Strike from the skill menu in battle, the player can select an enemy to target—exactly as per default.
  • After selecting an enemy, the player is prompted with a window to select an actor—this is where your custom handling comes in.
  • On selecting an actor, the skill input is finished, and you'd advance either to the next actor command or the next battle phase.
If that's what you want to do, then you realistically need a custom plugin to modify the command input handling. You should also consider custom UI prompts, because immediately jumping from an enemy selection window to an actor selection window with no context would be jarring for a player.

You could probably do this with some kind of after-turn common event that prompts the player to select a target after the action actually occurs, but your latest post's description seems to imply some image positioning requirements which tells me that you have more or less skipped over all of the relevant information needed for someone to give you any kind of actionable recommendation.
Hey, thanks for the reply!

Sorry, to be clear, the action actually does work now without requiring a force skill thanks to rpgLord69's method. But for more context, it's a skill that I use to target an enemy that has been grabbed (checked via a state), then I target another enemy to "throw" them at said enemy and deal damage to both of them.

I just use JS Enable to control targetting conditions for the vanilla target selection, no problem there. Basic targetting functionality and action sequende stuff is solved — after setting the initial single target, I get a variable that I manipulate via rpgLord69's loop (-1 when I press the Left button and +1 when I press right, obviously jumping from 1 and 8 when needed), then when I hit the OK button, damage is dealt to the initial target and the enemy whose index (-1 ofc because Visustella indexes start at 0) matches the variable I'm manipulating via conditional branches at the end of the sequence with Visustella Action Effects. So the actual ability effect works now which is great!

With that said, all I need to figure out right now is:

1. Ask the game to return an array of valid targets for the skill (based on states I do/don't want them to have and whether they're alive/exist in the troop),

2. Find an efficient way to match the variable only to the returned indexes on button input inside the loop (to the next lowest if the Left button is pressed and the next highest if the Right button is pressed, respectively), and

3. Place a picture above the enemy as rpgLord69 advised. I'm guessing that getting the coordinates for the enemy index would be the best way?
1. You can filter troop alive members who has state to give new array (set a variable to that value)
$gameTroop.aliveMembers().filter(enemy => enemy.isStateAffected(X))

2. You can get the length of that array with .length (then you know if your scroll variable gets bigger than length you get back to 1, if scroll variable goes to 0 you go to the value of length).

3. I think here's a LINK to a thread where Caethyril explains how to get sprite coordinates (it's for MV but might work(?) and also, VisuStella might have that same shortcut as Yanfly). For the 'battler' you use your filtered array indexes to get the battlers.
@Hotdawg A while ago I started thinking that I might as well make an example for you (double post so they get notification). The event is in the spoilers.

Keep in mind that:
-this needs VisuStella for the battler() shortcut
-this uses all alive opponents (you need to at least get rid of the one being thrown, with filter for example)
-add a check that when only 1 valid target it doesn't go to the select loop
-the extra loop button press checks are there just to make a smooth scroll

Spoiler
◆Control Variables:#0041 scroll variable = 0
◆Control Variables:#0042 troop alive members = $gameTroop.aliveMembers()
◆Control Variables:#0043 sprite X = $gameVariables.value(42)[0].battler()._homeX
◆Control Variables:#0044 sprite Y = $gameVariables.value(42)[0].battler()._homeY
◆Control Variables:#0045 target index = 0
◆Show Picture:#1, Goldcoin, Center ({sprite X},{sprite Y}), (100%,100%), 255, Normal
◆Loop
◆If:Button [Right] is being pressed
◆Control Variables:#0041 scroll variable += 1
◆If:Script:$gameVariables.value(41) > $gameVariables.value(42).length - 1
◆Control Variables:#0041 scroll variable = 0
◆
:End
◆If:Script:$gameVariables.value(41) < 0
◆Control Variables:#0041 scroll variable = $gameVariables.value(42).length - 1
◆
:End
◆Control Variables:#0043 sprite X = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeX
◆Control Variables:#0044 sprite Y = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeY
◆Show Picture:#1, Goldcoin, Center ({sprite X},{sprite Y}), (100%,100%), 255, Normal
◆Loop
◆If:Button [Right] is being pressed
◆Wait:1 frame
◆
:Else
◆Break Loop
◆
:End
◆
:Repeat Above
◆
:End
◆If:Button [Left] is being pressed
◆Control Variables:#0041 scroll variable -= 1
◆If:Script:$gameVariables.value(41) > $gameVariables.value(42).length - 1
◆Control Variables:#0041 scroll variable = 0
◆
:End
◆If:Script:$gameVariables.value(41) < 0
◆Control Variables:#0041 scroll variable = $gameVariables.value(42).length - 1
◆
:End
◆Control Variables:#0043 sprite X = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeX
◆Control Variables:#0044 sprite Y = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeY
◆Show Picture:#1, Goldcoin, Center ({sprite X},{sprite Y}), (100%,100%), 255, Normal
◆Loop
◆If:Button [Left] is being pressed
◆Wait:1 frame
◆
:Else
◆Break Loop
◆
:End
◆
:Repeat Above
◆
:End
◆Wait:1 frame
◆If:Button [OK] is being pressed
◆Control Variables:#0045 target index = $gameVariables.value(42)[$gameVariables.value(41)].index()+1
◆Text:None, None, Window, Bottom
: :You will target enemy index \V[45]
◆Wait:30 frames
◆
:End
◆
:Repeat Above
@Hotdawg A while ago I started thinking that I might as well make an example for you (double post so they get notification). The event is in the spoilers.

Keep in mind that:
-this needs VisuStella for the battler() shortcut
-this uses all alive opponents (you need to at least get rid of the one being thrown, with filter for example)
-add a check that when only 1 valid target it doesn't go to the select loop
-the extra loop button press checks are there just to make a smooth scroll

Spoiler
◆Control Variables:#0041 scroll variable = 0
◆Control Variables:#0042 troop alive members = $gameTroop.aliveMembers()
◆Control Variables:#0043 sprite X = $gameVariables.value(42)[0].battler()._homeX
◆Control Variables:#0044 sprite Y = $gameVariables.value(42)[0].battler()._homeY
◆Control Variables:#0045 target index = 0
◆Show Picture:#1, Goldcoin, Center ({sprite X},{sprite Y}), (100%,100%), 255, Normal
◆Loop
◆If:Button [Right] is being pressed
◆Control Variables:#0041 scroll variable += 1
◆If:Script:$gameVariables.value(41) > $gameVariables.value(42).length - 1
◆Control Variables:#0041 scroll variable = 0
◆
:End
◆If:Script:$gameVariables.value(41) < 0
◆Control Variables:#0041 scroll variable = $gameVariables.value(42).length - 1
◆
:End
◆Control Variables:#0043 sprite X = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeX
◆Control Variables:#0044 sprite Y = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeY
◆Show Picture:#1, Goldcoin, Center ({sprite X},{sprite Y}), (100%,100%), 255, Normal
◆Loop
◆If:Button [Right] is being pressed
◆Wait:1 frame
◆
:Else
◆Break Loop
◆
:End
◆
:Repeat Above
◆
:End
◆If:Button [Left] is being pressed
◆Control Variables:#0041 scroll variable -= 1
◆If:Script:$gameVariables.value(41) > $gameVariables.value(42).length - 1
◆Control Variables:#0041 scroll variable = 0
◆
:End
◆If:Script:$gameVariables.value(41) < 0
◆Control Variables:#0041 scroll variable = $gameVariables.value(42).length - 1
◆
:End
◆Control Variables:#0043 sprite X = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeX
◆Control Variables:#0044 sprite Y = $gameVariables.value(42)[$gameVariables.value(41)].battler()._homeY
◆Show Picture:#1, Goldcoin, Center ({sprite X},{sprite Y}), (100%,100%), 255, Normal
◆Loop
◆If:Button [Left] is being pressed
◆Wait:1 frame
◆
:Else
◆Break Loop
◆
:End
◆
:Repeat Above
◆
:End
◆Wait:1 frame
◆If:Button [OK] is being pressed
◆Control Variables:#0045 target index = $gameVariables.value(42)[$gameVariables.value(41)].index()+1
◆Text:None, None, Window, Bottom
: :You will target enemy index \V[45]
◆Wait:30 frames
◆
:End
◆
:Repeat Above
This works perfectly! Wow! Thank you so much! I'll be sure to add you to my special thanks and send a copy of the game when it's done as thanks ❤️
Cool! Happy game making.

Original thread: https://forums.rpgmakerweb.com/threads/trigger-target-selection-for-a-skill-immediately-after-using-another-skill.175125/