Script call for show animation (wait) -- (it's the "wait" part I don't get)

Hello. I want the current event to trigger animation #5 in another event (whose ID # is set as the value of Variable #25), so I have:

Code:
$gameMap.event($gameVariables.value(25)).requestAnimation(5);

But how do I make it wait? As in finish playing the animation before executing the next line. In the "official" script call list I see that there's:

Code:
this.setWaitMode('animation');

But that doesn't do anything. I assume I'm supposed to replace 'animation' with something? I've tried everything I can think of, but nothing seems to have any effect. Could someone please straighten me out on this? Thanks!
hmm, did you put both lines in the same script call box?
Can you show us the event and the script call itself as it is instead of just pieces like this?
did you put both lines in the same script call box?

Well, I've tried it a bunch of different ways, including:

Code:
$gameMap.event($gameVariables.value(25)).requestAnimation(5); this.setWaitMode('animation');

if that's what you're asking. To keep it simple, on a fresh project with no plugins I tried:

Code:
$gameMap.event(2).requestAnimation(5); this.setWaitMode('animation');

and I get the error message: Cannot read property 'isAnimationPlaying' of null.", although I don't get that error message in my current project.
sorry if this don't answer anything
but if you call in event
why won't you use the editor default
it can trigger this with other event too
I may be wrong, but... is this a common event or something like that?
the problem is most likely that the interpreter you are using is not the same as the game map's, where the animation is running.

instead of "this.setWaitMode" try "$gameMap._interpreter.setWaitMode"
@pasunna in the editor I have to specify exactly which event to show the animation on, but I don't know which event it's going to be, thus the $gameMap.event($gameVariables.value(25)).requestAnimation(5);
@YoraeRasante
It's not in a common event. I tried $gameMap._interpreter.setWaitMode, but it didn't make any difference.
edit out
for less confusion for other
ah, ok, I think I found the problem.
the error you gave earlier is because there were no events set on the interpreter's _character. And if there are no errors then there is one there, but... it is not the one the animation is playing on.
so, try adding the line "this._character = $gameMap.event($gameVariables.value(25))" before the wait... maybe even before the animation, so you can just use it on the requestAnimation too.
edit out
for less confusion for other
Thanks y'all for trying to help me with this, I've tried all suggestions, but so far nothing works. I mean I could always just use something like:

Code:
$gameMap.event($gameVariables.value(25)).requestAnimation(5);
$gameMap._interpreter.wait(30);

But then I'd need to know exactly how long the animation was, but that would be tedious and could get messy. Besides, I feel like there has to be a way to do this with scripting.
@JDevain did you try my last post too?

I am not sure if
Code:
$gameMap._interpreter._character = $gameMap.event($gameVariables.value(25));
$gameMap._interpreter._character.requestAnimation(5);
$gameMap._interpreter.setWaitMode('animation');
or
Code:
this._character = $gameMap.event($gameVariables.value(25));
this._character.requestAnimation(5);
this.setWaitMode('animation');
but one or the two should have worked...
edit out
for less confusion for other
@pasunna actually there are only three relevant things there. The things my script calls check.
the interpreter's _character is set to the animation's target.
the target has the animation played on.
the interpreter is set to wait until the animation is done.
that wait is done by checking if the interpreter's _character still has an animation playing on it.
so yeah, the reason it is not waiting is very likely because the _character is not being changed to the animation's target, so as far as the wait is concerned the event checked is not playing an animation, so it can continue.
@YoraeRasante

Yes! The second one worked. I wasn't implementing it right when I tried it before. Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/script-call-for-show-animation-wait-its-the-wait-part-i-dont-get.121428/