Hello!
I am trying to move an event (ID 18 in this case) via script call, and I'm trying to move it exactly three times. My code looks like this:
var i = 3;
while (i > 0)
{
$gameMap.event(18).moveRandom();
i--;
}
The event jumps around weirdly instead of moving properly when I do this.
Example:

Is it because the script is not waiting for the movement to finish? How do I get it to wait?
If I use a for loop instead, the event only moves once instead of three times.
I am trying to move an event (ID 18 in this case) via script call, and I'm trying to move it exactly three times. My code looks like this:
var i = 3;
while (i > 0)
{
$gameMap.event(18).moveRandom();
i--;
}
The event jumps around weirdly instead of moving properly when I do this.
Example:

Is it because the script is not waiting for the movement to finish? How do I get it to wait?
If I use a for loop instead, the event only moves once instead of three times.