- Joined
- Jul 18, 2014
- Messages
- 222
- Reaction score
- 13
- First Language
- English
- Primarily Uses
- RMMV
How can I change an action's target to the opposite side?
I have a state that can change the current action's target to a different one (It would randomly select a correct index. So if the player selected the enemy with index 1, it can randomly target the enemy with index 3).
My challenge is trying to include allies to that random targeting. I know how to get their indexes, but it's the same values (0 to X) as the enemy's values. So even if I get 2, it would always refer to the enemy's battler with index 2 and not the ally's battler with index 2.
Can the .isForOpponent() property be modified to change target to your ally unit? Not sure how to tell it to NOT target the opponent.
EDIT:
Part of my code includes:
At the moment I'm just changing the skill when it has to target one of the unit's allies. This skill's scope is set to "1 Ally". However, it still targets the opponent AND it crashes with an "Undefined is not a function". The confusion skill being called is practically empty. No states or common events involved. No action sequences either.
I have a state that can change the current action's target to a different one (It would randomly select a correct index. So if the player selected the enemy with index 1, it can randomly target the enemy with index 3).
My challenge is trying to include allies to that random targeting. I know how to get their indexes, but it's the same values (0 to X) as the enemy's values. So even if I get 2, it would always refer to the enemy's battler with index 2 and not the ally's battler with index 2.
Can the .isForOpponent() property be modified to change target to your ally unit? Not sure how to tell it to NOT target the opponent.
EDIT:
Part of my code includes:
Code:
// Randomly attack (via Confusion Skill) one of the valid ally options
if (poolA.length > 0) {
var redirect = poolA[Math.floor(Math.random()* poolA.length)]
action.setTarget(redirect);
action.setSkill(confuseSkill);
console.log("[Debug] Attack 1A: "+redirect);
}
Last edited:
