MZ Placeable tent on the world map

[I'm sorry if this is the wrong spot, if it is, please let me know and I will move it where irt needs to go.]

SO, part of this post is to see if this idea is viable without plugins. I am new, and don't really want to dive into plugins if I don't need to. That is enough preamble, I guess.

What I would like to try, is have a mechanic where the player can use an item that puts down a tent on their current map, that would act as an entrance to a camp where they can recover and maybe craft stuff. I know that I can make an item that a player can use to transport them to another map easily enough [returning is another matter, however that should be doable using variables to store the X/Y of the player]. However I think it would be kind of cool and immersive if the player could deploy a tent on their current map to enter it from, rather than just teleporting. Thanks for any feedback you can provide.
Hmmm, yeah I guess check what tile is in front of player with event commands and then if it's a passable tile id (you can also do that stuff with scripts of just regions if you like), show a picture of a tent there (coordinates from player coordinates +/- 48). Then turn a switch on for a parallel common event that transfers player to the tent map if you step on those coordinates.

EDIT: Instead of picture you can also put an invisible tent event with 2nd page graphic switch condition on your maps and have that event transfer in front of you and turn on the graphic with switch. And then that event can be like action button that transfers you.
Hmmm, yeah I guess check what tile is in front of player with event commands and then if it's a passable tile id (you can also do that stuff with scripts of just regions if you like), show a picture of a tent there (coordinates from player coordinates +/- 48). Then turn a switch on for a parallel common event that transfers player to the tent map if you step on those coordinates.

EDIT: Instead of picture you can also put an invisible tent event with 2nd page graphic switch condition on your maps and have that event transfer in front of you and turn on the graphic with switch. And then that event can be like action button that transfers you.
Thaks for your response, I will look into trying this, thank you.
it would be much easier to use a clone event plugin and then place the item as an event cloned from a master tent

you would still have to check for placement and record not only xy but also map id for the return, but placing some of the code into the tent event would make that easier to handle
it would be much easier to use a clone event plugin and then place the item as an event cloned from a master tent

you would still have to check for placement and record not only xy but also map id for the return, but placing some of the code into the tent event would make that easier to handle
I do appreciate that this would be easier with a plugin, however one of the main reason why I want to attempt it without, is that it will help me learn to use the tools better. I intend on looking at plugins when I design the game I want to make; however the game I am making now is to learn.

Thank you for your input, though.
I think this would be mostly possible without plugins, though as Andar mentions, a plugin would definitely make some parts of it easier.

Without any plugins, I think you'd probably need to do something like the following:
  • Create an event to represent the tent. It should have two event pages. Place it somewhere you can't move to.
  • On the second event page, set it to be activated by a switch and give it a tent image and commands to transfer the player to the tent map.
  • On the first event page, set it to parallel and add the following commands:
    • Use a Control Variables with Game Data -> Last -> Last Used Item ID.
    • Add a Conditional Branch that checks if the above variable is equal to the ID of your tent item. Everything else goes in this branch.
    • Use Control Variables to store the player's map X, Y, and direction in variables.
    • Do a series of conditional checks on the direction and adjust X or Y by ±1 as appropriate.
    • Use a Control Variables to store some information about the map into a variable. I think this information requires a script call but I'm not quite sure. You want either "is the space passable" or "what is the region ID on that space", where the space in question is the X and Y stored in the previous variables. Note: If it really does require a script call, you can skip the Control Variables and put the script call directly in the Conditional Branch.
    • Do a conditional check to make sure the space is passable.
    • Set the location of This Event to the location designated in those variables.
    • Set the switch to true so that page 2 will be activated.
    • You may also want to remove the tent item so that it can't be placed more than once.
  • Test it on one map until it all works. If you're using region IDs, paint all the places the tent can be placed with that region.
  • Now copy-paste that event to every other map where you want the tent to function.
There are some missing parts in that (how do you pick it up again? what if you use the tent on a map where it's not allowed?), but I think it should be a good start.
returning is another matter, however that should be doable using variables to store the X/Y of the player

Don't forget you need to store the current map as well, not just the X and Y.
I think this would be mostly possible without plugins, though as Andar mentions, a plugin would definitely make some parts of it easier.

Without any plugins, I think you'd probably need to do something like the following:
  • Create an event to represent the tent. It should have two event pages. Place it somewhere you can't move to.
  • On the second event page, set it to be activated by a switch and give it a tent image and commands to transfer the player to the tent map.
  • On the first event page, set it to parallel and add the following commands:
    • Use a Control Variables with Game Data -> Last -> Last Used Item ID.
    • Add a Conditional Branch that checks if the above variable is equal to the ID of your tent item. Everything else goes in this branch.
    • Use Control Variables to store the player's map X, Y, and direction in variables.
    • Do a series of conditional checks on the direction and adjust X or Y by ±1 as appropriate.
    • Use a Control Variables to store some information about the map into a variable. I think this information requires a script call but I'm not quite sure. You want either "is the space passable" or "what is the region ID on that space", where the space in question is the X and Y stored in the previous variables. Note: If it really does require a script call, you can skip the Control Variables and put the script call directly in the Conditional Branch.
    • Do a conditional check to make sure the space is passable.
    • Set the location of This Event to the location designated in those variables.
    • Set the switch to true so that page 2 will be activated.
    • You may also want to remove the tent item so that it can't be placed more than once.
  • Test it on one map until it all works. If you're using region IDs, paint all the places the tent can be placed with that region.
  • Now copy-paste that event to every other map where you want the tent to function.
There are some missing parts in that (how do you pick it up again? what if you use the tent on a map where it's not allowed?), but I think it should be a good start.


Don't forget you need to store the current map as well, not just the X and Y.
Thank you, I appreciate the detailed response. I will definitely have to try this method out.

Don't forget you need to store the current map as well, not just the X and Y.
Yeah, this would make things harder were I to miss it, thank you.

Original thread: https://forums.rpgmakerweb.com/threads/placeable-tent-on-the-world-map.178111/