Dropping objects to block path

I'm currently working on a project where a monster is chasing the main character through a labirinth and the player can get an item which will transfer him to another labirinth filled with other monsters

I ask your help to help me making a script, if the player pushes a button then automatically drops an object behind the character to block the monster's path.

So my goal would be similar to this, but with extras:
  • The Player should NOT select the item from his inventory, its pre-determined (for example a barrel).
  • He can place multiple barrels at the same time (for example 5 of them), and NOT just one.
  • If the Player pushes a button (for example the 'Space' key), then he places the item behind the character and NOT on himself.
Thanks in advance!

I've moved this thread to RGSSx Script Requests. Thank you.

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