Forum rules - please read before posting.

Puzzle template: Item arranging question

Hi Chris and all!

With my embarrassing lack of coding ability I'm hoping I could get a bit of guidance please?

I've got the puzzle template working in my game and it works as expected. I disable the Player and Movement settings in an action list on start, and I haven't added hotspot highlights to any of the hotspots to get around the CHTI interaction method as I note this puzzle works using context sensitive. But, it seems to work fine.

My question is how to cement the pieces of the puzzle when they've been placed on the correct slot? Currently you can keep moving them, but I'd like them to stay put once they're in the right place. Is that easy to do? I presume I would need to keep the Initial Slot fields blank to achieve this? I guess I could set up boolean variables for each slot? But I'm really not sure how to go about this.

What I'm eventually hoping to do is run some animations when the pieces reach their correct slots. Again I can achieve this with bools.

Many thanks
Caroline

Comments

  • Good suggestion, and a simple tweak.

    I've added a "Lock When Correct" option to the piece component, which will prevent them from being moveable once placed in the right slot.

  • Oh wow! Fantastic, thank you Chris!
    There are so many possibilities with this template, it's such a good feature!

  • Works perfectly!

  • Ok, I can't figure out how I can run specific action lists once Lock when correct is ticked and the piece is locked in place while playing the game.

    For example, Piece 1 has correctly locked into Slot 1. I then want to run an animation (mechanim parameter change) on Piece 1 along with a bespoke sound effect loop. Is that possible without scripting?

    Many thanks
    Caroline

  • Just about. Open up the included ArrangingPuzzlePiece script and replace the line:

    if (button == null && selectedItem != null)
    

    with:

    if (selectedItem != null)
    

    That'll allow interactions to be run as well, so you can define an "Inventory interaction" on the Slot's Hotspot, match it with the correct Piece item, and have it handle the animation/sound playback.

  • Thanks Chris.

    Just tested it with a quick camera shake when the correct piece is locked into the correct slot. The camera did shake but I'm still holding that particular piece. I can right click on the mouse and it disappears but it would be slicker if the piece wasn't being held after the lock. Am I missing something I should include in the new inventory interaction?

    On the slot I'm choosing the inventory item associated with the correct piece. Is that right?

    Many thanks

  • Are you using drag-and-drop? The item should be de-selected automatically if so - otherwise, check the state of the Defined interactions deselect active item? option in the Settings Manager.

    You can also force item deselection with the Inventory: Select Action.

    On the slot I'm choosing the inventory item associated with the correct piece. Is that right?

    Yep, that should be it.

  • Face palm! It's working now.

    I completely forgot you can deselect Inventory. Thanks Chris! This will keep me busy for a while :smiley:

    Have a great week!

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.