Forum rules - please read before posting.

Examine an inventory item with left-click

Hi there!

I'm currently using a 'Monkey Island-like' interactions system (first interaction, then hotspot). I have some verbs on screen and the player has to click on Use in order to select an item of the inventory, as I didn't want items to be automatically selected when left-clicking on them (too comfy!).

But now, I'd want the game to provide the description of the items when left-clicking on them. In other words, I want the "Look at" interactions to start at that moment… but I'm not seeing a way to do so.

I tried using the Single interactions method and also overriding a context sensitive inventory via custom script, but that won't let me use my on-screen verbs with the inventory and the Examine interaction would only work with right-click. Any ideas? 

Thanks!


Comments

  • This can be done by using the OnMenuElementClick event to check if a left-click is made on the inventory menu element with no cursor icon or selected inventory set, and examining the clicked item in that instance.

    Try this code, by pasting it in a script named ItemExamineLeft.cs and attaching it to an empty GameObject in your scene:
    http://pasteall.org/896645/csharp

    More on custom events can be found in the "Custom events" chapter of the Manual.
  • Hi, Chris, thanks for your reply.

    I followed your steps and tried the code, but I didn't manage to make it work (I guess I did something wrong). Actually, when the script is running, the inventory will ignore every interaction or click.

    These are my settings: https://i.imgur.com/Fl1S88h.png
    My inventory box: https://i.imgur.com/gxs07MV.png
    And my Empty Object: https://i.imgur.com/ag7ITVn.png

    Please, let me know if you see something odd.





  • Apologies - I meant to say: the script refers to your Menu and InventoryBox elements by name, so you'll need to update them to match yours.

    Change "Verbs" to "Inventory", and "Inventory" to "InventoryBox".  The script was assuming you were using the nine-verbs template.
  • Yep, that was it. It's working fine now.

    Thank you, Chris!
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.