Description:
Storage boxes allows you to set up containers (barrels, chests, banks, whatever you want) that can hold items. You can specifiy a limit for how many items a container can hold, and a name for a container. This script also includes a scene whereby you can move items between a container and the party. You can specify an item to be unstorable in its notebox, and set it so all key items are unstorable.
Screenshot(s):
(Forgive the funky windowscreen)
Instructions:
Copy the script from the link and paste it into a new script in your project, above Main Process, and below Materials
vFoggy has written some scripts to better allow gold withdrawals from boxes, as requested by tomkomaster, here. Roninator2 has written an edit to set the sizes of the boxes to use game variables, as requested by Lionheart123. That edit can be found here. I think this was previously doable by using the manual setup, but I guess this is easier for some people.
Coming (Not So) Soon:
Box organisation
I'm almost completely inactive on these forums. I do get emails about new posts, so I'm happy to reply, but I don't use RMVXAce any more, so don't expect any major additions to this by me.
Howdy! im trying to implement this into my game but i dont think i understand how to use it! is it possible if you could explain me how to actouly use it? am i suppose to make an event and then what? i dont get it
Howdy! im trying to implement this into my game but i dont think i understand how to use it! is it possible if you could explain me how to actouly use it? am i suppose to make an event and then what? i dont get it
You'll need events for any time you want the player to be able to interact with any boxes. And I suppose you would also use events for any times you wanted the game/story to change the contents of any boxes. But you also need to edit the script to setup any boxes you'd like to use throughout the game.
The first section of the script (the lines that start with the hash symbol '#') outlines what you can do with events.
Let me know if you have any other questions. It might also be useful to know what, specifically, you're trying to do.
Thanks for the bug report. I also got a PM relating to this issue.
Also, thanks for the fix suggestion. I dunno how active these forums are, but I'm wondering if another more active/experience scripter could weigh in here.
My assumption is that this will only occur when closing the game and opening it again. And so therefore, if I update the pre-save values to the post-load values then it should work.
I've had a look at how the player inventory is stored, and it just stores the IDs in separate arrays for items, weapons, and armours.
So I have a couple of ways I think this could be solved.
First idea is that I change the way boxes work. Instead of using $data_item[id] as a key, it could use the array [:item, id] as a key, and arrays will hash to the same value if their contents are the same, so this should work, but won't be backwards compatible.
Second idea is something along the lines of Roninator2's solution: adding some checks to see if an existing item is of the same type and the same id, and if so, adding to it. This feels like sticking a plaster over the problem, and so would be unsatisfying to me, but would be backwards compatible.
Third idea would be to reload the items when a savegame is loaded to update to the latest $data_item /weapon/armor objects, essentially updating their hash values. This feels a bit like ignoring the underlying issue, and also maybe feels a bit brittle? Like if there was some other way that some particular $data_item object might change then this wouldn't address that. This feels a bit like a compromise between solutions 1 and 2.
Any input from more active/experience scripters before I go ahead with one of these solutions?
Thanks for the bug report. I also got a PM relating to this issue.
Also, thanks for the fix suggestion. I dunno how active these forums are, but I'm wondering if another more active/experience scripter could weigh in here.
My assumption is that this will only occur when closing the game and opening it again. And so therefore, if I update the pre-save values to the post-load values then it should work.
I've had a look at how the player inventory is stored, and it just stores the IDs in separate arrays for items, weapons, and armours.
So I have a couple of ways I think this could be solved.
First idea is that I change the way boxes work. Instead of using $data_item[id] as a key, it could use the array [:item, id] as a key, and arrays will hash to the same value if their contents are the same, so this should work, but won't be backwards compatible.
Second idea is something along the lines of Roninator2's solution: adding some checks to see if an existing item is of the same type and the same id, and if so, adding to it. This feels like sticking a plaster over the problem, and so would be unsatisfying to me, but would be backwards compatible.
Third idea would be to reload the items when a savegame is loaded to update to the latest $data_item /weapon/armor objects, essentially updating their hash values. This feels a bit like ignoring the underlying issue, and also maybe feels a bit brittle? Like if there was some other way that some particular $data_item object might change then this wouldn't address that. This feels a bit like a compromise between solutions 1 and 2.
Any input from more active/experience scripters before I go ahead with one of these solutions?
Thanks for the bug report. I also got a PM relating to this issue.
Also, thanks for the fix suggestion. I dunno how active these forums are, but I'm wondering if another more active/experience scripter could weigh in here.
My assumption is that this will only occur when closing the game and opening it again. And so therefore, if I update the pre-save values to the post-load values then it should work.
I've had a look at how the player inventory is stored, and it just stores the IDs in separate arrays for items, weapons, and armours.
So I have a couple of ways I think this could be solved.
First idea is that I change the way boxes work. Instead of using $data_item[id] as a key, it could use the array [:item, id] as a key, and arrays will hash to the same value if their contents are the same, so this should work, but won't be backwards compatible.
Second idea is something along the lines of Roninator2's solution: adding some checks to see if an existing item is of the same type and the same id, and if so, adding to it. This feels like sticking a plaster over the problem, and so would be unsatisfying to me, but would be backwards compatible.
Third idea would be to reload the items when a savegame is loaded to update to the latest $data_item /weapon/armor objects, essentially updating their hash values. This feels a bit like ignoring the underlying issue, and also maybe feels a bit brittle? Like if there was some other way that some particular $data_item object might change then this wouldn't address that. This feels a bit like a compromise between solutions 1 and 2.
Any input from more active/experience scripters before I go ahead with one of these solutions?
It's not perfect. I actually just updated it since I was only testing items and hadn't finished correcting the weapons and armor.
But my solution still has an issue. But I can fix that. Currently it checks the boxes contents and compares the id's, but if you were storing a hand axe and had a potion in there, it would add 1 to the potion and you would lose the hand axe since the id's are the same. I need to add in another check for the item class.
*done
It's not perfect. I actually just updated it since I was only testing items and hadn't finished correcting the weapons and armor.
But my solution still has an issue. But I can fix that. Currently it checks the boxes contents and compares the id's, but if you were storing a hand axe and had a potion in there, it would add 1 to the potion and you would lose the hand axe since the id's are the same. I need to add in another check for the item class.
*done
It's not perfect. I actually just updated it since I was only testing items and hadn't finished correcting the weapons and armor.
But my solution still has an issue. But I can fix that. Currently it checks the boxes contents and compares the id's, but if you were storing a hand axe and had a potion in there, it would add 1 to the potion and you would lose the hand axe since the id's are the same. I need to add in another check for the item class.
*done
I think this has come up before in this thread. I think for me it boils down to the fact that I want the script I provide to work as it should. So I might just incorporate an equivalent of Ronanator2's solution, but I also have particular preferences when I'm scripting, and I would like my scripts to be what I consider elegant and readable and maintainable and extensible.
You are more than welcome to use Roninator's solution, but I will still probably work out my own solution and update the script.
Thanks for the bug report. I also got a PM relating to this issue.
Also, thanks for the fix suggestion. I dunno how active these forums are, but I'm wondering if another more active/experience scripter could weigh in here.
My assumption is that this will only occur when closing the game and opening it again. And so therefore, if I update the pre-save values to the post-load values then it should work.
I've had a look at how the player inventory is stored, and it just stores the IDs in separate arrays for items, weapons, and armours.
So I have a couple of ways I think this could be solved.
First idea is that I change the way boxes work. Instead of using $data_item[id] as a key, it could use the array [:item, id] as a key, and arrays will hash to the same value if their contents are the same, so this should work, but won't be backwards compatible.
Second idea is something along the lines of Roninator2's solution: adding some checks to see if an existing item is of the same type and the same id, and if so, adding to it. This feels like sticking a plaster over the problem, and so would be unsatisfying to me, but would be backwards compatible.
Third idea would be to reload the items when a savegame is loaded to update to the latest $data_item /weapon/armor objects, essentially updating their hash values. This feels a bit like ignoring the underlying issue, and also maybe feels a bit brittle? Like if there was some other way that some particular $data_item object might change then this wouldn't address that. This feels a bit like a compromise between solutions 1 and 2.
Any input from more active/experience scripters before I go ahead with one of these solutions?
I'm new to this forum (both as a reader and a member), so I'm not sure, whether I should have created a new thread for this.
If so, I'm sorry!
I created an add-on for Storage Boxes.
It allows you to create boxes, which the player can only withdraw items from, but not store any in.
Mail Boxes v1.0
Ruby:
# "Mail Boxes" v 1.0 (for RM VX Ace)
# by D4NTE
# -------------
# Requires: "Storage Boxes" by Imp1
# -------------
#
# The main purpose of this add-on is to allow you to create boxes, which the
# player can only withdraw from, but not store anything in them.
#
# This add-on also adds some spaces between the number of items in a box and its
# capacity (so "X/Y" becomes "X / Y" for all normal boxes with finite capacity)
# as I think that is easier to read
#
# --------------------
# Usage:
# 1. Place this script below "Storage Boxes" and above "main".
# 2. Make any box "withdrawal-only" by specifying a negative value for its size
# example:
# {
# name:"Locker",
# size:-1, #the exact number doesn't matter as long as it's < 0
# }
# 3. Add items to the box using the usual script calls. By default, there is no
# need to specify :force when adding them, but that might be required, if
# you also use other add-ons for Storage Boxes.
# --------------------
# Compatability:
# Aliased Methods:
# IMP1_Game_Boxes.how_full
#
# New Methods/Fields:
# none
#
# Overwritten Methods:
# none
# -------------------
module IMP1_Storage_Boxes
#------------------------------------------------------------------------------
# CONFIGURATION BEGIN:
#------------------------------------------------------------------------------
# for withdrawal-only boxes, the text below will be shown instead of
# the number of items in the box.
READ_ONLY_BOX_TEXT = "--"
# set it to "nil" (without the quotes) to show the default text (i.e. as if
# this add-on wasn't installed)
# READ_ONLY_BOX_TEXT = nil
# set it to zero (number, not string) to show the same text that is shown for
# boxes with infinite capacity
# READ_ONLY_BOX_TEXT = 0
#------------------------------------------------------------------------------
# CONFIGURATION END
#------------------------------------------------------------------------------
end
class IMP1_Game_Boxes
alias :rw_how_full :how_full
def how_full(box_id, denom = true)
i = fullness(box_id)
if @box_info[box_id][:size] < 0
return rw_how_full(box_id, denom) if READ_ONLY_BOX_TEXT == nil
return rw_how_full(box_id, false) if READ_ONLY_BOX_TEXT == 0
return READ_ONLY_BOX_TEXT
end
return "#{i} / #{@box_info[box_id][:size]}" if denom
return rw_how_full(box_id, denom)
end
end
It SHOULD be compatible with the other add-ons for the main script, but I haven't tested that, as I don't need those for my game.
Feel free to use it for non-commercial projects as long as you credit me.
Nice one! Thanks for writing an add-on for my script. I was going to suggest a couple of edits, but then it was 15 minutes later and I'd just changed some stuff in the base-script, and re-written your add-on. I hope you don't mind, but I've now incorporated the how_full string padding as an option into v1.11 of the base script.
And that makes "read-only" boxes a lot simpler now (IMO).
This addon allows for some boxes to be "read-only", that is, their contents can be withdrawn, but nothing can be deposited. To do this, set the size of the box to -1. Inspired by D4NTE and their addon for v1.10. Major props to them!
I'm not quite sure how you mean that.
Calling the same Common Event from various Map Events will result in all of the chests having identical contents, which is not (always) desired.
And the main reason why I wrote this (instead of just calling "item X +5" in my Map Event), is that my game uses TheoAllen's Limited Inventory script and I wanted to avoid boilerplate code to make sure items that don't fit in the inventory vanish into thin air when opening a chest.
Nice one! Thanks for writing an add-on for my script. I was going to suggest a couple of edits, but then it was 15 minutes later and I'd just changed some stuff in the base-script, and re-written your add-on. I hope you don't mind, but I've now incorporated the how_full string padding as an option into v1.11 of the base script.
And that makes "read-only" boxes a lot simpler now (IMO).
I was kinda hoping you would add the spacing thing to the main script.
However, that you basically re-release my add-on as yours wasn't quite how I pictured this to go.
But I guess that means less maintenance and thus more free time for me...
I'm afraid I need to report a bug.
I'm using
- the base script v1.10
- the Item Sizes Add-on v1.4
- TheoAllen - Limited Inventory v1.4c
When LimInv.ForceGain is set to false and the player presses "take all" when withdrawing from a storage box, it will remove them all from the box even if they don't all fit.
Example: you can carry 3 more items. There are 5 potions in the box. You press "take all".
Result: no more potions in the box, but only 3 (new ones) in your inventory.
Could you please implement a check in the Item Size add-on, so that the remaining 2 potions stay in the box? Thank you.
I haven't tested this with "take Lots", but I presume it occurs there as well.
And when using "take 1", I somehow cannot fill the last slot. I keep getting the buzzer sound as if my inventory was already full?!
(unless of course, the item has a size of zero)
Edit: Found yet another bug: if my inventory is full, I cannot put anything in a box which has a limited capacity.
Reason: you made a mistake when overwriting the capacity(box_id) method in the add-on. You check how many slots the inventory has left free, rather than the box.
You know.. I... I kinda lost my interest in living a long time ago. What sustains me is a lack of interest in dying.
Like a star that is balanced between the forces of gravity and outward pressure, I feel like the energy to produce that outward pressure is weakening. I feel like I should pull a Stardew Valley and revert to a more primitive lifestyle, away from others.
made more sprite for the Time passing game that I may or may not actually make. At least now I have a better idea how to make Rtp Walk sprites actually look wrinkly and old, since the Generator doesn't do that.
Well, now all of my Refreshable Events scripts also feature some brand new demos to let people see how easy it is to let the script handle the refreshing of a given set of events. All of this with just one specific script call per event!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.