Make items(tents) usable on World map + save points only using common events

Hello, I would like to make certain items like tents or cottages only usable in the menu when the player is on either the world map, or a save point location. I have read through the forums that give out the concepts of how to do it, but I am still fuzzy on how to execute it properly.

https://forums.rpgmakerweb.com/inde...otion-use-in-a-specific-map.49142/post-487352

-Shaz laid out some possible ways to do it

https://forums.rpgmakerweb.com/inde...in-world-map-or-save-points.86031/post-786914

-Shaz talked about creating common events and that for player location and compare it to Map ID

I think I would like to go the common event route using region IDs at save spots because I would like to get better at using common events in general.

(Side note) I followed a youtube video guide to setup a "Game Manager" common event that checks for player's Region ID, Map ID and gold -

My issue is, when trying to create the common event for the tent item, I don't have a hot clue what I'm doing even after trying to follow the instructions laid out in those early forum posts xD. I started a Conditional Branch for Map ID = 1(I think this is my world map?0001) but I don't know how to link to an "item" in my inventory in order to "enable" or "disable." I can only seem to link to an event, so that's where I'm stuck at this point.

I'll post my "Game Manager" common event and how far I've gotten with trying to create the other common event for tent use.
On your tent item, do this, and select the World Map & Save common event.
1683183563331.png



If I assume you've used region 8 to identify your save locations, your event will look like this:

Code:
If Map ID = 1
  <use the tent>
Else
  If Hero Region ID = 8
    <use the tent>
  Else
    Text: You can't use that here.
  End
End

Now, you haven't said what you actually want to happen when the player uses the item from the menu and they ARE in the right place, so I've just added <use the tent> and you can replace it with whatever you want. Maybe you just want a sequence of ME, darken screen, recover all, lighten screen. Maybe you want to teleport to another map that's the inside of the tent so you can talk to all party members or whatever. If it's just a really simple couple of steps, you could put them in both of the slots above. If it's more complicated, create another common event with all the instructions (with no trigger), and where I have <use the tent>, you call that common event.
On your tent item, do this, and select the World Map & Save common event.
View attachment 260863


If I assume you've used region 8 to identify your save locations, your event will look like this:

Code:
If Map ID = 1
  <use the tent>
Else
  If Hero Region ID = 8
    <use the tent>
  Else
    Text: You can't use that here.
  End
End

Now, you haven't said what you actually want to happen when the player uses the item from the menu and they ARE in the right place, so I've just added <use the tent> and you can replace it with whatever you want. Maybe you just want a sequence of ME, darken screen, recover all, lighten screen. Maybe you want to teleport to another map that's the inside of the tent so you can talk to all party members or whatever. If it's just a really simple couple of steps, you could put them in both of the slots above. If it's more complicated, create another common event with all the instructions (with no trigger), and where I have <use the tent>, you call that common event.
Thank you for the response! I followed your instructions to the best of my abilities. When I try using the tent on the overworld or region ID 8(Save locations) it always shows the text "You can't use that here" and doesn't do the scripted event(fade out, recover all, decrease tent -1, fade in). I think I got it setup right, I'll include screenshots, not sure what I'm getting wrong.
your're missing several commands in your common event

both variables map ID and hero region ID have to be loaded before they can be used.

for map ID that is control variable:game data directly.

for hero region ID you'll have to use two control variable to get hero X and Y position (same way as above, just switch from map id to player x and player y), then use thos coordinates in get location infor to load the current region ID into the variable to be checked.
your're missing several commands in your common event

both variables map ID and hero region ID have to be loaded before they can be used.

for map ID that is control variable:game data directly.

for hero region ID you'll have to use two control variable to get hero X and Y position (same way as above, just switch from map id to player x and player y), then use thos coordinates in get location infor to load the current region ID into the variable to be checked.
I think those are loaded from a separate common event I have going on. I'll attach an image. Those would be checked when I use variables Map ID & Region ID, would they not?
both variables map ID and hero region ID have to be loaded before they can be used.
yep, that's in the other common event that runs on a parallel process

1683191418476.png

Your world map is map 7, not map 1. So change the condition to If Map ID = 7.

If it also doesn't work on your save locations, please show a screenshot of your map, with the Region layer visible, so I can confirm the region id you're using.
@Shaz that is a design pattern that I have seen time and time again in different tutorials - and never was it necessary to update these variables 60 times per second. Why don't we get the values of these variables only when we need them (in this case when the player triggers our Worldmap + Save common event through the use of the item). Granted, assigning a handful of variables probably has no performance impact on most modern hardware, but it still bugs me to no end.
@eomereolsson why do you assume I suggested/recommended that approach? I didn't, and I wouldn't do that myself. I have never posted a tutorial or recommended anyone do that. The OP got it from the video included in the first post, not from me.

