Cannot use Variable as Event ID

Did i do something wrong?
Code:
$game_map.events[$game_variables[48]].animation_id = 115

Error :
u39E12R.jpg

Ps. Variable no.48 = 10 (event no.10)
Please post a screenshot of the command in the event - I strongly suspect that you have a space there where it doesn't belong, and automatically corrected that mistake when retyping the command here.
Try to remove "s" on the event.
Just give a try 🙂

$game_map.event([$game_variables[48]).animation_id = 115
No, it's $game_map.events.

Is that EXACTLY what you have in the script call? Or have you split it onto two lines (or has it done it automatically)? If you've split it onto two lines, it will be because of where the line break occurs. Make the line break after $game_variables[ and before 48.
No, it's $game_map.events.

Is that EXACTLY what you have in the script call? Or have you split it onto two lines (or has it done it automatically)? If you've split it onto two lines, it will be because of where the line break occurs. Make the line break after $game_variables[ and before 48.
Sry for late reply. Yes! it's automatically split to another line. So how to type all of it in one line?
The script box for events won't always allow you to put your entire script on one line. Do what Shaz said and make a line break after $game_variables[ but before the 48.
I figured it out! Thank you by the way!
Code:
a = $game_variables[48]
$game_map.events[a].animation_id = 113
yeah, that'd work too. But the way we already told you - splitting it, but at a specific place rather than an auto-line break - would have been fine.

Original thread: https://forums.rpgmakerweb.com/threads/cannot-use-variable-as-event-id.74910/