YanFly Event Spawner help

I'm trying to make a feature in my game where the player can use a 'furniture' item in their inventory and it will drop the furniture 1 tile in front of them on the map, so I'm trying to use YanFly's Event Spawner for this.

For now, I'm doin this:
check terrain tag (i made all ground tags 1 and wall tags 2)
assign player x to var 65
assign player y to var 66

then run a script call:
Code:
Yanfly.SpawnEventAt(1, 1, $gameVariables.value(65), $gameVariables.value(66), true)

It should spawn event 1 from map 1 at variables 65 (for x) and 66 (for y) ...but nothing happens. Help?

Actually while I'm asking, is there a way to check if the player can make 1 step forward and return a true or false? Or 1 and 0, just something I can use a conditional check for? Because I think that would be easier to use for 'ground furniture' spawning than a terrain tag.

EDIT: reading more into this plugin's help file, how does

Code:
Yanfly.DespawnEvent(EventID)

even work? If I spawn Event 1 four times are the event ID's going to be 1001-1004 or all 1001? Figuring out how to make this plugin spawn something and then 'grab' the spawned event's new id is a headache lol
As this is asking about a plugin, it should go in Plugin Support and link to the plugin so we can all see the documentation 😉

YanFly's Event Spawner
Just as an aside, I'm not sure where you got this - Yanfly is one word, no camelCase 😉

Code:
Yanfly.SpawnEventAt(1, 1, $gameVariables.value(65), $gameVariables.value(66), true)
It should spawn event 1 from map 1 at variables 65 (for x) and 66 (for y) ...but nothing happens. Help?
Have you tried it with different coordinates? The instructions for that script call say the coordinates must not have an event there. And while the game player is not an event, per se, they come from the same data type and that may well be why it's not working.

Try it with different coordinates to see whether it's because of the player or some other reason.

Also, any time code isn't working, you should press F8 and go to the Console tab, see if there are any errors.

Actually while I'm asking, is there a way to check if the player can make 1 step forward and return a true or false?
Code:
$gamePlayer.canPass($gamePlayer.x, $gamePlayer.y, $gamePlayer.direction())

If I spawn Event 1 four times are the event ID's going to be 1001-1004 or all 1001?
All events on your map must have unique IDs. That's the point of IDs.

Figuring out how to make this plugin spawn something and then 'grab' the spawned event's new id is a headache lol
Why? There's an entire section of the instructions labeled "Obtaining Spawned Event Data". You would just call the function that you call above, then immediately use $gameMap.LastSpawnedEventID()
First of all, thanks for the spelling and help with the player direction - IT WORKS yaay 😀
And I figured out the event not spawning: I gave the furniture 'item' via a quick n' dirty treasure chest that deletes itself after opening - turns out the spot it used to be is not able to be spawned in. I can spawn everywhere else!

Why? There's an entire section of the instructions labeled "Obtaining Spawned Event Data". You would just call the function that you call above, then immediately use $gameMap.LastSpawnedEventID()
So $gameMap.LastSpawnedEventID() would 'tag' that event as the last spawned? Or do I put a variable in the parenthesis that I want to store the event's ID? Sorry but this whole plugin sounds super complex

EDIT: Apparently after some testing, just having the spawned furniture do an 'erase event' when I 'pick it back up adding the spawner item into inventory' makes it so it doesn't respawn. Weird, but works for now lol
So $gameMap.LastSpawnedEventID() would 'tag' that event as the last spawned? Or do I put a variable in the parenthesis that I want to store the event's ID?
Its description in the instructions:

1730255617539.png


So you'd put that into the Script field of Control Variables and it would make that variable have the ID of the last event you spawned.
Ohhhhh the script field, heh. Forgot about that little thing. Thanks man!
Actually, still having trouble :/

I have a the player start in a room full of a bunch of junk 'furniture' that is just cleaned up by activating - just simply deleting the objects as they're not able to be placed for the game. They literally piles of trash. It works with the Erase Event command but now I'm realizing I can't place new furniture on the same spot as the previously placed 'trash' events.

Soooo...looks like I need to use these commands to figure out the Event ID of an event I am activating, then remove it:
Code:
$gameMap.event(eventId)
Yanfly.DespawnEventID(eventId)

Only issue is I don't know how to get the eventID still, is there like a 'this.event' snippet of code I could use to determine the ID of an event I'm activating?

Basically I'm just trying to let the player 'clean the house' before purchasing their own furniture. I've tested leaving the map and returning, but the tiles of previous spawned events wont let a new event spawn when I just use the Erase Event command.
I don't see what the $gameMap method would have to do with it, but you can get an event's ID from inside a Script command with this.eventId()

So you would just do Yanfly.DespawnEventID(this.eventId())

The thing you might not be understanding is that Erase Event does not permanently erase an event. It will reappear the next time you load that map. So while it's not visible on the map anymore, it won't free up an ID and it doesn't mean there's no event on that tile.
I don't see what the $gameMap method would have to do with it, but you can get an event's ID from inside a Script command with this.eventId()

So you would just do Yanfly.DespawnEventID(this.eventId())
SUCCESSSS thanks a bunch!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-event-spawner-help.172910/