Yanfly <Custom Remove Effect>

So I'm trying to make a custom remove effect that
  • Checks Troop Member ID (0 - 7)
  • Transforms Chosen Enemy
Yanfly DID make a transformation preset in Custom Apply/Remove that I can see, but I've built my current system around troop events/variables etc so I don't really want to reinvent the wheel. This is what I got so far but it won't work:

Code:
<Custom Remove Effect>
if (user.gameTroop.members().id === 0) {
$gameTroop.members()[0].transform($gameVariables.value(10));
}
</Custom Remove Effect>

What, if anything, am I doing wrong here? Thanks.
Why user.gameTroop? I thought it was $gameTroop?
Why user.gameTroop? I thought it was $gameTroop?

I just need a method to check which target is affected. I don't wanna remove the state for anyone else affected so I'm under the assumption that I need to use user. instead of simply $gameTroop.
Anything that reads troop/enemy index affected would work e.g. if enemy #1 is affected, I tried using user.EnemyIndex though and that didn't work.
I don't quite follow what you're trying to do. What's the overall plan for this effect?
user is the one affected by the state, there's no gameTroop property there.

Maybe this instead:
Code:
<Custom Remove Effect>
if (user.isEnemy() && user.index() === 0) {
  user.transform($gameVariables.value(10));
}
</Custom Remove Effect>
It says "if user is an enemy and is the troop leader (index 0), then transform them into enemy ID X, where X is the value of game variable 10". Like shockra, though, I'm not sure if that's what you're trying to do? 😅
user is the one affected by the state, there's no gameTroop property there.

Maybe this instead:
Code:
<Custom Remove Effect>
if (user.isEnemy() && user.index() === 0) {
  user.transform($gameVariables.value(10));
}
</Custom Remove Effect>
It says "if user is an enemy and is the troop leader (index 0), then transform them into enemy ID X, where X is the value of game variable 10". Like shockra, though, I'm not sure if that's what you're trying to do? 😅

Thanks! Worked like a charm! Essentially I learned the ins and outs of javascript quite a while I started down the road of RPGMaker, therefore this is just a part of a big workaround, ties into game troops. Originally I had this tied to ifstateisexpired etc, but for some unknown reason this doesn't work anymore. I assume 1.6.2 broke it? Anyway, what's done is done. Hopefully that will be the last of my problems otherwise I'll probably be back soon lol thanks again guys, I was pleasantly surprised by the quick response!
Thanks! Worked like a charm! Essentially I learned the ins and outs of javascript quite a while I started down the road of RPGMaker, therefore this is just a part of a big workaround, ties into game troops. Originally I had this tied to ifstateisexpired etc, but for some unknown reason this doesn't work anymore. I assume 1.6.2 broke it? Anyway, what's done is done. Hopefully that will be the last of my problems otherwise I'll probably be back soon lol thanks again guys, I was pleasantly surprised by the quick response!
I don't think I've encountered a routine named anything like "ifstateisexpired" in RMMV. 😅

Good to hear this worked out, though! Happy RPG Making~ 😂

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-custom-remove-effect.109746/