I'm fairly new to RPGMaker VX Ace, and I'm trying to set up a skill that does a follow-up skill dependent on the state that the specific target enemy is in.
I've tried a lot of different solutions, all of them close but not exactly what I need.
Right now I seem to be the closest I've ever been, but I need help with code in a Conditional Branch. I currently have "Actor uses skill, which runs a Common Event. That Common Event has a Conditional Branch that is "if last target hit has State X, force action Skill A on last target hit. elsif last target hit has State Y, force action Skill B on last target hit. else last target hit has State Z, force action Skill C on last target hit." etc etc.
My problem: I can get it working for if the actor has a State using "$game_actors[X].states.include?($data_states[Y])" but I need the State Conditional to be based on the target enemy, not the actor using the skill. I see that force action uses the code "action.target_index = last_target_index" for last target, but using that whole string or just "last_target_index" inside the Conditional Branch both result in errors. What is the code for last target hit where I can replace "$game_actors[X]"?
Things I've tried:
Thank you ahead of time for reading and helping!
Let me know if there's any more information I can give to help.
tl;dr : Ruby/RGSS3 code for last target hit?
I've tried a lot of different solutions, all of them close but not exactly what I need.
Right now I seem to be the closest I've ever been, but I need help with code in a Conditional Branch. I currently have "Actor uses skill, which runs a Common Event. That Common Event has a Conditional Branch that is "if last target hit has State X, force action Skill A on last target hit. elsif last target hit has State Y, force action Skill B on last target hit. else last target hit has State Z, force action Skill C on last target hit." etc etc.
My problem: I can get it working for if the actor has a State using "$game_actors[X].states.include?($data_states[Y])" but I need the State Conditional to be based on the target enemy, not the actor using the skill. I see that force action uses the code "action.target_index = last_target_index" for last target, but using that whole string or just "last_target_index" inside the Conditional Branch both result in errors. What is the code for last target hit where I can replace "$game_actors[X]"?
Things I've tried:
- Yanfly's Follow-Up Skills Script : It's very helpful, but limited to a single skill choice. I've even been able to get a follow up skill dependent on the last target's state using the code below, but the script only allows a single line of code for it's eval. If I try to squeeze in a condition branch inside or several eval sections, the code fails. (This code goes in the Skill's Database note box, which is why it's so limited)
Code:
<follow up eval>
opponents_unit.members[current_action.target_index].state?(state_ID)
</follow up eval>
<follow up skill_ID>
- Assigning troops to variables based on their position and flipping switches, but it always results in the follow up skill happening on any enemy as long as a single enemy has the state.
- A Conditional Branch that checks if Enemy 1 has X state, then forcing the action to happen to Enemy 1, but this also happens regardless of who the actor attacked. This could work if the Conditional Branch allowed me to choose "Last Targeted Enemy" instead of choosing an enemy slot.
- I've also thought about any time an actor attacks an enemy, all the enemy states get mirrored onto the actor, which at that point I could make a condition branch and have it be based on the actor's states. Then I'd have to clear out those new states after their action as well. However, I don't know how to do this and it seems like a huge janky work around for an otherwise easy solution.
Thank you ahead of time for reading and helping!
Let me know if there's any more information I can give to help.
tl;dr : Ruby/RGSS3 code for last target hit?