Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Rui 'Trovatore' Pires on Mon 05/04/2004 18:53:13

Title: Help me perfect my multi-inventory system!
Post by: Rui 'Trovatore' Pires on Mon 05/04/2004 18:53:13
OK - I've got a problem. It's code-related, but I can't just copy/paste the code here, 'cause the problem may be caused by something else, and besides, it relies a lot on the context, so I've uploaded a template. Kindly download it and help me...

So I got three inventory "places", right? 1, 2 and 3 (in the game they'll represent containers). Now, I can switch through them and carry items between them, and I can even drop them in the room...

!!!BUT!!!

After messing with them awhile, I found out that they always ended up in the same order - first the oil can, then the broom, and then the lamp. Incidentally, that's their INV number - oil can is item #1, broom is #2, lamp is #3. This is the behavious I want to elliminate.
One of the things the current code does is get the 1st inventory item in the list via a GetInvAt command. I thought that wouldn't gibve me any trouble, since it processes the items in the order they are found in the inventory window. BTW, this also happens in the DROP inventory window.

One sidenote - this behaviour may be related to the function that is run when any given item is picked up - since some containers have limits and in order to put down the item (or try to) in that container the format used was "USE INV ON (itself)", I had to do it so that every time the player picks the item up, it is added to the other containers, and when he puts it down, it is removed.

...help please? It works very fine like it is, but it's not what I want, and I've run out of ideas. Please, ye sages of AGS scripting!...

http://www.agagames.com/redrum/problem.agt
Title: Re:Help me perfect my multi-inventory system!
Post by: Scummbuddy on Mon 05/04/2004 19:09:21
can you call a randomizer function to select where to put the inventory into what slot?

like when you go to pick up an inventory item?
Title: Re:Help me perfect my multi-inventory system!
Post by: Rui 'Trovatore' Pires on Mon 05/04/2004 19:13:33
No, cause when I mean "pick up" I mean get it from the inventory window. Anyway, the very same thing happens when the character gets an item from the ame world. Think Discworld I, wherev you have to place the item yourself in the inventory. And because of the container limitations, the player should be able to choose his own. It can't be random.
Title: Re:Help me perfect my multi-inventory system!
Post by: Pumaman on Mon 05/04/2004 20:47:10
When you switch between containers, does it change the player character?

The inventory window currently keeps track of the order that items are added to it, until such a time as the player character is changed, at which point the items switch back to the default order.
Title: Re:Help me perfect my multi-inventory system!
Post by: Rui 'Trovatore' Pires on Mon 05/04/2004 20:51:55
Ah! I didn't know that! Ok, I'll fiddle with it a bit keeping THAT in mind to see if I can work around it. If not, it'll have to remain as it is. Thanks!

EDIT - Hmm, I HAVE to change the player character in order to update the inventory in order to get the items by their wanted order (and there's no workaround THIS, even if I didn't use GetInvAt, anything I can use needs an updated inventory). CJ, could you change this behaviour, or make it "toggleable"?
Title: Re:Help me perfect my multi-inventory system!
Post by: Pumaman on Tue 06/04/2004 20:48:16
I'll add it to my list.
Title: Re:Help me perfect my multi-inventory system!
Post by: Rui 'Trovatore' Pires on Tue 06/04/2004 21:34:46
Oh by all means, add it to your list... but would it be too much to ask, if I were to ask you to add it quite soon?  ::)