|
Developed by: Tyrsis
Special thanks to: Ted Shutes, who tested it and fixed some errors in this product and added new items. Here you may read his notes on the subject. This is a micro-DMod designed specially as a sample and description of the New Dink Inventory System. It is small and does not include description of maximum possible number of items. It has absolutely no plot. The first screen has two warp machines and a savebot. To get an explanation, talk to te wizard. After that use a warp machine to test one of the
auxiliary inventories:
The system description. This system limits its needs for global variables by using only 1 bit per kind of weapon or item. It takes the form of a trunk that Dink carries around or stationary treasure chest Dink can visit from time to time. Nothing prevents you from having identical items in the inventory and in the trunk, but you can't put 2 of them in the trunk, except for items that are "countable" - e.g. you may have any number of healing potions or bombs. You may have items that cannot be stored in the trunk and let player dispose of items he doesn't need. So Dink may carry 16+8 kinds of items in the active inventory and 30 kinds more in the trunk. It is quite a lot for any reasonable DMod. The trunk may be carried by some friend of Dink. I am working on it. Special thanks to: Ted Shutes, who tested and fixed some errors in this product. Please read the checklist file he wrote for you while testing this system. It should help you in applying the system to your DMod. The inventory demo has two parts:
|
2. Countable items (e.g. healing potions) occupy
one inventory slot per kind (see: item-eli).
The number of the countable items of one kind
is virtually unlimited. You may have 2000000000 bombs if you wish.
3. Speed boots, armour, etc. work (as though they were actually armed) when they are in the active inventory and are disabled when put into the trunk (see: item-bt).
4. Currently armed item may be dropped (X key) or put into the trunk (G key). Fist excluded. If you drop an item it is lost forever.
5. Items in the trunk may be moved to the active inventory (key N).
6. The trunk contents may be browsed (left/right keys, cycled) and moved back to the inventory (down key). Up key stops the process and closes the trunk. Graphics included.
7. Global vars used:
a) All trunk contents are stored in one var,
one bit per item kind:
make_global_int("&chest_cont",0);
b) Current item's code (1 - 31)
make_global_int("&chest_item",0);
// weapon item code
make_global_int("&chest_magic",0);
// magic item code
c) Globals needed for item bit functions:
make_global_int("&chest_have",0);
// item exists in the trunk
make_global_int("&chest_base",0);
// value added to &chest_cont when item is put there
make_global_int("&chest_edit",0);
// item icon sprite number for item browsing graphics
d) Countable weapon: counters here
make_global_int("&elixirs",0);
// number of healing potions in Dink's inventory
make_global_int("&elix-tr",0);
// number of healing potions in Dink's trunk
If you prefer having countable
items in the active inventory only, don't assign &chest_item to it.
It will not require the second counter (&elix_tr) then. Thus you will
have 1 inventory slot occupied by all elixirs, regardless of keeping them
in the trunk or not.
8. Scripts used for trunk handling are assigned to
the keys:
key-71 (G) - put current
item into the trunk
key-78 (N) - browse the
trunk
You may change the key assignments if you wish.
9. Item script modification needed:
a) void arm(): set &chest_item
to item code value. For countable items, make Dink tell how many he has
(see: item-eli).
b) void disarm(): set &chest_item
to 0.
c) void use(): for countable
items that are usually removed from inventory (see: item-eli) decrease
their quantity (&elixirs) and kill item if 0.
10. Item codes are used to define:
a) item script and icon sprite
when taking it from the trunk (see: key-78, void getitem)
b) item icon when browsing the
trunk contents (see: key-78, void main).
11. Local vars used:
key-71 - 2 vars
key-78 - 7 vars
12. To set the contents of the trunk use filtrunk.c
(set &chest_cont). It must be sum of the item "base" values for all
items. For the stationary chest dchest.c was used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you want to make a chest with items coded 3 and 6 - set &chest_cont to 4+32+1=37.
13. To put a stationary trunk out of Dink's reach,
set &chest_cont to the negative of its
value (see: notrunk.c).
When Dink returns to it, repeat
the procedure, e.g. use it in the screen's base procedure.
14. Trunk condition:
a) &chest_cont = 0 No trunk at all
b) &chest_cont = 1 Empty trunk
c) &chest_cont >= 2 Trunk with items
d) &chest_cont < 0 Stationary trunk
out of Dink's reach
Feel free to mail
me if you have problems with this system.