Hello, I am currently trying to make a switch which will disable vehicle entry when it is on, and enable vehicle entry when it is off (or something like that, basically making entering vehicles dependent on a switch). Is there any way to do this in MZ with or without plugins? I would prefer if this is possible without plugins, but it is fine if a plugin is needed since I haven't been able to find any solutions. Thank you!
How to disable/enable vehicle entry
RPG Maker MZ SupportHopefully someone with a good, simple solution will be able to offer assistance. But barring that, the way I would try doing this is with swapping the vehicle for an Event of the same image when I didn't want it accessible.
Meaning, you place the vehicle somewhere and you want to make it so you can't enter it. You could get the location of the vehicle, then relocate the vehicle to a spot off the map where the player can't see, then you move an Event that the player can't see to the spot where the vehicle was and the Event has an image of the vehicle. So now the player can see the vehicle from the Event image, but they can't interact with it.
When you want to allow the player to access the vehicle, you just reverse the process by moving the vehicle location back to where it was.
If there isn't built in UI commands available to do all this, you can find script calls in the Script Call List that should be able to help.
Not sure if that makes sense to you or if someone else can give a better solution.
I can always try to test this later with Events once I have time.
Meaning, you place the vehicle somewhere and you want to make it so you can't enter it. You could get the location of the vehicle, then relocate the vehicle to a spot off the map where the player can't see, then you move an Event that the player can't see to the spot where the vehicle was and the Event has an image of the vehicle. So now the player can see the vehicle from the Event image, but they can't interact with it.
When you want to allow the player to access the vehicle, you just reverse the process by moving the vehicle location back to where it was.
If there isn't built in UI commands available to do all this, you can find script calls in the Script Call List that should be able to help.
Not sure if that makes sense to you or if someone else can give a better solution.
I can always try to test this later with Events once I have time.
Paste this into a text editor, save as a *.js file, include as a plugin.
Replace 69 with the ID of the switch you want to use.
Code:
var aliasGetOnVehicle = Game_Player.prototype.getOnVehicle;
Game_Player.prototype.getOnVehicle = function()
{
if ($gameSwitches.value(69))
return false;
aliasGetOnVehicle.call(this);
};
Replace 69 with the ID of the switch you want to use.
@ATT_Turan suddenly appears from the shadows, flexes, throws down some code, making it look super easy, and then fades back into the shadows.
This was awesome!
This was awesome!
Works perfectly, thank you!
What you don’t know is that he was typing this with his feet whilst playing the Entertainer on guitar complete with artificial harmonics.
Is aliasing a function to add a switch conditional the modern day black magic sorcery?
@AquaEcho Since I don't understand many of those words in that particular order, except the last part, I am just going to say "yes, yes it is."
I think I understand the function and add switch conditional part, but apparently "aliasing" is a word that is not in my functional vocabulary.
I think I understand the function and add switch conditional part, but apparently "aliasing" is a word that is not in my functional vocabulary.
CT_Bolt left behind forbidden knowledge of this arcane art for the common man if you're so inclined
[RMMV-MZ] Custom Script Anywhere by CT_Bolt
ct-bolt.itch.io
Original thread: https://forums.rpgmakerweb.com/threads/how-to-disable-enable-vehicle-entry.165119/