The error appears when these scenarios happens.
> The common event is run through parallel process / autorun (haven't double checked).
> The common event is run when you transferred map while the event is still active.
> The common event is run through item / skill from item menu.
This line
Get the event that runs the script. If it runs after using an item / skill, it doesn't know which event run the script. Thus it throws an error
---------------------------------------------------------------------
To get into more technical talk. An event has two type of variables x and y, screen_x and screen_y.
The x and y variables determine the position of an event on the map grid. No matter what is your position, if an event is placed on coordinate (2,2) on the map. The variable stays that way
In other hand, screen_x and screen_y are variables that changes overtime and the value is relative to the screen position. The default screen resolution is 544x418, so the screen_x and screen_y values usually varies around that numbers, even minus when they're off screen. You see when you walk through the map, the map and events scrolls in different direction. It because when you walk, they also change the screen_x and screen_y so that they're being redrawn in different location on the screen
---------------------------------------------------------------------
If you use the provided script call directly on event, it should works.
p.s: personally instead of this
It's more easy to use
Where index is
-1 = player
0 = this event
more than 0 = other events
> The common event is run through parallel process / autorun (haven't double checked).
> The common event is run when you transferred map while the event is still active.
> The common event is run through item / skill from item menu.
This line
Code:
ev = $game_map.events[@event_id]
---------------------------------------------------------------------
To get into more technical talk. An event has two type of variables x and y, screen_x and screen_y.
The x and y variables determine the position of an event on the map grid. No matter what is your position, if an event is placed on coordinate (2,2) on the map. The variable stays that way
In other hand, screen_x and screen_y are variables that changes overtime and the value is relative to the screen position. The default screen resolution is 544x418, so the screen_x and screen_y values usually varies around that numbers, even minus when they're off screen. You see when you walk through the map, the map and events scrolls in different direction. It because when you walk, they also change the screen_x and screen_y so that they're being redrawn in different location on the screen
---------------------------------------------------------------------
If you use the provided script call directly on event, it should works.
p.s: personally instead of this
Code:
ev = $game_map.events[@event_id]
Code:
ev = get_character(index)
-1 = player
0 = this event
more than 0 = other events