Multiple Battle Sprite Zooming

In my project, I'm attempting to have the enemy's size increase based on their current level, but I've only gotten it to work for a single enemy at a time.

x=0.485+($game_troop.members[1].level*0.015)
zoom_enemy_sprite(1, x)


The bit of code above actually works as I intended, but when I try adding more troops to the code I get an error.

Script'Game_Interpreter' line 1411: NoMethodError occured.

undefined method 'level' for nil:NilClass

Separate event pages or using the code below, gives me the error above.

x=0.485+($game_troop.members[1].level*0.015)

y=0.485+($game_troop.members[2].level*0.015)

z=0.485+($game_troop.members[3].level*0.015)
zoom_enemy_sprite(1, x)


zoom_enemy_sprite(1, y)

zoom_enemy_sprite(1, z)

Can anyone tell me what I'm doing wrong?

Edit: I'm using Hime's Enemy Levels script by the way.
x=0.485+($game_troop.members[1].level*0.015)This is Ruby, whose array indexing starts at 0, so you're referring to the second enemy here.Note that all (or most) of my script calls normalize things to start at 1 because I think that's how most humans tend to count (1, 2, 3, ... instead of 0, 1, 2, ...)
x=0.485+($game_troop.members[1].level*0.015)This is Ruby, whose array indexing starts at 0, so you're referring to the second enemy here.Note that all (or most) of my script calls normalize things to start at 1 because I think that's how most humans tend to count (1, 2, 3, ... instead of 0, 1, 2, ...)
Thank you! I didn't realize that.

x=0.485+($game_troop.members[0].level*0.015)

y=0.485+($game_troop.members[1].level*0.015)

z=0.485+($game_troop.members[2].level*0.015)

zoom_enemy_sprite(1, x)

zoom_enemy_sprite(2, y)

zoom_enemy_sprite(3, z)

This works as intended.

0_rpg_m1.png

Original thread: https://forums.rpgmakerweb.com/threads/multiple-battle-sprite-zooming.32865/