Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: YotamElal on Tue 08/03/2005 07:43:43

Title: lose inv not working? [SOLVED]
Post by: YotamElal on Tue 08/03/2005 07:43:43
In room3 in my game there are two hotspots that I use a inv on and the loseinventory isn't working????????? (REALLY WIERD)

code for hotspot 3 (if inv 10 was used)

MoveCharacterToHotspot(EGO, 3);
ObjectOn(8);
LoseInventory(10); 

object 8 turns on but inv 10 isn't lost???


code for hotspot4 (if inv 11 was used)

MoveCharacterToHotspot(EGO, 4);
ObjectOn(9);
LoseInventory(11);

object 9 turns on but inv 11 isn't lost???


Wierd...
I don't have any problems like that anyware else in my game.
Title: Re: lose inv not working?
Post by: Radiant on Tue 08/03/2005 08:04:26
Maybe the player was carrying multiples of item #10 or #11? If you call AddInv multiple times, then you do.
Title: Re: lose inv not working?
Post by: strazer on Tue 08/03/2005 08:06:32
Keep in mind that you can have more than one of the same inventory item, so if you do
  AddInventory(10);
  AddInventory(10);
you have two of these items, occupying the same slot in the inventory (Check "Display multiple inventory items multiple times" in the General settings pane to change that).
If you then do
  LoseInventory(10);
you lose only one of the two items, so you will still have the item in your inventory.

Are you sure you only have one of these items in your inventory?
As I said, check the option in General settings to verify.
Title: Re: lose inv not working?
Post by: YotamElal on Wed 09/03/2005 04:56:04
It's working and I have no idea what caused the problem & how it got solved.
Title: Re: lose inv not working?
Post by: on Wed 09/03/2005 05:55:56
It's probable that you did have more than one copy of the inventory item.  And perhaps inadvertently deleted one of the AddInv commands.  Glad to hear you got this fixed.  With no clue how you did it.