------

Started by ------, Wed 26/10/2011 23:16:11

Previous topic - Next topic

------

------

Khris

Say your inventory item is called iYellowStone.
You can do this:
Code: ags
  if (player.InventoryQuantity[iYellowStone.ID] == 0) player.AddInventory(iYellowStone);


Since this is a bit technical, a new function was added some time ago: Character.HasInventory.
Code: ags
  if (!player.HasInventory(iYellowStone)) player.AddInventory(iYellowStone);

------

#2
---------

Khris

I just noticed you can also do this:

Code: ags
  player.InventoryQuantity[iYellowStone.ID] = 1;


The only difference is that setting it directly won't trigger the "inventory was added" event, but I figure you won't need it here anyway, if you're even using it.

SMF spam blocked by CleanTalk