Increased bag size
Moderators: marionline, SDHawk
- maunderingcabal
- Red Slime
- Posts: 37
- Joined: Sun Oct 30, 2016 8:49 am
- Location: Hell, California
- Contact:
Increased bag size
Is it possible to make an equip-able item that increases inventory size?
Here is my OHRRPGCE Development Page: https://startru.wordpress.com. Follow us on Twitter @startruckerdev
First, you want to set an "is equipped TAG" on the item editor. Then you'll want to write a plotscript that checks whether that tag is on, and uses "set inventory size(new size)" to resize the inventory.
You'll have to set this plotscript to run at some point between when the item is equipped and when the inventory is next opened. I would recommend changing the menu item "Items" in the main menu to be of type "4 Run Script" and change the subtype to "custom items menu script" or whatever you call the script.
Code: Select all
plotscript, custom items menu script, begin
if(check tag(tag:bigger bag)) then(
# set this value to whatever you want
set inventory size(30))
else(
# set this value to whatever you want
set inventory size(12))
# this opens the items menu as if done so by the
# default menu item.
items menu
end
My pronouns are they/them
Ps. I love my wife
Ps. I love my wife
- maunderingcabal
- Red Slime
- Posts: 37
- Joined: Sun Oct 30, 2016 8:49 am
- Location: Hell, California
- Contact:
YOU ROCK MAN! That was exactly what I was looking for! Thanks a ton.
Here is my OHRRPGCE Development Page: https://startru.wordpress.com. Follow us on Twitter @startruckerdev
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
EDIT: Oops! look how much I miss while I am typing! :)
Hmmm...
This is tricky.
A script that changes inventory size is not hard, you can use the "set inventory size" command.
Triggering the script in response to equipping an item is a little more complicated. You could edit your main menu and replace the "Equip" menu with something like this
This might seem to work, but it has an obvious problem, which is if you unequip the bag and your inventory shrinks, stuff past slot 100 becomes unusable until the bag is re-equipped.
There are different ways of handling that, depending on what behavior you want.
I think the easiest way to do this is to make the bag a one-time-usable item that expands your inventory and is then consumed. That would be much easier than an equippable item.
Hmmm...
This is tricky.
A script that changes inventory size is not hard, you can use the "set inventory size" command.
Triggering the script in response to equipping an item is a little more complicated. You could edit your main menu and replace the "Equip" menu with something like this
Code: Select all
plotscript, equip menu wrapper, begin
equip menu
if(check tag(tag:bag of holding)) then(
set inventory size(500)
)else(
set inventory size(100)
)
end
There are different ways of handling that, depending on what behavior you want.
I think the easiest way to do this is to make the bag a one-time-usable item that expands your inventory and is then consumed. That would be much easier than an equippable item.
Last edited by Bob the Hamster on Tue Nov 08, 2016 10:04 pm, edited 1 time in total.
Beat you to it!EDIT: Oops! look how much I miss while I am typing!
I hadn't considered this. I thought I might be overlooking something. I would have assumed it would wipe memory of the items in those slots. Is there any way to prevent the player from unequipping something? Where would you set that script to be run?This might seem to work, but it has an obvious problem, which is if you unequip the bag and your inventory shrinks, stuff past slot 100 becomes unusable until the bag is re-equipped.
My pronouns are they/them
Ps. I love my wife
Ps. I love my wife
- maunderingcabal
- Red Slime
- Posts: 37
- Joined: Sun Oct 30, 2016 8:49 am
- Location: Hell, California
- Contact:
I couldn't do it as a consumable. This definitely requires equipingBob the Hamster wrote:EDIT: Oops! look how much I miss while I am typing!
Hmmm...
This is tricky.
A script that changes inventory size is not hard, you can use the "set inventory size" command.
Triggering the script in response to equipping an item is a little more complicated. You could edit your main menu and replace the "Equip" menu with something like this
This might seem to work, but it has an obvious problem, which is if you unequip the bag and your inventory shrinks, stuff past slot 100 becomes unusable until the bag is re-equipped.Code: Select all
plotscript, equip menu wrapper, begin equip menu if(check tag(tag:bag of holding)) then( set inventory size(500) )else( set inventory size(100) ) end
There are different ways of handling that, depending on what behavior you want.
I think the easiest way to do this is to make the bag a one-time-usable item that expands your inventory and is then consumed. That would be much easier than an equippable item.
Here is my OHRRPGCE Development Page: https://startru.wordpress.com. Follow us on Twitter @startruckerdev
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
No, reducing the size of the inventory definitely doesn't delete stuff past the new end, just makes it unreachable.
I just checked the plotscripting dictionary and was surprised that I couldn't find a command to trigger the built-in auto-sort. I could possibly add one.
It is also completely possible to write your own inventory sorting using the commands that get/set inventory items by slot.
I just checked the plotscripting dictionary and was surprised that I couldn't find a command to trigger the built-in auto-sort. I could possibly add one.
It is also completely possible to write your own inventory sorting using the commands that get/set inventory items by slot.
It would be more correct to run the script after using the equip menu instead of before opening the inventory, in case the player doesn't go to the inventory immediately.
Although reducing the inventory size doesn't delete anything past the end, you can't gain more items once it's full (they just disappear into the void).
You might want use a script to delete anything past the end of the inventory. If you sort the inventory first so that all the important items (like quest items) are at the front and unimportant ones at the end, you can more safely delete them. (BTW, Giz recently posted a script to sort the inventory alphabetically.)
Here's an even easier solution: if you unequip the item, use a for loop to check whether any of those inventory slots that will become unusable have anything in them, and if so forcibly re-equip the item and show a textbox telling the player they need to dump something first.
Although reducing the inventory size doesn't delete anything past the end, you can't gain more items once it's full (they just disappear into the void).
You might want use a script to delete anything past the end of the inventory. If you sort the inventory first so that all the important items (like quest items) are at the front and unimportant ones at the end, you can more safely delete them. (BTW, Giz recently posted a script to sort the inventory alphabetically.)
Here's an even easier solution: if you unequip the item, use a for loop to check whether any of those inventory slots that will become unusable have anything in them, and if so forcibly re-equip the item and show a textbox telling the player they need to dump something first.
Last edited by TMC on Wed Nov 09, 2016 1:50 am, edited 1 time in total.
Where would one set this script to be run? Can we manipulate special screens yet?TMC wrote:Here's an even easier solution: if you unequip the item, use a for loop to check whether any of those inventory slots that will become unusable have anything in them, and if so forcibly re-equip the item and show a textbox telling the player they need to dump something first.
My pronouns are they/them
Ps. I love my wife
Ps. I love my wife