@linkhyrule5 I actually like the idea of being able to sneak in a weapon
🙂 I remember being able to do that in games like Fallout: New Vegas with a high enough Sneak level.
@Axfinger This is going to be a kinda long explanation.
========== Entering the bar ==========
1.) Store the weapon data into a variable for later use
2.) De-equip the weapon from the Actor and remove it from the Party
3.) Add and equip the blank/fake weapon which will prevent the player from equipping new weapons in the bar
========== Leaving the bar ==========
4.) De-equip the fake weapon from the Actor and remove it from the Party
5.) Return the original weapon to the Party and equip it to the Actor
========== Appendix ==========
1.) Store the weapon data into a variable for later use
We need to store the weapon into a variable. Normally, Game Variables (notice the capital letters) are integers and when you act upon then in the editor, it's just numbers. But in JavaScript, variables (lowercase) are 'loosely typed' which means that the type can still be changed after the variable is declared. Meaning, we can actually store anything in Game Variables.
In this case, we are storing an object.
Spoiler: Set a Game Variable to the currently equipped weapon
Replace Game Variable 41 with whatever Variable ID# you will use.
2.) De-equip the weapon from the Actor and remove it from the Party
Use the Script Event Command:
Spoiler: How to use the Script Event Command
Code:
var weapon = $gameVariables.value(41);
$gameParty.members()[0].discardEquip(weapon);
Replace '41' with the Variable ID# that you are using.
3.) Add and equip the blank/fake weapon which will prevent the player from equipping new weapons in the bar
Spoiler: Set up an item in the Database like this
Use a Script Event Command like this:
Code:
var slotId = 0;
var item = $dataWeapons[7];
$gameParty.gainItem(item, 1);
$gameParty.members()[0].changeEquip(slotId, item);
Change the '7' to be the ID# of your blank/fake weapon in the database.
===============================
========== Leaving the bar ==========
===============================
4.) De-equip the fake weapon from the Actor and remove it from the Party
Use a Script Event Command like this:
Code:
var weapon = $gameParty.members()[0].equips()[0];
$gameParty.members()[0].discardEquip(weapon);
5.) Return the original weapon to the Party and equip it to the Actor
Use a Script Event Command like this:
Code:
var slotId = 0;
var item = $gameVariables.value(41);
$gameParty.gainItem(item, 1);
$gameParty.members()[0].changeEquip(slotId, item);
========== Appendix ==========
Spoiler: Sample Event Page 1
Spoiler: Sample Event Page 2
Is if there is more than 1 party member, you'll have to repeat each of these things, and each Actor needs its own variable.
- $gameParty.members()[0] --> 1st member
- $gameParty.members()[1] --> 2nd member
- $gameParty.members()[2] --> 3rd member
- $gameParty.members()[3] --> 4th member
Is there a way to do it more efficiently for all the party members using code/loops? Definitely, but I'm not going to describe it here. I think you should be able to get this to work as-is.