In my game, I have a table on which I can drop a specific item type. The player has to drag and drop the item from his inventory onto the game object in the environment, and that will trigger a "Drop" Event Interaction on this game object. Right now, since I selected "1" as "quantity" in the Event Interaction component properties of the Unity Inspector, ORK checks if there is at least 1 object of the specified type in the inventory and triggers the event if so.

However, what I'd like to achieve is to trigger the event as soon as the player drops at least one item of the specified type on the table and then, display the quantity dialog to have the player choose the quantity he wants to drop.

I thought there would be an Event node for that, but I failed to find it... I also checked the Item Collectors stuff, but it didn't work neither. Can somebody help me on this?

Thanks!
  • Don't enable the Consume Item option in your drop interaction and the item will still be in the inventory and you can do the rest via the nodes, e.g. using a Select Item node to get the items in the inventory, a Store Selected Data Quantity node to store the quantity into a variable and finally using the variable in a Value Input Dialogue as max value for a float variable to select the quantity.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 2021
    That is simply great! Event nodes can be so powerful if you know how to use them wisely... Many thanks for this elegant solution!

    Now, I try to standardize my event so it can work with different Drop interactions. I thought I could use a float object variable on the Event Interaction game object, with the ID of the dropped object and use the Select ID node to get the corresponding item. It works quite well, but it requires me to add this (redundant) object variable for each Drop Event Interaction. I wonder if there is a more direct way to pass the item selected as the "Dropped object" in the Event Interaction component to the event... I could then reuse the same Event for most of my drag and drop interactions.

    Maybe I should run a C# function that would detect the type of the current Event and, if it's a Drop type, pass the ID of its dropped item to a global ORK variable that could be fed back into the Select ID node? Is that possible? Any better solution?

    Thanks again!
    Post edited by ArsMagika on
  • I'll look into it for the next update, maybe pass on the dropped item/ability via selected data (the usual action key).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Next update will add some new functionality to drop interactions. Beside forwarding the dropped thing to the started events using selected data (via action selected key), there'll also be new drop types for dropping Any Item, Any Ability or generally Any shortcut on it.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Wow! As usual, I'm impressed by the speed at which you address issues. I'm looking forward to implement these new features in my game!
Sign In or Register to comment.