Intelligent Inventory
![SnowAppleMint](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
So I was thinking about making a game like everyone else here. I decided before I decide what type to make I should see what I am capable of doing programming wise. So my first attempt is an intelligent inventory. Say there are 3 items and 3 slots. If i pick up item 1 I want it to go into slot 1, if I pick up item 3 I want it to go into slot 2. And say I use up all of Item 1 in slot 1, then I want item 3 in slot 2 to move to slot 1.
I sorta got this to work, but it required a lot of hard coded rules which is where I think I am messing up (I can post my file if anyone thinks they can help)
The filling of the slots works, the only problem I am running into is this(sorry for the extremely long post)
So again lets say item 1 is in slot 1 and item 3 is in slot 2, so when item 1 has been used up item 3 does move to slot 1 BUT it also remains in slot 2....
Basically I have a bunch of game attributes like itemName1 itemQty1 itemFilled1 and slotFilled1
then I have actors for the slots, (the only attribute i have for the actors is an itemIndex for determining which item it was filled with)
when slotFilled1 = false
check if itemQty1 > 0 AND itemFilled1 = false
change self.itemIndex = 1
then display itemName1 and itemQty1
If itemQty1 >0 AND self.itemIndex = 1
change slotFilled1 = false
I also have rules that change all the itemFilled# to false as well
I probably went about this the most complicated way ever imagined XD. The only TRUE programming experience I have is with java and I must say I never thought I would miss those darn arrays.
Any help is appreciated![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
-I can post the file if anyone is interested in looking at it.
I sorta got this to work, but it required a lot of hard coded rules which is where I think I am messing up (I can post my file if anyone thinks they can help)
The filling of the slots works, the only problem I am running into is this(sorry for the extremely long post)
So again lets say item 1 is in slot 1 and item 3 is in slot 2, so when item 1 has been used up item 3 does move to slot 1 BUT it also remains in slot 2....
Basically I have a bunch of game attributes like itemName1 itemQty1 itemFilled1 and slotFilled1
then I have actors for the slots, (the only attribute i have for the actors is an itemIndex for determining which item it was filled with)
when slotFilled1 = false
check if itemQty1 > 0 AND itemFilled1 = false
change self.itemIndex = 1
then display itemName1 and itemQty1
If itemQty1 >0 AND self.itemIndex = 1
change slotFilled1 = false
I also have rules that change all the itemFilled# to false as well
I probably went about this the most complicated way ever imagined XD. The only TRUE programming experience I have is with java and I must say I never thought I would miss those darn arrays.
Any help is appreciated
![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
-I can post the file if anyone is interested in looking at it.
Comments
I never setup the moving of items from one slot to another when it becomes free. But I do have it working nicely.
Check out my 'Point and Click collectables menu template' if your interested... price just dropped to $30
Video shows it working.
http://gamesalad.com/forums/topic.php?id=16605&replies=12#post-183572
Good luck...
Jon from stormystudio.com
Kudos to your hard work
So far I'm not having much luck.
slot 2 will not fill unless slot1 is filled.
slot1 will not empty if slot2 empties, but slot3 will empty
see where I am going with this?
I think all my rules are strung out and thus overriding each other but I do not know how to 'contain' them and keep them 'looping' or constantly updating
1. Items in my inventory are placed in the order you take them.
2. If you take an item, you will see the appropriate information (which item did you get).
3. If you try to use an item in the wrong place, you'll get the appropriate info.
4. If you use any item, it will dissapear and other items will automatically move to cover the empty slot.
5. Player can take every item only once (so you don't get the same item on every slot).
6. It works properly after changing the scene.
7. If you choose any item in the inventory, it become highlighted.
8. You can choose one item. If an item is chosen, and you click the other one, then the first one become inactive.
9. Player is able to move items freely.
10. Player is able to close and open the inventory.
11. I use only 5 game attributes on the entire inventory, and items.
It was pretty simple, I made it in few days (but I have about 50 items).
I am especially interested in how you managed to use only 5 game attributes....
That does disappoint me. I was hoping for something a little less tedious. I will continue to try and flesh out what I have or scrap it and start over.
Has anyone used actor tags for anything useful other than collisions?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I was actually trying to think up some creative ways to manipulate actors with the actor tags(particular related to inventory management etc.)
Was just thinking out loud
thanks for the reply gyroscope