Sometimes it’s nice for our heroes to be able to take a break while adventuring and relax at a campsite. Camping in games often offers a place to heal, to converse with party members, and even to make new equipment. Let’s take some time today to learn how to make an item that’ll let our players travel to a campsite.
Being able to travel to a campsite is nice, but being able to leave the campsite and jump right back into the world where we left off is even better. So let’s make our camping item keep track of where it’s used so our players can easily get back to exploring our game!
First thing we need is the item we’ll be using to travel to the campsite. Our Camping Gear will be a key item set to activate a common event. Since we don’t want players to try to use it during a battle its Occasion will be set to ‘Menu Screen’, and we also want our players to be able to use it repeatedly so the Consumable option should be set to ‘No’.
Before we can event a trip to the campsite, we need the campsite itself! So let’s make our campsite map, which can look however we want. In this example, mine will be a simple clearing in a forest. I also added in some empty events that we’ll add to later, for leaving the campsite and returning to the normal map.
With our Camping Gear and campsite ready to go, next we need to make the common event where the map transfers happens. Since we want our players to be able to leave the campsite and appear back on the main maps exactly where they were, we’ll need to set up three variables to store the map ID, the player’s X, and the player’s Y on the map. Once those details are stored, we’ll be able to use them in a Transfer Player event to send our players back to the right spot.
Once those variables are set, all we need to do is use a transfer player to our campsite map and our Camping Gear works. But there is a major issue if we leave the common event as just that: using the Camping Gear while we’re at the campsite will reset our variables and trap our players on that map!
So to deal with that problem, let’s use a switch and a conditional branch to check if we’re at the camp or not. If the switch is Off then we’ll set up our three variables and transfer to the campsite map, and if the switch is On then that means we’re at the camp so our event won’t change the variables. We just need to make sure that we turn the switch On when we’re heading to the campsite and Off when we leave it, and our problem should be solved.
While we’re adding in a conditional branch, we can also add in a way to exit the camp when the switch is On and the Camping Gear is used. A simple message asking if the player wants to leave and a yes/no show choices command will work, where ‘yes’ will turn our camp switch Off and use a transfer player command with our three variables to send us back to the main map.
If we try using our Camping Gear while playtesting, we can easily travel to the campsite and back without issue. The last little thing we need to add is the exit event to those two empty events we created on the campsite map. They’re pretty much the same as the commands for the Camping Gear, the only additions being some move routes that either walk the player forward while leaving the map or turning the player around and making them step off the event.
Now that our Camping Gear works, we can set up a camp wherever we want! ...Which could be a problem, if we think about it. Do we want our players to be able to camp in the middle of a town or deep in a dungeon? If our answer is ‘no’, then we’ll need to add something else to our Camping Gear’s common event: a way to limit where players can camp.
To keep our players from using the Camping Gear in places we don’t want, we need to add in a way to check which map they’re on. There are a few ways we could do that, so let’s start by checking map IDs.
At the start of our Camping Gear’s common event, we need to set a variable to the current map’s ID, and then add in a conditional branch to check the variable against each map ID where we don’t want the item to work. So in this example, we’ll check if the variable equals 15 or 22, which are a town and a dungeon. If the variable matches, then a short message will play telling the player they can’t go to the camp there and the Exit Event Processing command (found on page 1 of the event commands under Flow Controls) will stop the common event right there. If the variable doesn’t match any of our added conditional branches, then the event will play out the variable setting and map transfers as intended.
Playtesting it proves that our Camping Gear can’t be used in map 22, which is exactly what we wanted.
There are some possible issues with going that route though. First up is that if we have a lot of dungeon maps that we want to be blocked, then our list of conditional branches to check all of them will be really long. And if we end up copying or replacing any maps, we’ll need to go back and change the numbers in our conditional branches so they’re correct. So for a limited number of maps this method would work, but what are some other options?
Well, we could set up a switch that we turn on any time we enter a dungeon or town with a corresponding conditional branch that shows the ‘can’t camp here’ message and exits the event. That way it wouldn’t matter how many maps we want to block camping on, we just need to remember to turn on and off the switch. But if we forget to switch in some map transfer events, it could end up messing up our game and making it so we can’t camp on our world maps. So let’s look at another option: using map notetags.
If we want to use map notetags, then we’ll need to open up the Map Properties. To keep things easy to understand, let’s add <no camping> to our dungeon maps. The < and > signs aren’t being used for anything important here, I’m just adding them to keep this visually separate from any random notes I could leave in the note section.
With <no camping> added to all our maps that need it, next we need to make our conditional branch that will check for it. We need to use a script call, in this case it’ll be $dataMap.note.includes(“<no camping>”). This will check the current map’s note section to see if our tag is there. Since it’s possible we’ll have other notes for ourselves or used by plugins in the note section, we’re using ‘.includes()’ so that our script call will check for an exact match and ignore anything else. This is a case where things need to be exact (the script call is case-sensitive), so copy-pasting our notetag is a good idea.
Once our conditional branch is made, it can use the same commands as our earlier examples. As long as the <no camping> notetag is in the map’s notes, our players won’t be able to use the Camping Gear.
And with that, we can control where our players can camp! We can stop them from setting up camp right in front of the final boss and messing up our game’s balance while still giving them a decent amount of freedom when it comes to visiting the campsite. Are there any additions you’d add to this idea? How would you use some of these concepts in your games?
Head to the seas to battle battle ships, or score your latest post apocalyptic games with our newest releases! In addition we have updates to three of our existing packs: Battle Girl characters Pack 1, Modern + Inner Basic Tiles MV, and the Fantasy Character Pack.