Help with writing Conditional Branches

During a Troop Event I'm trying to display a specific picture based on the individual enemy Actor 1 targets in battle.

Conditional Branch_Forum Help.png


The comment area describes the kind of conditional branch I'm trying to make. Is this possible to do?
yes, but not easy - you'll have to use a few workarounds, and probably plugins to even get the data you need.

First, is this dependent on a specific skill used by actor 1 or should it happen with every skill by actor 1. And can the skill in question used by other actors?

because by default you can't determine last target in MV, you would either have to use a plugin to get that ability or mark the target with a state.
During a Troop Event I'm trying to display a specific picture based on the individual enemy Actor 1 targets in battle.

View attachment 223478

The comment area describes the kind of conditional branch I'm trying to make. Is this possible to do?
Sort of, but there's no way for that event to fire off during execution of the skill that was used to target it; it would run at the beginning of the following turn.

@Andar that's not quite correct: you can reference the actor's _lastTargetIndex property to get the index of their most recent target.
yes, but not easy - you'll have to use a few workarounds, and probably plugins to even get the data you need.

First, is this dependent on a specific skill used by actor 1 or should it happen with every skill by actor 1. And can the skill in question used by other actors?

because by default you can't determine last target in MV, you would either have to use a plugin to get that ability or mark the target with a state.

Currently it's not dependent on any specific skill and only interacts with Actor 1. So all I would need to make it work is to know which Enemy# Actor 1 targeted. That way I can display the correct picture
that describes the target Actor 1 selected.

Could you point me in the direction of an addon that would give me the ability to determine the last target? I wouldn't mind taking a look at them. I'll also look into using states for this. I hadn't thought about trying that to determine who the actor had targeted. But it sounds do-able and something I can explore, so thanks for the advice.


Sort of, but there's no way for that event to fire off during execution of the skill that was used to target it; it would run at the beginning of the following turn.

@Andar that's not quite correct: you can reference the actor's _lastTargetIndex property to get the index of their most recent target.

Would there be way to check the last target before the execution of the skill? Because that's currently what I'm aiming for. I ask the player to input a number right after selecting the target and would like to show the correct picture at that time.

Referencing the actor's lastTargetIndex sounds like it would work. Could you give me an example of how to write that as a conditional branch into a script?

Original thread: https://forums.rpgmakerweb.com/threads/help-with-writing-conditional-branches.146847/