- Joined
- Dec 6, 2019
- Messages
- 9
- Reaction score
- 4
- First Language
- English
- Primarily Uses
- RMMV
This is my first post on this forum, so my apologies in advance if I've placed this question in the wrong spot, I'm asking a newbie question or anything like that.
I wanted to see if it was possible to decorate a map with objects, similar to placing furniture in Animal Crossing, via Yanfly's Event Spawner plugin.
To spawn events via Yanfly's Event Spawner plugin, the following script call is used:
Yanfly.SpawnEventAt(mapId, eventId, x, y, preserved)
I've seen someone else say you can replace x and y with variables. If that's true, then the variables used could be equal to the player's x and y coordinates on the map.
The only problem with doing that is the event then spawns on top of the player. The player can walk away from the event and then the event will behave like normal but it's jarring to have the event on top of the player in the first place.
I'm very new to Javascript but I wrote what I believe to be the correct way to spawn events in front of the player:
if ($gamePlayer.direction(2)) {
Yanfly.SpawnEventAt(1, 5, $gameVariables.value(1), $gameVariables.setValue(2, $gameVariables.value(2)+1), true)
} else if ($gamePlayer.direction(4)) {
Yanfly.SpawnEventAt(1, 5, $gameVariables.setValue(1, $gameVariables.value(1)-1), $gameVariables.value(2), true)
}
( I only checked if the player is looking down or left at the moment )
I'm posting this here before purchasing the plugin to confirm if this is the code needed to spawn events in front of player. Please let me know if there's a mistake or if it's even possible to do this with Yanfly's Event Spawner plugin.
Thanks a bunch!
I wanted to see if it was possible to decorate a map with objects, similar to placing furniture in Animal Crossing, via Yanfly's Event Spawner plugin.
To spawn events via Yanfly's Event Spawner plugin, the following script call is used:
Yanfly.SpawnEventAt(mapId, eventId, x, y, preserved)
I've seen someone else say you can replace x and y with variables. If that's true, then the variables used could be equal to the player's x and y coordinates on the map.
The only problem with doing that is the event then spawns on top of the player. The player can walk away from the event and then the event will behave like normal but it's jarring to have the event on top of the player in the first place.
I'm very new to Javascript but I wrote what I believe to be the correct way to spawn events in front of the player:
if ($gamePlayer.direction(2)) {
Yanfly.SpawnEventAt(1, 5, $gameVariables.value(1), $gameVariables.setValue(2, $gameVariables.value(2)+1), true)
} else if ($gamePlayer.direction(4)) {
Yanfly.SpawnEventAt(1, 5, $gameVariables.setValue(1, $gameVariables.value(1)-1), $gameVariables.value(2), true)
}
( I only checked if the player is looking down or left at the moment )
I'm posting this here before purchasing the plugin to confirm if this is the code needed to spawn events in front of player. Please let me know if there's a mistake or if it's even possible to do this with Yanfly's Event Spawner plugin.
Thanks a bunch!

