*This script has been taken down due to some major bugs. It is being rewritten and this thread will be revived once it is complete*
Grid Inventory
Version: 1.0
Author: modern algebra
Date: Novemeber 3, 2007
Version History
- Version 1.0 - Original; all current features
Description
This script does multiple things. First: it gives each actor their own inventory. Second: that inventory is displayed through a grid, with each item taking up a specific amount of squares. How many squares is completely customizable for each and every item. You are also able to set a maximum number of instances of that item each slot can hold. This means that for each item, say for instance, arrows, you can define how many arrows could fit into one displayed slot of arrows. See the demo for clarification. You can also set a picture graphic for each item, though it is not necessary. Beyond that, you can easily set up permanent storage events, each of which are easy to set up and save what items are stored in them at any given time. Items will be automatically distributed amongst the party. If, upon gaining an item, you cannot fit that item or items into the party member's inventories, it will call up a loot inventory and you can decide which items to discard and which to keep. As well, you can customize the size of each actor's inventory and you can modify that at any time with a simple script call. A good system to compare this to is the system from Betrayal at Krondor, as that is what it was based on, but as that is not very well known, this system is similar to the item system of the Diablo series.
Features
- Limited Inventory
- Each actor has his own inventory, and the size of his inventory can be changed at any time, to a maximum of 12 x 12 slots
- The inventory is displayed on a grid. Through this grid, you can move, discard, equip, use, transfer items to another player, and view detailed information on each item.
- You can customize the exact number of squares each item takes up, as well as the maximum stack size. You can even set a picture to represent that item in the inventory.
- You can set permanent storage chests which can not only come with items for the party to retrieve, but also allows the party to store their excess items. You can also set the exact size of these storage boxes.
- In battle, each actor can only use what items are in his inventory, thus adding some strategy to any battle system
- And much more...
Screenshots
Aluxes' Inventory
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg68.imageshack.us%2Fimg68%2F1345%2Fgridscreenshot2nw1.png&hash=a9513e5620c2ca3270b81676726936e99779a4eb)
The command options
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg222.imageshack.us%2Fimg222%2F1492%2Fgridscreenshot4zz5.png&hash=aa905774276bf3f3c54721fce16c995b97b02e4c)
The other command options
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg221.imageshack.us%2Fimg221%2F5448%2Fgridscreenshot3ln4.png&hash=2dd84b2a0db0fe615656142399beefaeb367742f)
Moving an Item
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg221.imageshack.us%2Fimg221%2F2535%2Fgridscreenshot7ty4.png&hash=731c275464e8c6ce87c661db9373f054d99f6144)
The Item Details Window
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg68.imageshack.us%2Fimg68%2F3439%2Fgridscreenshot1iw7.png&hash=2573911dba87654af0688f5889388f297c894099)
Transferring an Item
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg221.imageshack.us%2Fimg221%2F1776%2Fgridscreenshot5zc1.png&hash=128bc4160149b2db89932f52d5bec4d972f6e11d)
Discarding a battle axe
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg221.imageshack.us%2Fimg221%2F5792%2Fgridscreenshot6ex1.png&hash=d3a4935b59e71a3b4102e73f9353c8653dbde3fc)
Instructions
It's pretty simple. Basically, you need to put the script provided above main. Then, get my Paragraph Formatter (http://rmrk.net/index.php/topic,22215.0.html) and put it above this script. It is important that you get that! The script will throw errors at you without it. Get the facade as well. It is in the topic right underneat the script. Then, you will notice at the top of the script there are three Constants to be set, ELEMENTAL_ICON_ARRAY, DEFAULT_GRID_WIDTH, and DEFAULT_GRID_HEIGHT. Set those as you please. The more difficult part comes with defining the widths, heights, and maximum stack sizes of the items. This is done through a text document called Item Data. You can do this in two ways.
(1) By using the Item Data Generator attached. This is a visual way of seeing what you are doing. Download it and instructions are inside. This way iss best if you need to define a majority of the items. Basically, all you need to do is copy your databases into the Item Data Generator and run it, setting input where it is necessary. I used cybersam's keyboard script for the input of it, so thank him when you are using it.
(2) Manually, by modifying the text document itself. This is best for minor revisions and additions. Basically, the text document is set up like this:
Items
100,200,100,
1,1,5,
1.2,5,
...
Weapons
150,240,35,
1,4,1,scimitar.png
1,4,1,
...
Armors
100,100,100,
3,4,1,
4,3,1,
...
What does that mean? Basically, the headings Items, Armors, and Weapons signify that the numbers below it will correspond to Items, Weapons, or Armors. The next three numbers are the color you associate with that type of item. The first number is red, the second is green, the third is blue. You can experiment with these colours to determine which ones should represent which grouping of items. All the lines following that and before the next header (or the end of the file in the case of Armors), correspond to each item, weapon or armor ID. Therefore, the line immediately following the colour corresponds to Item # 1, the next to Item #2, etc... Basically, the first number in each line is the width of the item (in squares, not in pixels), the next number is the height, the third number is how many of that type of item can fit into one stack, and then, you can put the name of the picture to associate with that item. If you leave that blank, then it will just use the icon. Any picture name you put there should have the extension, and the file ought to be in the pictures folder of the graphics folder. If not, you will get errors. Also, there should be three commas on each line, or else you might get an error. Always put it like this:
1,2,1,
and never
1, 2, 1
The text file should be named Item Data. If it is not, you will get an error. A sample Item Data text file is included in the attachment at the bottom of this post. I recommend you follow that as a guide whenever you manually edit your Item Data text file.
You also need to have a png called Loot Bitmap in your pictures folder. I will eventually release a full pack of item pictures, and include a few good ones for loot, storage, etc...
Script
Too long. See attached.
Credit
Support
Contact me here or at RMRevolution for support on this script. I will fix any bugs for you, and I am willing to integrate the script into any CMS you might have. I likely will not write anything extra that you may suggest, unless it is something I can use for my game. I already have a few parts of this script I am not releasing, because I plan on having them in my game.
Known Compatibility Issues
No known compatibility issues, but probably some exotic CMSes, CBSes, and the SDK. I have not tested it with any of those though. This will not work for old save games.
Demo
See Attached.
As well, there are a few sample item pictures, a sample Item Data.txt, and the Item Data Generator included. The demo includes instructions on some of the functions of the script, like storage boxes and resizing actor inventories.
Well, the demo is open I believe. If you take a look at the chest, you will see the code is like this:
i = [[1,1,2],[0,5,8],[1,5,3]]
s = [7,7]
n = 'Wooden Chest'
b = "Loot Bitmap.png"
$game_system.item_storage.open(0, i,
s, n, b)
What each of the letters is is explained inside the chest event through comments. In short, s is the size, x by y. n is the name, b is the picture, i are the items.
Each item is represented by a 3 element array designed like this: [type, item_id, amount], where for type: 0 => Item, 1 => Weapon, 2=> Armor, and the item id is the ID of it.
The first number when you open the chest is the ID of the chest.
@pliio I am glad you like it.