| 01-11-2006, 04:45 PM | #1 |
Here's the situation: I'm making a custom inventory where you have to equip the item to use the bonus (think Diablo II). I know it's already been done and I think I could read the codes in InvX or DT4A, but I'm interested in doing it myself and learning along the way. InvX and DT4A are just a little too complex for my needs, I'd like something simple to use for both the player and me. Here're the questions: 1) Since the items should only give their bonus when equipped, the items that are dropped for the player to pick up should just be dummy items right? Such that they don't do anything until left-clicked to be 'worn'? 1b) After it is worn, I should use weaader's Bonus Mod to apply whichever bonuses right? 2) I'm thinking of using game cache to store a large 2D array of items and effects. I've been reading a ton of threads and not finding enough info on how to go about it. Most people use the cache for saving heroes between maps, but I know Vexorian and others have used it for a 2D array, just can't seem to find the related threads/info. Do I fill the entire array at 0.01s after game start? There's some limit to cache size too right? 3) Storing of items. I'm trying to decide whether it'd be better to save the item or the itemtype when I remove the item from inventory to 'wear' it. Are there any specific pros/cons of either method? I'm not thinking of socketing or runewording at the moment, but if storing the item itself is more effective then I'd rather learn that way. 3b) If I save the itemtype, I can just delete the item. If I save the handles, I should drop the item and hide it. Are there any adverse effects to either or anything I should note to reduce lag or leaks? 4) Lastly, to store the items that are worn on the players (7 players max), should I use item/itemtype global vars or something about I2S(H2I(xxxx)) with game cache? I mostly get what's happening, but I'm wondering about ease of use and possible lag? I read somewhere cache is 4 times slower than globals, but then again I wouldn't be changing equipment terribly often, so it shouldn't matter right? ---^--- Thanks for taking the time to read the long post :) |
| 01-11-2006, 07:27 PM | #2 |
1) Yes. 1b) Sure, or you could write your own methods :P 2) I'm not sure why you have to use a game cache unless you exceed 8192 items in the array. If you do somehow manage to surpass that, then by all means go with the gamecache. 3) If you save the actual item, you keep the cooldown and quantity. 4) Only if you pass the 8192 values of global variables. |
| 01-11-2006, 10:20 PM | #3 |
you know that 4 times slower is not that slow? And it doesn't have anything to do with indexes and limits, fact is that it can be easier to make with gamecache and also faster if you know what you are doing. Specially since you want the items to give bonuses, listen, you need a way to register the bonuses of the items, if you do so with an array it will blow your map's performance away, you have to use gamecache. |
| 01-12-2006, 02:04 AM | #4 |
Thanks a lot! I read through most of the comments in InvX and related threads so I kinda figured Cache would be required/recommended. I guess I'll try to understand all the funny stuff you have in there :) qn: why do we save the handle as I2S(H2I(xxxx))? Is there a reason why we keep it in a string and not, say, integer? Thanks for your responses! |
| 01-12-2006, 02:07 AM | #5 |
because gamecache store/load functions take strings as arguments |
