Forum rules - please read before posting.

Drag n drop menu

I want to create a menu that controls books on a shelf. There are seven books on the shelf and they themselves are not interactable items.
Player should set the books in correct order for them to activate book shelf door. And I thought a drag and drop menu with seven slots would work. And then player drags a book menu item to another spot, it swaps the books positions - and this also correlates with the 3D items.
I looked at the menu examples of AC, but didn't found anything that I could straightly relate to this idea.

Comments

  • edited July 2022

    This would be a 2-part problem - the first being the menu, the second being the syncing of the book objects with the menu.

    The second would involve a simple script to move object positions according to the state of a menu, but you'd need to sort the menu first.

    Unless you went for a totally custom menu, likely the best way to handle this would be to use AC's drag-and-drop inventory system. If you created an Inventory item for each book, placed them in a Container, you could then display those items in a specific InventoryBox element via the Container: Open Action's Open in set element? option.

    If the Settings Manager's Items can be re-ordered in Menus? option is checked, you can move items into empty slots. Try it with an InventoryBox element of the type "Container", and with Prevent interactions? checked, and Click behaviour set to Select Items Only. If you need the behaviour tweaked, describe the intent in detail and we can look into what needs changing.

  • I eventually went for a Hotspot in a book position style approach, but there's no script selection for interactions. Should I just create a script with ray casting and do the logic there? Or is there a way to use AC components?

  • So the idea is when player clicks a book position, the book in that position is turned off and cursor changed to that book. Then when clicking another position it will swap the books in the positions.

  • You may find the "Puzzle template: Item arranging" package on the Downloads page to be a useful starting point.

  • I'm using EventManager to handle book Hotspot interactions. I just don't want them to be set all the time. I was wondering what would be a solid solution to manage the delegates.
    Would a simple setup/exit function before and after book shuffle game be sufficient?

  • It could be, but it might be better to check the value of e.g. a Global Bool variable in your event hooks so that the state of it gets stored in save-games correctly, i.e.:

    if (!GlobalVariables.GetVariable ("BookPuzzleIsOn").BooleanValue) return;
    
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.