| 09-29-2002, 07:30 PM | #1 |
Guest | Here’s my attempt to provide a method allowing Heroes to 'carry' more than six items. It’s almost working, but after 10+ hours of trying multiple methods, I’m stuck and I need an expert’s help. (Also, my brain hurts, but Arnold assures me “It’s not a tumor.”) The idea is simple: I use a few arrays to hold the names of the items and the quantity of each item. Instead of putting an item in the on-screen inventory, I simply move it into an array. All of this works just fine. The only caveat is in the Retrieve Item trigger. To get an item from the “hidden” array inventory, I allow the user to enter a chat string, then I create an item matching what the user wanted, then try giving that created item to the Hero which should put it into his on-screen inventory for use. Unfortunately, the first Event for this entire process is based on Unit Acquires an Item, so when I try to Give an Item, the Update Inventory trigger fires and puts it right back into the array. The problem is obvious, but I could not find an Event other than Unit Acquires an Item that will work. I tried the Unit event Is Issued an order targeting an object, but the World Editor recognizes many non-items as objects also, such as buildings, trees, etc… Anyway, here is the file. I was really hoping to provide a finished, working project for everyone to use, but now my brain is fried. I’m relatively new to editing, (two months), so I know there are probably easier methods to accomplish increasing the inventory from 6 items. Please let me know if I’m just spinning my wheels trying to do what has already been done. Otherwise, I appreciate any and all comments, criticisms and code ideas to get this thing working. If interested, just download the file Unlimited Inventory Attempt.w3m, then run it, select your hero, pick up a few items, then access your hidden inventory as follows: To see a text display of your unlimited inventory, type <Enter> "+" <Enter> (i.e. Hit the Enter key on the numberpad, then the plus sign key right above it, then Enter again.) **To retrieve an item and put it into an inventory slot, type <Enter> "+#" <Enter> (i.e. If you want to use the 4th item from your onscreen list, you would simply hit the Enter key, the plus sign key, then the number 4 key, then Enter.) **This is the step that doesn’t work. It simply adds another item to your hidden inventory. Note 1: I’ve loaded only six items into the array, the same six placed on my test map. If we can get this thing to work, I’ll do all the coding necessary to get the other 100+ items loaded into the array. Note 2: I have not added the code to check whether an item is in inventory, nor have I coded to have the item removed from inventory once retrieved. I decided to see if this worked before the fine tuning. Thanks to everyone in advance for any help!! |
| 09-29-2002, 07:43 PM | #2 |
You can stop your trigger from firing by adding a condition: A variable must be a certain value to fire the trigger. Whenever your other trigger creates an item to a hero, you just set the variable to the value that the other trigger won't run. After creating the item, reset the variable. Example: Trig 1: Event: Item Acquirement Condition: myVar is 0 Trig 2: Actions: set myVar to 1 Create Item for Hero set myVar to 0 Is this what you were asking for or did I get you completely wrong? |
| 09-29-2002, 08:24 PM | #3 |
Ganon found the best way IMHO (he didn't think of it though -- someone else I can't remember did), which is to have two items that are left and right arrows in item slots 5 and 6. Then setup triggers to detect them being used and cycle through groupings of 4 items. I haven't seen a map with it yet but it would look quite nice :) |
| 09-29-2002, 09:06 PM | #4 |
My bag system works quite well for the lazy... |
| 09-29-2002, 09:19 PM | #5 |
Guest | An amazingly simple solution. I couldn't see the forest... I was hocked on trying to use the user's chat entry as the condition. Your idea works just fine, of course. I'm back at work and hope to upload this working map soon! |
| 10-13-2002, 05:19 AM | #6 |
Guest | My Classic Dungeon map uses this method. The trickiest issue is when players decide they want to move the cycling buttons around. Its posted in the Retail Maps Forum. http://wc3campaigns.com/forums/showt...&threadid=2785 |