The question being asked was about how to attach the common event to the item, and why the common event wasn't doing what it should. That's what I answered. I thought about mentioning that, but that's not what the question was about, and not what stopped it from working, so I didn't.

The last time I suggested a different/better approach (to someone else in another thread) I got "thanks but I'm going to do it this way anyway".

Damned if you do, and damned if you don't, it seems.
@Shaz ༼ つ ̥◕͙_̙◕͖ ͓༽つ
Oh sorry, I didn't look at OP's links that closely. Just saw that they also referenced you in their OP. And my comment was not meant as a personal attack anyways.
I apologize if it came off that way.

My rant against that particular design pattern still stands though. And I do think it is important to point this flaw out to people. Even if they ignore it, someone else reading the same thread should also be made aware.
yep, that's in the other common event that runs on a parallel process

View attachment 260875
Your world map is map 7, not map 1. So change the condition to If Map ID = 7.

If it also doesn't work on your save locations, please show a screenshot of your map, with the Region layer visible, so I can confirm the region id you're using.
I was getting the Map Properties ID mixed up with the tileset number, thanks for pointing that out. I switched my Map ID to 7 but I'm still getting the text message when on the overworld map :'(. Same text when I stand on the Region ID 8 at my save location. I'll post my updated common event along with the Region ID location.

@eomereolsson I am the kind that is certainly open to suggestions. I'm sure this is a situation where there is a number of different ways to achieve the same goal. I am still a newbie at this stuff and just picked a route that sort of made sense to me with the logic behind it. If there are more optimal ways of doing things, I'm not against hearing them out. However, I would like to see this method through just so I know I am capable of doing it this way lol
The only way that common event can fail is if the region ID is wrong for whatever reason. This is sometimes due to timing problems, sometimes due to misuse of variables and other reasons.

You should NEVER assume that a different event got the value for something like this set correctly.
always make them load the fixed value in the same event - that also removes the problem of the requires parallel process causing unneccessary lag due to running more often than needed - it does not need to load the region ID and the map ID sixty times per second, it only needs to load them if that common event checks for its use.

Additionally, use show text with the variable to display the current numbers if variables behave strangely.
Just a random thought... did you make sure that the switch that needs to be activated to run the "Game Manager" CE is actually on when you playtest it?
You could also go to the debug screen (Shift+F9) and check if the variables have the correct values

If you'd rather stick to pure eventing then there's nothing wrong with this approach, but personally I feel like using variables for stuff like player coordinates, region id, map id, etc. is... unnecessary.
The game already keeps track of this data and updates it constantly in the background and you can access it directly via script calls. Putting those into variables is an extra hoop you don't really have to jump through.
Just a random thought... did you make sure that the switch that needs to be activated to run the "Game Manager" CE is actually on when you playtest it?
You could also go to the debug screen (Shift+F9) and check if the variables have the correct values

If you'd rather stick to pure eventing then there's nothing wrong with this approach, but personally I feel like using variables for stuff like player coordinates, region id, map id, etc. is... unnecessary.
The game already keeps track of this data and updates it constantly in the background and you can access it directly via script calls. Putting those into variables is an extra hoop you don't really have to jump through.
That was the issue! The event referencing Map ID and Character location was never turned on by anything. I created a simple switch to turn on the event, walked outside and voila! Working tent event. The tent also worked on the Region ID for a save spot.

Now, I've taken your guy's advice into consideration(Don't have a common event constantly running in the background, just do checks on triggers). So I copied and pasted all that info from my Game Manager common event into the World Map + Save common event and it worked just fine. I think I'll need to do a little more fine tuning to make it more immersive, but this is great! Thanks a lot everyone!
Glad it works now 🙂

If you'd like to streamline your event, all you really need to check is this, no variables
It might look intimidating at first, but as your game gets more complex you'll end up needing script calls eventually
It's all here: https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
Glad it works now 🙂

If you'd like to streamline your event, all you really need to check is this, no variables
It might look intimidating at first, but as your game gets more complex you'll end up needing script calls eventually
It's all here: https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
Thanks for that link! Sorry, just got around to checking this now. I'm trying to think how to "practically" use it. So instead of creating variables to check for character locations, you could just reference the call sheet and input the scripts from the Character Properties section?
So instead of creating variables to check for character locations, you could just reference the call sheet and input the scripts from the Character Properties section?
mostly yes, but it also has disadvantages like requiring basic knowlege of javascript logic and missing the internal data security the event commands provide.
That is why not everyone uses that way

Original thread: https://forums.rpgmakerweb.com/threads/make-items-tents-usable-on-world-map-save-points-only-using-common-events.157206/