Dropping objects to block path

I'm currently working on a project where a monster is chasing the main character through a labirinth.

I would like to make script (or an event mechanism), if the player pushes a button then automatically drops an object - or an item from his inventory - just front of himself to block the monster's path.

I searched all over the internet, but I didn't found anything, which would be useful to my case.
Can somebody help me, please?
Would this be in specific spots or just whenever the player presses a key? Because if it's the former, it'd be a simple case of having blank events where the item is to be dropped, then activating a switch on button input processing which makes the graphic appear on a new event page of the blank event.
I don't know about a script that does this, but you can create an invisible event the player steps on that creates that kind of thing. ... maybe like a landslide or something from the vibrations of the monster creates?
If you're ok with only 1 item blocking the monster's path, it would be a simple matter of creating an invisible event, then moving the event (set event location) behind the player (use "get location info" to save the X and Y coordinates in a variable, and modify X or Y depending on the direction the player is facing) and changing its appearance.

You could also have multiple events, so the player can drop multiple blocks. You'd use a variable to cycle through the blocks, so whenever you've dropped all the blocks available, the next block would be the first one dropped. You'd need a "drop block index" variable, which you'd increment by 1 every time the player drops a block, then use the "Mod n" operator where "n" is the number of blocks available to drop. The index would go from 0 to n-1, and you'd need to handle the correct block for each index. It's a lot of work, but it gets the job done.


Otherwise, you'd need a script that can generate events on the fly.
Unfortunately, I'm not very familiar with RGSS, so I can't provide you with one.
If you're ok with only 1 item blocking the monster's path, it would be a simple matter of creating an invisible event, then moving the event (set event location) behind the player (use "get location info" to save the X and Y coordinates in a variable, and modify X or Y depending on the direction the player is facing) and changing its appearance.

You could also have multiple events, so the player can drop multiple blocks. You'd use a variable to cycle through the blocks, so whenever you've dropped all the blocks available, the next block would be the first one dropped. You'd need a "drop block index" variable, which you'd increment by 1 every time the player drops a block, then use the "Mod n" operator where "n" is the number of blocks available to drop. The index would go from 0 to n-1, and you'd need to handle the correct block for each index. It's a lot of work, but it gets the job done.


Otherwise, you'd need a script that can generate events on the fly.
Unfortunately, I'm not very familiar with RGSS, so I can't provide you with one.

I managed to get player's X and Y coordinates, but where can I modify them?
The block spawns on the player and not front or behind of him.
Is there a way to make the drop with just 'one button press' and not via selecting it in through the inventory?
For better understanding: I followed this tutorial, but I want a different kind of mechanism, like I described earlier.
I was writing my reply, but the site refreshed and now my reply is gone...
​
I managed to get player's X and Y coordinates, but where can I modify them?
The block spawns on the player and not front or behind of him.
To edit the X and Y coordinates, you need "Control Variables...". You can then "Add" or "Sub" (subtract) a "Constant" (1) from the variable.
You can find out which way your character is facing using "Conditional Branch..." inside which there's "Character (Player) is facing (Up/Down/Right/Left)".

Is there a way to make the drop with just 'one button press' and not via selecting it in through the inventory?
Yes, but you'll need RGSS for that.
The people in the RGSS3 Scripts (RMVX Ace) forum are likely better suited to help you than I am.

Essentially you want to know:
  1. How to implement specific behavior on button press (like how pressing Shift makes the player dash).
  2. How to customize the Item menu so the player can choose a default object to drop when pressing the button (as well as how to save that default item, so when the player reloads the game, they don't have to change the default object again).
  3. How to call the event from within RGSS.
  4. (Extra) If you need this feature in more places than the labyrinth (or you have multiple labyrinths), you might want to implement the whole even thing as RGSS script. So you'll also have to learn how to create events from within RGSS (in which case you can ignore point 3).

Original thread: https://forums.rpgmakerweb.com/threads/dropping-objects-to-block-path.91917/