How to store troop ID into a variable?

Hey guys.


Does anyone know how I can set a variable to the troop ID of whatever troop the party's facing?


I'm making an in-battle only ability where, when used, it calls a common event that A, stores the troop ID of whatever troop the party's facing into a variable, and B, displays a message depending on what number the variable is equal to. I was trying to use a script call like this:


$gameVariables.setValue(18, $gameTroop)


Unfortunately I just can't figure out which variable, command or whatever would get me the troop ID of the current battle.


Thanks for the help!
Should be $gameTroop._troopId
Thank you so much! I fiddled around with it for hours, and at one point I actually had $gameTroop.troopId - all I needed was a stupid underscore! Haha. 

Original thread: https://forums.rpgmakerweb.com/threads/how-to-store-troop-id-into-a-variable.68847/