MZ [Solved] Use script to call animation: "requestAnimation" inside battle

Hey there, sorry for such an easy question, but I have tried to find an answer for the last 5 hours and now I give up.
Basically, while inside the battle I am calling this script:

$gameTemp.requestAnimation($gameParty.members[0] , 48);

It should play animation 48 on party member 0... but I get an error:
"targets is not iterable"

can anyone help?

Solved:

$gameTemp.requestAnimation([$gameParty.members()[0]], 48);
Perhaps it should be $gameParty.battleMembers
nope, i still get the same error.
Two problems:
  • Missing brackets: members references the function object; members() evaluates the function and returns an array of members.

  • requestAnimation expects an iterable object, typically an array, but you're trying to pass in a single battler (party leader).
Try this instead:
JavaScript:
$gameTemp.requestAnimation([$gameParty.members()[0]], 48);
Two problems:
  • Missing brackets: members references the function object; members() evaluates the function and returns an array of members.

  • requestAnimation expects an iterable object, typically an array, but you're trying to pass in a single battler (party leader).
Try this instead:
JavaScript:
$gameTemp.requestAnimation([$gameParty.members()[0]], 48);

Tested and works! Thank you!! (solved)

Original thread: https://forums.rpgmakerweb.com/threads/solved-use-script-to-call-animation-requestanimation-inside-battle.139006/