MV I need help with TP conditions

Hi,
I wanted to ask how I can check the TP value of an enemy in battle.
My idea was to use this line of code:
if ($gameTroop.members()[1].tp > 49) {$gameVariables.setValue(62, 1);}

But it didn't work! pls help

thanks ^^


Edit: solved it myself
Probably because you aim for wrong troop member, keep in mind, that index 0 refers to first troop in group, so if you have 3 enemies in group, first one will have index 0 and the last one 2

Try $gameTroop.members()[0].tp

See in this pic? https://prnt.sc/15x47en
There is only one orc and by index 0 I can obtain TP, but with index 1 there is an error because he's alone in battle
Probably because you aim for wrong troop member, keep in mind, that index 0 refers to first troop in group, so if you have 3 enemies in group, first one will have index 0 and the last one 2

Try $gameTroop.members()[0].tp

See in this pic? https://prnt.sc/15x47en
There is only one orc and by index 0 I can obtain TP, but with index 1 there is an error because he's alone in battle
thank you for your replay ^^

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-with-tp-conditions.137594/