Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Fancy Chest

Fancy Chest Version: 1.0
By: Plague180

Introduction
This is just a script that was originally made by Brew, i edited it to fit some ones request, then added some features i wanted. figured i post it since ive seen it requested alot over the years.

Features:
-Self forming window for each chest, for each time you open it.
-you can leave some items in chest to get latter(or one time use)
-simply better then a normal chest lol

Screenshots
f4ir1s.jpg


Demo: *Apparently im a ass, so ya its gone, email me if you want this script*

Script(this is all the code put into one thing, i recommend you separate it if you dont download demo)
bet blue doesnt like my Chest class and module lol


Instructions
there are 6 examples in demo, but for those not using the demo its pretty simple. here is how to make a chest with a Full Potion in it.(item 3)
1. you will need to make a new event, page one should look like this:
2gshp8i.jpg

2. then on page two do this:
11awygm.jpg

3. make page 3 look like this:
2b8t2v.jpg

to make a new chest all you have to do is copy and paste a old chest and change the name of the chest in the four places its used.(in my example its 'chest')
more advanced instructions
an explanation of the formatting:
ChestData::Chests['Chest Name'] = Chest.new([1],[1],[1])
firstly you need ChestData::Chests
['chest name'] is pretty self explanatory, its the name of that chest, no two chest can have the same name.
i know that Chest.new([1],[1],[1]) looks complex but its really not.
the first [1] is for items, the second for weapons and the last for armor.
you can also do: Chest.new([1,2,3],[1,5,8],[2,2,2,2,2]) which would give you items 1,2,3, weapons 1,5,8 and 5 armor 2's
FAQ
None yet.

Compatibility
shouldn't have any issues unless you have unaliased Save or Load methods, if you have an issue let me see the script its conflicting with and ill fix it.

Credits and Thanks
thanks to brew for writing original, motivated me to make this.

Terms and Conditions
Do NOT post this anywhere other then hbgames.org without my permission.
 
WOW! This is very useful if you want to have multiple items in a chest just like in World of Warcraft or one of those other really cool RPGs! Great thinking on this, and I have not found any problems with this script yet! Keep up the work!
 
I don't like your Chest class and module :shades:

Heh, well... you're basically right though, I don't like those too much... while there's basically nothing wrong with them syntax-wise (just lacks clean indentation), it'd be easier to just call chests by a call scrit command, giving the items that are in the chest. You could also go the way over the event name, which is rather fiddly though, mostly for the user. Another approach would be checking for a comment 'chest' in there or something.

Either way, the easiest way micht probably be taking that Local Variable script that's around, give each event that has a 'chest' comment in it a local variable - array - that stores item IDs of items stored, and go from there - makes easier and less confusing integration for stashes as well, as an empty array will still be an empty array :p

That being said, I gotta add that I do like the idea... I think it's been done before, but knowing folks around, this is probably the cleaner version. Now if you improve it with the local variables, you're ready to launch ^^
 
lol blue i so knew you were gonna say that :P that being said what do you want me to do with local var? also you make it sound like its hard to set up my chest, it isnt, copy paste change items and name...idk. you have always helped in the past im willing to at least try what you want if i can get a good grasp of what you mean.

here is what i think you mean: make it so they only have to call via script and i manage all the event stuff in script. which is a good idea, im just not sure how one would go about that.
 
The reason I suggest you change it is that you might want to include additional features later (and if not, the user might), and your system isn't as potent for all of them. Reason for that is that you have that module, a Chest class you don't need, a rather complex (believe it or not ^^ ) script call... while all you could have is a chest setup like this:
Code:
Comment: Chest[1, 1, 1, 2, 34]
That you'd read in a local variable that each event has, if the comment exists. Note that we're still exclusively in Game_Event, that now has it's @chest_contents=[] array. Now all your window needs to do is list the items from @chest_contents and allow to take them by pressing a key.
You can say it's not that much easier to work with than yours, but you're very wrong... every system building up on it will greatly benefit from the presence of an actual content variable, nevermind one that's actually stored within the Game_Event instance, meaning you have no need to either mess with additional classes or modules, or save additional stuff (though I don't think events are saved by default really... you'd have to check that, and maybe save their states). Also, chest-to-player and player-to-chest transactions are much eased by the presence of an array.
 
