DrFuji

Heiki Hecchara‌‌

Age 26
Male
Aussie
Seen 43 Minutes Ago
Posted 1 Day Ago
1,605 posts
10 Years
If you're using FR, you can do this pretty easily with special 0xFF. It takes the value of variable 0x8004, selects the party position indicated by it and then returns the species number of that Pokemon. Here's an example of it in action:

...
setvar 0x8004 0x0 // 0x0 makes special 0xFF check the first party slot
special2 0x8000 0xFF // Stores the species number in variable 0x8000
compare 0x8000 0x19 // Checks if Pikachu was the returned result
if 0x1 goto @PikachuIsFirst // Branches the script if true
...
Hopefully that's what you're after.