Passive State Conditional Buff

Hello, I'm trying to create a conditional passive state that allows a character to gain bonus attack damage when all enemies are under a status condition, such as poisoned. I am using YEP.BuffStatesCore, AutoPassiveStates, and Core Engine and Battle Core Plugins to achieve the affect.

Currently, I feel using Custom Turn start to loop through alive enemies for the check would be easiest, unless there is a simpler way.

Spoiler: Current Code Example
<Custom Turn Start Effect>
for(var i = 0; i < $Game_Troop.alive_Members.length();i++){
if ($Game_Troop._enemies.isStateAffected(4)){
$Game_Party._actors[1].AddBuff(3,3);

}
}
</Custom Turn Start Effect>

However, Game_Troop seems to be undefined when using the debug tool.
I've tried game_Troop as well.
First bit of advice - always post code using the CODE tags (the </> icon in the bar). That will preserve indentations and not let the forum turn your brackets into BBCode. Notice how you typing [i] doesn't show up, and it turned half of your post into italics?

However, Game_Troop seems to be undefined when using the debug tool.
I've tried game_Troop as well.
Neither of those is correct - Game_Troop is the Object type, but the variable in the game is $gameTroop. You might want to check out the pinned thread that has MV's script call list.

The same is true for this line:
Code:
   $Game_Party._actors[1].AddBuff(3,3);
That syntax is all wrong. It's $gameParty and addBuff.

Also, this part won't make your code fail, but it's not good practice to go for private member variables when you have accessor methods. It would be better to do $gameParty.members()[1].addBuff(3, 3);

Even that is potentially not awesome because it presumes the specific actor you want is the second one in the party - by default, MV lets the player change the party formation, so unless you've locked that down, you could be referring to the wrong actor.

A better way would be $gameActors.actor(ID).addBuff(3, 3); where ID is the actor ID (with no leading zeros).
Great Success!

Apologies, first time poster and new to javascript, I was referencing a secondary website that had vastly different call syntax, or just incorrect it seems. The pinned thread is definitely going to be saved and referenced ALOT down the line.

Thanks for the stern restructuring and direction, I'll do my best to apply that in the future!
If you saw anything like this on another site, it's straight up wrong.

If you were looking at this MV documentation:

you would see things like Game_Party and Game_Actor because, as I said, those are the names of the Object types and that Web site is providing documentation for the data types. It relies on you knowing how to read JavaScript well enough to know the difference between data types and the variables of those types, and what the variables defined in the code are.

But you wouldn't see anywhere in there $Game_Party, nor AddBuff.

Hopefully your state is working now - good luck.
Yep, state is working perfectly as intended now. Thank you.
And understood. o7

Original thread: https://forums.rpgmakerweb.com/threads/passive-state-conditional-buff.150009/