[RMXP] How to check which troop is being battled

Hello!

I am trying to implement a stealing mechanic where, if a skill is used, a common event checks which troop (or enemy, if possible?) the player is battling and then adds a specific item.
For this I would need a conditional branch and I have tried several variations of (34 being the troop ID):

$game_troop.troop_id = 34

But it always receive an error message. I don't have much of a clue of how RGSS works, so help would be much appreciated! 🙂

I've moved this thread to RGSSX Support. Thank you.

'Scripts' is where people who have written a script they want to share with the community can post them. "How do I...?" questions belong in the Support forum for the engine you are using.
Moved to: RGSS Script Support

EDIT
Ninja'd
I don't have XP, so no idea how the relevant variables are named there, but you seem to be mixing up 2 things here (code-wise).

= means that you want to set that variable.
== means that you want to compare that variable.

So, you need to use == here, since you want to compare it, not set it.
This tutorial is in MV, but it should still help.



If you want the skill to be based on the specific enemy that the skill targets, this thread provides a basic script to do so.

https://forums.rpgmakerweb.com/inde...id-memorization-and-recall.86811/#post-793585
Thanks! 😀
I decided to simplify my plans a little bit so the video tutorial worls fine for me!

Original thread: https://forums.rpgmakerweb.com/threads/rmxp-how-to-check-which-troop-is-being-battled.88461/