I'm trying to make an inventory system similar to "Day of the Tentacle", where I can use items on "Switch Player" buttons to swap them over.
I've had moderate success by setting up the "Switch Player" buttons as a separate inventory and using combine events to trade items, but the main issue I ran into is that AC doesn't let me "Add" or "Remove" a "Selected Item" from one player's inventory to another. I need to script each item separately, which will eventually amount to a lot of iterations between players and items.
Am I missing something in AC that easily lets me transfer the "Selected Item" instead of specify 100+ different transactions? What's a better way to set up the exchange?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
You can simplify things a lot by relying on ActionList parameters for e.g. the "Item to add" and "Item to remove" fields, so that you can run a separate "Transfer Item" ActionList, setting the "Inventory item" property value at the time you run it.
However, it's probably easiest to just rely on a bit scripting.
To transfer inventory item with ID=3 from the active Player to a Player with ID=2, you just need to call:
To set the "itemToTransferID" automatically, you can map it to the currently-selected item or the last-clicked item:
How you set the "newPlayerID" would be down to how the code above is run. If the "Player icons" are connected to AC's menu system, you can do so from the OnMenuElementClick custom event.
Perhaps something like this:
Setting parameters seemed to do the trick. I have one ActionList that removes the item from all players when the ID is set, and three other ActionLists that give the items back to specific players. As long as I keep the lists up to date, it handles all the combinations very smoothly.
I can't get the script to compile yet, but I can give it another go when I have more time to learn C+.
Thanks again, Chris!