thats a complete rewrite of my script, and even though i doubt anyone will ever use it, exp in the way you mean ill try to make some time to do it on my day off :D

p.s. ill add the store feature too
 
couldnt sleep so i thought id work on this script, but im having massive issues reading comments from events, i looked at the sdk and macl code. i found the macl more helpful, but i dont seem to understand how to use the method :( guess ill hope on script support tmw and see if anyone can help me get this working.


edit: still couldnt sleep....what do you think of this? (only my base, obviously i will be adding more)
[rgss] 
# in my init:
@chestdata = check_comments
for i in 1...@chestdata.size
  # just for testing, i get the right output
   p $data_items[chestdata.to_i].name
end
 
def check_comments
    para = []
    for ec in @list
      # Skip if not comment or not comment next line
      next unless [108, 408].include?(ec.code)
      # Read Event Comment & Turn Downcase
      comment = ec.parameters[0].downcase
      # If Comment Include Parameters
      if comment.include?('chest|')
        data = comment.split("|")
        para[0] = data[1].split("[")[1].split("]")[0]
        for i in 1...para[0].size
          para = para[0].split(",")[0]
          para[0] = para[0].split(",")[1]
        end  
      end
    end
    return para
end
[/rgss]
ive got more code, i just wanted to know if you have any issues with me simply cutting up the input from the comments. also i have no idea where to start to make it so when you activate the event it will open my window....
 
how do you feel about this blue?

[rgss]#--------------------------------------------------------------------------
  # * Check for chest comments
  #--------------------------------------------------------------------------
  def check_comments
    @items = []
    @weaps = []
    @armor = []
    @cut = 2
    @count = 0
    for ec in @list
      # Skip if not comment or not comment next line
      next unless [108, 408].include?(ec.code)
      # Read Event Comment & Turn Downcase
      comment = ec.parameters[0].downcase
      # If Comment Include Parameters
      if comment.include?('item|')
        # Remove starting info
        @data = comment.split("|")
        # Grab Items data
        @data = @data[1].split("[")[1].split("]")[0]
        # Loop through each item. good to know it counts how many loop based on
        # the number of commas. was a pain for me get the right number to loop
        # untill i remembered the count method.
        for i in 0...(@data.count(","))+1
          @items = @data.split(",")[0]
          @data = @data.slice!(@cut...@data.length)
          @count += 1
          # account for double digits.
          if @count == 9
            @cut = 3
          end  
        end  
      end
      # end items start weapons, reset @cut and @count
      @cut = 2
      @count = 0
      if comment.include?('wep|')
        # Remove starting info
        @data = comment.split("|")
        # Grab Weapons data
        @data = @data[1].split("[")[1].split("]")[0]
        # Loop through each weapon. good to know it counts how many loop based
        # on the number of commas. was a pain for me get the right number to
        # loop untill i remembered the count method.
        for i in 0...(@data.count(","))+1
          @weaps = @data.split(",")[0]
          @data = @data.slice!(@cut...@data.length)
          @count += 1
          # account for double digits.
          if @count == 9
            @cut = 3
          end  
        end  
      end
      # end weapons start armor, reset @cut and @count
      @cut = 2
      @count = 0
      if comment.include?('armor|')
        # Remove starting info
        @data = comment.split("|")
        # Grab Armor data
        @data = @data[1].split("[")[1].split("]")[0]
        # Loop through each armor. good to know it counts how many loop based
        # on the number of commas. was a pain for me get the right number to
        # loop untill i remembered the count method.
        for i in 0...(@data.count(","))+1
          @armor = @data.split(",")[0]
          @data = @data.slice!(@cut...@data.length)
          @count += 1
          # account for double digits.
          if @count == 9
            @cut = 3
          end  
        end  
      end
    end
    return @items,@weaps,@armor
end
[/rgss]
 
I think this script would be great if the player could move items, weapons, and armor from their inventory to the chest/stash and vise versa. I also couldn't help but notice that the chest graphic stays open if the player does or does not take an item from the chest; I find that kind of odd.
 
I'm sorry for repeatedly looking at this now, however didn't get to reply (as I know it'll take me some time >> ) Expect a reply around lunch break time today from me :p
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top