MV Managing events placement (and lack thereof)

Me again with Galv's event spawner 😅

I've made an item placement system using this plugin, but am having a few problems particularly with placement locations. Using an item to spawn an event works just fine on any of the maps "spawnable" tiles. However, when trying to place the event back on the tile you picked it up from, it will simply disappear (the item will be used, but no event spawns). I've tried using the despawn script command instead of deleting the event, as well as updating the overlap setting after the event it picked up, but neither worked. What can I do?

Additionally, when placing an item in a place that is INTENDED to be unspawnable, how do I keep the item from disappearing and perhaps display a warning message? For example, if i try to place my chest in the ocean (unspawnable terrain), instead of the item disappearing and event not spawning, you get a message that says "items can't be placed here!" or you just keep the item and nothing happens? Can't figure this out either.

I understand the first issue is a bit complicated and hard to describe, so let me know if anyone would like a demo.
Thanks a bunch
I would try putting true in the last parameter of the spawn and unspawn script.
The second issue is solved by putting a conditional check to check the region or terrain of the tile in front of the player before placing the item.
I would try putting true in the last parameter of the spawn and unspawn script.
The second issue is solved by putting a conditional check to check the region or terrain of the tile in front of the player before placing the item.
First part worked like a charm, and the second part works up to the point that the item still disappears. Since to run the check the item will be used, I tried adding a script that would give it back right after (script since the item is a variable in a common event) so I assume somethings wrong with it.
Screen Shot 2024-02-24 at 2.21.13 PM.png

tips?
Where is the script to remove the item from your inventory? It should be under the else section. It also looks like you're checking the terrain tag of the tile the player is standing on rather than the tile in front of the player.
Where is the script to remove the item from your inventory? It should be under the else section. It also looks like you're checking the terrain tag of the tile the player is standing on rather than the tile in front of the player.
My bad, I should have showed the other half of the event.
Screen Shot 2024-02-24 at 5.18.27 PM.png
the terrain tag works fine, and this common event is triggered when the item is used, so theres no need to take it out in else. Only problem i'm having is giving the used item (id obtained with the very first script) back to the player, in the third-last line. I'm not very good with java at all, so it makes sense it would be messed up, but I tried many things and it still doesn't return the item. In my latest iteration its returning the error Syntax Error: unexpected token

Edit: Upon this iteration:
$gameParty.gainItem($gameParty.lastItem(1).id,1)
the error ceases, but the item still disappears.
You should only be running the lose item script if the place item script passes the terrain tag check, which is why I said to put it in the else section. Losing the item, then checking the tile, then gaining it back if the check fails is unnecessarily convoluted and probably prone to errors.

I'm also pretty sure terrain tag 0 is the default, so you're effectively saying the item can't be placed on default tiles.
You should only be running the lose item script if the place item script passes the terrain tag check, which is why I said to put it in the else section. Losing the item, then checking the tile, then gaining it back if the check fails is unnecessarily convoluted and probably prone to errors.

I'm also pretty sure terrain tag 0 is the default, so you're effectively saying the item can't be placed on default tiles.
There is no “lose item script” as I’m running this as a common event upon consuming a specific item, it runs in the items effects. Are you suggesting I make the item non-consumable and instead add a “lose item script”?

This still leaves my problem about the same though, if i do that and change gain item to lose item, it still won't work as I don't know the syntax. Trying to use $gameParty.lastItem(1).id as a variable doesn't work, do you know how I could a) assign it one or b) just give one straight to the player??

In this demo map made by Galv, 0 is the tag for the ocean and fences, while 1 is for the grass 🙂

Edit: I figured out the syntax! $gameParty.lastItem(1).id is to get the ID, $gameParty.lastItem() is to get the ITEM. I've used the non-consumable method as well! Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/managing-events-placement-and-lack-thereof.166130/