MZ Events and Movement Core VisuStella - Spawn Event in X,Y plus Terrain.

Hello everyone,

I want to make the Player spawn a event in front of him but only in a defined terrain tag, however, the plugin command in the script/plugin have only the two options separated, so i can only choose between Player Position or Terrain Tag.
I did this:

Spawn in Terrain Tag 1 (Random), then the event has a autorun event to set position to the player coordinates, but this won't do, the event will glitch somehow and stay above another spawned event.
The other solution that i tried is to disable the command to spawn when the player is above a certain terrain tag, but i have to do a lot of checks, like player position and direction, setting switches to turn on and off the ability to spawn a event, so much trouble to not work.

So i was wondering if it's possible to make the event spawn in $gamePlayer.frontX() | $gamePlayer.frontY() but only in a region tag, at the same time.

Thank you for you time.
First, get the X and Y position of the space in front of the player. This should be pretty straightforward with eventing, but if you need help with this step, let me know.

Next, check that space's terrain tag using an if condition.

If the terrain tag is correct, spawn the event in front of the player.
Since i am using a plugin command, i can't change via events, but i think that something like this can work.

Condition if:
$gamePlayer.frontX() && $gamePlayer.frontY() == RegionID(1)
In another words, adjacent tile is within region 1
But i don't know what to do. Thats why i wish i could do this all in plugin command.
We need to get the space in front of the player to get the region first. Try this for the if statement script:

$gameMap.regionId($gamePlayer.frontX(), $gamePlayer.frontY()) == 1;

That should check the space in front of the player for the region. If that part is true, play the spawn event.
It works perfectly! Thank you very much.
I also used this with Terrain Tags.

$gameMap.terrainTag($gamePlayer.frontX(), $gamePlayer.frontY()) == 1;
It really works well, thanks again.

All my doubts were resolved!
Best regards!

BWT, sorry for the late reply, i was sleeping xD

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/events-and-movement-core-visustella-spawn-event-in-x-y-plus-terrain.141566/