character.HasInventoryItem [solved]

Started by TheJBurger, Mon 25/02/2008 19:59:29

Previous topic - Next topic

TheJBurger

Okay, I feel like I'm doing something stupid, but I can't find a command to the effect of:
Code: ags
character.HasInventoryItem[iItem]


The closest thing I found to this was a command called character.InventoryQuantity, but when I use it, it gives me this error.

Code: ags

if (player.InventoryQuantity[iLockPick] == 1) { // player has the lock pick?
// do stuff
}
else {
  // do other stuff
}

That code doesn't work. It gives the error
Code: ags
Error: Type mismatch: cannot convert 'InventoryItem*' to 'int.'

Is this the right command I'm supposed to be using? If so, how do I fix it?

GarageGothic

The problem is that you're using an inventory pointer as an index. What you want to do is:

Code: ags
if (player.InventoryQuantity[iLockPick.ID] == 1) { // player has the lock pick?


SMF spam blocked by CleanTalk