Forum rules - please read before posting.

Passing items between players

Does Adventure Creator support passing items between players in any way?

I tried using an asset based actionlist with parameters with no success(I know it only supports passing the hotspot as a gameobject, but I tried my luck).

The thing is I could do it with using a custom script, but then I wouldn't be able to use actionlists for that hotspot anymore. Or did I miss someting?

My idea is to trigger either a script or a custom action via Unhandled inventory items to remove it from the current player and add it to the one with the hotspot attached.

Comments

  • As opposed to "passing" an item, you can use a pair of Inventory: Add or remove Actions - one to remove the item from the current player, another to add the item to a non-controlled player.

    If the item in question is known, you can set it in the Action's UI - otherwise you can rely on parameters.  I'll see about making this easier in the future, but right now you can hook into the OnBeginActionList custom event to set the ActionList's "Inventory item" parameter to match the last-selected inventory item.

    On mixing custom scripts with ActionLists: the Object: Call event and Object: Send message Actions can both be used to invoke custom script functions.  Alternatively, custom Actions can be plugged into your own ActionLists.
  • Thank you for your help. Since we still didn't update AC I couldn't use the BeginActionList  event.

    I made a custom action that assigns the last selected inventory item to the ActionList parameter. It now works as intended.
  • I had some issues regarding setting the count of items that have CanCarryMultiple checked. The issue is that since I am using parameters the Action does not know if the item can carry multiple and does not show the option to assign another parameter for the item count.

    I did resolve this by setting CanCarryMultiple of the 0th item to true since this item is set in the Action aparrently as default. It is a hack but I can't come up with any alternative at the moment.
  • What you could try, since you're relying on hacks / custom Actions, is to read the inventory item parameter directly - which is an integer, and set to the ID number of the item in question.

    You can then read the runtimeInventory component to get the actual runtime instance of that item:

    ActionParamter myInvParameter = myActionList.GetParameter (2); // Replace "2" with the ID of the parameter
    InvItem playerItem = KickStarter.runtimeInventory.GetItem (myInvParameter.intValue);
    int amountCarrying = playerItem.count;
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.