How to use a script call for checking defense.

Hey all,
I want to make traps using events. But when I deal damage I want to have it check the affected member's defense parameter.
I have a bunch of different actors and want to check it by the spot in the party they are instead of by actor ID.
I'm trying to put this script call into a variable.
I've tried some other things but it hasn't worked.
I know how to do via conditional branches. But to save time and trying to figure out scripting a bit more it would be cool if someone could help me out with this.
Get the DEF stat for the party leader (position/index 0):

$gameParty.members()[0].def
Swap the 0 for a 1 to check the first follower, 2 for the second follower, etc.
I think I was adding something extra to it, but either way it works now. Thanks so much!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-a-script-call-for-checking-defense.151968/