Problem with "Interact Inventory Item"

Started by , Wed 16/11/2005 12:43:01

Previous topic - Next topic

PennyLane

Hi,

I have a suitcase in my inventory which I'd like to open upon "Interact Inventory Item". The problem is that nothing I put under "Interact Inventory Item" will be executed. When you click on the inventory item with the interact cursor active the cursor changes to the image of the inventory item, which is OK for most of the inventory items but for the suitcase I'd like to change this default behaviour. How can I do that?

Thanks for helping,
PennyLane

petazzo

Use Talk to and not Interact with the item.
I never forget a face, but in your case I'll be glad to make an exception.
(Groucho Marx)

Ashen

#2
To explain: the default AGS behaviour is that using eModeInteract on Inventory items sets them as active inventory, and there's no simple way to get round this - other than using a different cursor mode, as petazzo suggests.

However, if you do that, remember that you'll need to set all the other items to become active inventory when you 'Talk to' them. The easiest way would be using unhandled_event, e.g.:

Code: ags

function unhandled_event(int what, int type) {
  if (what == 5 && type == 2) { //'Talk to' inventory
    player.ActiveInventory = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
  }
}


Rather than manually adding the command to every item's 'Talk to inventory item' interaction. (Or whatever mode you choose to use.)


You could also use the 'Handle inventory clicks in script' option, but that's a lot more work, for the same result.

I know what you're thinking ... Don't think that.

PennyLane

Thanks for your help. Meanwhile we have found another very inelegant yet effective solution  ;D

PennyLane

SMF spam blocked by CleanTalk