I'd say, based on that error message, that the problem is caused when you try to use eModeInteract on the items in the second inventory. By default that'll set player's the ActiveInventory, obviously giving you the error you're getting if the player doesn't have the item - and potentially causing weirdness if they do, switching their ActiveInventory at the wrong times. Other cursor modes should work, though, so how is your dummy inventory set up - is it possible to just not allow the player to use eModeInteract on it? If so, that's probably the easiest way to go.
If not - if it's displayed on the same GUI as the player's inventory, for example - then yes, you're probably going to have to use 'Handle inventory clicks in script". What you do then, depends on what you what to happen. I think this code, pasted into on_mouse_click, will match the way it works by default, minus the crashing
Code: ags
(Works for me, under very quick testing...)
EDIT:
To add 'right-click = Look', which I'd forgotten about...
Question to other AGSers:
That else seems a little clunky, but there doesn't seem to be an InvWindow.GetAtScreenXY that you could use to simplify it. Am I missing something?
If not - if it's displayed on the same GUI as the player's inventory, for example - then yes, you're probably going to have to use 'Handle inventory clicks in script". What you do then, depends on what you what to happen. I think this code, pasted into on_mouse_click, will match the way it works by default, minus the crashing
if (button == eMouseLeftInv) {
InventoryItem *InvAt = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (mouse.Mode != eModeInteract) InvAt.RunInteraction(mouse.Mode);
else {
GUIControl *tempGC = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
InvWindow *InvOver = tempGC.AsInvWindow;
if (InvOver.CharacterToUse == player || InvOver.CharacterToUse == null) player.ActiveInventory = InvAt;
// CharacterToUse = null means the InvWindow follows the player character if you change them in-game, rather than sticking with a specific char
}
}
else if (button == eMouseRightInv) {
InventoryItem *InvAt = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
InvAt.RunInteraction(eModeLookat);
}
(Works for me, under very quick testing...)
EDIT:
To add 'right-click = Look', which I'd forgotten about...
Question to other AGSers:
That else seems a little clunky, but there doesn't seem to be an InvWindow.GetAtScreenXY that you could use to simplify it. Am I missing something?