I'm honestly not sure if this goes here. I am using the Battle Core to make this, though I feel like the issue stems more with the general MZ script calls.
So here's the issue. I'm attempting to make "skills" that activate during battle start. Originally, I wanted to use the Auto Skill Triggers, but the forced animations slow the game pace down, and because the skills are forced to be active outside of their trigger to actually work, I decided to just try coding again.
The skill in question is just adding a state that grants Life Steal to all allies at the start of battle. I based it off another effect I saw.
I essentially just took the addState line and put actor instead of enemy.
And it worked! Everyone now has Life Steal... including the enemies. I guess my question is, for starters, why enemies are considered actors here and not anywhere else, and whether I can actually make a distinction for only the party members to get the state.
Edit: Turns out I was wrong. I found the issue, I had in some area set my state as a Global Passive. So turns out the skill only gets applied to the one activating it, but not any other allies.
So here's the issue. I'm attempting to make "skills" that activate during battle start. Originally, I wanted to use the Auto Skill Triggers, but the forced animations slow the game pace down, and because the skills are forced to be active outside of their trigger to actually work, I decided to just try coding again.
The skill in question is just adding a state that grants Life Steal to all allies at the start of battle. I based it off another effect I saw.
JavaScript:
<JS Pre-End Turn>
//Check for Damage Aura State
if (user.isStateAffected(35))
{
//Add immortal State to all enemies for proper collapse effect
$gameTroop.members().forEach(enemy => {enemy.addState(3)});
//Damage Mechanic
$gameTroop.members().forEach(enemy => {enemy.gainHp(-100)});
//Check For enemies that have been killed by the Damage Aura and collapse them
for (var i=0; i<$gameTroop.aliveMembers().length; i++)
{
if ($gameTroop.aliveMembers()[i].hp<=0) {$gameTroop.aliveMembers()[i].performCollapse();}
}
//Remove immortal state from all enemies
$gameTroop.members().forEach(enemy => {enemy.removeState(3)});
}
</JS Pre-End Turn>
I essentially just took the addState line and put actor instead of enemy.
JavaScript:
<JS Post-Start Battle>
$gameParty.battleMembers().forEach(actor => {actor.addState(45)});
</JS Post-Start Battle>
And it worked! Everyone now has Life Steal... including the enemies. I guess my question is, for starters, why enemies are considered actors here and not anywhere else, and whether I can actually make a distinction for only the party members to get the state.
Edit: Turns out I was wrong. I found the issue, I had in some area set my state as a Global Passive. So turns out the skill only gets applied to the one activating it, but not any other allies.