Is there any way to enable/disable a specific item from being usable on certain maps?

I have an item in my game called Camping Set, which should work like Tents do in Final Fantasy. As it currently stands, you can only use them at save points, because the item itself is set to Occasion: Never, and the Save Points have a choice that will fully heal you and consume a Camping Set.

But one of my playtesters just pointed out that they really should be usable on the world map as well, and I agree. Thing is... I don't know how to actually selectively enable an item's usage occasion based on the map. It would only need to be usable at any time from the item menu on ONE map (the world map), but it'd be greyed out anywhere else.

So... any idea how to do this?
You could have the item trigger a common event, then check the map ID in the common event before either healing the entire party (consuming the item in the process), or saying: "We can't camp here".

If you're not afraid of using JavaScript, however, I'd recommend you put notetags in your maps (either to allow camping if camping is disallowed by default, or to disallow it if camping is allowed by default), so you can check for the existence of said notetag.

The advantage of the notetag approach is, you can freely delete maps and create new ones without having to modify the camping common event. Another benefit is, you'd only need a single conditional branch to check whether a map has the notetag or not. With the map ID option, you'd need at least one conditional branch per map where camping is allowed (or disallowed).
Try making a Common Event that runs on Parallel, and has a Script event with the following:
JavaScript:
if($gameMap._mapId == x) {
    $dataItems[y].occasion = 0
} else {
    $dataItems[y].occasion = 3
}
In this code, replace "x" with your world map's ID, and "y" with the Camping Set's item ID.
Then, add the "Erase Event" command below the script, so that the Parallel event won't be running every millisecond. We only need it to run when the player changes maps.

If my world map's ID is 1, and my Camping Set's ID is 7, it should look like this:
1.png


What the script does is, whenever you enter a new map, it checks if it's the world map (Provided by the ID you entered in "x").
If yes, it'll change the Camping Set's Occasion to "Always". If not, it'll change it to "Never".
(Just FYI - The "Always" occasion in the script is 0, and "Never" is 3.
Battle Screen and Menu Screen are 1 and 2 iirc, if you wanna use them)

Obviously, you'll need to activate a switch at the start of your game to make the Common Event work as a Parallel trigger.

I haven't tested it too extensively, so let me know if there's any issues o7
You may find this tutorial helpful:
It describes a way to check for a <no camping> tag on the map (no plugin required).
You may find this tutorial helpful:
It describes a way to check for a <no camping> tag on the map (no plugin required).

So... am I understanding this correctly? If I use the command $dataMap.note.includes(“<x>”) in a conditional branch on a common event, I could allow/disallow things from working so long as that map has that notetag? It'd work for other things besides a camping event, right?

So for example, in this case, I could make my Camping Set item have that script call in a conditional branch, and it would check if the map has that notetag. In my case, the only map that would have that notetag would be the world map, and so if you're on the world map, it uses the item, and if you're literally anywhere else, it throws up the error saying you can't use it, right? Is that how it works? And then all I have to do is keep my save points with the already existing events.
You could try and create a second identical Item but with some other settings.
When entering or leaving the Worldmap, you exchange the two Item stacks.
If I use the command $dataMap.note.includes(“<x>”) in a conditional branch on a common event, I could allow/disallow things from working so long as that map has that notetag? It'd work for other things besides a camping event, right?
Correct! 👋

Edit: except for the quotes, they should be "neutral", not “open/close”, i.e. $dataMap.note.includes("<x>"). Sorry for the confusion! 😅
Notetags are the way to go as others have said and easy to implement.

I experimented with the @hiddenone tutorial mentioned above. I wanted my camps to reflect the biome the player party was in; forest, snow, desert, wasteland etc. Built a small map for each biome, used regions for my overworld map and a common event so that depending on the region/biome, they would have the appropriate camp.

I used notetags to designate maps where they couldn't camp (towns, locations, dungeons that already have save points)
Correct! 👋

Mmk! I'll try setting it up later and report back! Can't do it right this moment, but I'll try and do it this evening!
1672969342454.png


@caethyril
Clearly I've done something wrong, cause it's not working lol.
And yes, the map has the correct note tag.

1672969406705.png


What am I doing wrong here?
For the item you are using for camping equipment does it call the common event? I presume the item's name is Camping Set. For your item, you need to set under Effects: Common Event and the name of your common event.

It might be more efficient to have a control variable for the vehicles rather than having multiple show text items, then you can check for the control variable being on/off and take action.

The Else where I play the Inn1 SE and the Recover All is where you would put your camping code.

The final Else is to catch situations where the Map doesn't have the notetag.

Here's a sample item with the common event set

2023-01-06_15-44-03.png


Here's a sample common event

2023-01-06_15-31-24.png



2023-01-06_15-31-53.png
You could just have a paralell event on the maps where usage of this item is allowed, that simply turns on "heal okay" switch, then erase event. The item runs a common event with the conditional that "heal okay" switch is turned on. If not "I can't use this here" and refund the item.
Turn the heal okay switch off when leaving the map or whenever you enter an area where you can't use it.
Your Conditional Branch -> Script check uses “open/close” quotes rather than "neutral" quotes. Use this instead:

$dataMap.note.includes("<Camping Set Valid>")
It seems the blog example got auto-formatted...I should've checked before recommending it. 😴

[Edit: wow, I didn't notice that when you asked for confirmation either. My mistake.]
Your Conditional Branch -> Script check uses “open/close” quotes rather than "neutral" quotes. Use this instead:

$dataMap.note.includes("<Camping Set Valid>")

It seems the blog example got auto-formatted...I should've checked before recommending it. 😴

[Edit: wow, I didn't notice that when you asked for confirmation either. My mistake.]
It works now! Thanks! 😀

Original thread: https://forums.rpgmakerweb.com/threads/is-there-any-way-to-enable-disable-a-specific-item-from-being-usable-on-certain-maps.153794/