Download

Framework for puzzles

Hey guys, I want to make a couple of FPS puzzles - like connect the right wires, press buttons in the right orders, etc. I’m testing and doing initial blueprints by making a coin-operated binoculars like these first (there are three steps - insert coin, push lever, look through).

My question is, what’s the best way to approach setting up master blueprints and systems for this first puzzle, that will also give me flexibility for anything later on? I need basically to add interaction (like playing animations, changing cameras, moving meshes) when parts are clicked.

Here’s what I’m doing so far:

  • initially, the mouse cursor is hidden and players zoom in first on the binoculars (camera is changed, fixed, movement and mouselook is disabled and cursor is visible).

  • a master Trigger BP that has a box trigger - on mouseover, I change the cursor to show that its interactable. I also have an Interact Event when the trigger is clicked. Also I setup variables for text descriptions when player is clicking. These might also show and complete some objectives in the HUD.

  • the actual binoculars BP that has the meshes (both static and skeletal with animations) as well as child actors with these master Trigger BPs. Now everything works fine so far, cursor changes on mouseover and clicking them show texts, but how can I access the clicked events to make them do things inside the binoculars BP? The only way I figured out is by casting these child actors to the trigger BP at BeginPlay and defining them as variables, then binding event dispatchers for each one like this. Is there a better, simpler way to do it? Some later puzzles might have 1 trigger, some might have 8 or 10 and it will get messy.

  • I’m having a hard time figuring out how to properly add functionality from the triggers to the binoculars BP, for example you can click and hold one trigger to rotate the binoculars left and right. I used Tick, and a gate, with the event dispatchers in the master Trigger for clicked and released events. Is there a simpler way? I’d like to use the Left Mouse press and release events to do it. I imagine a bunch of boolean checks to see what (if) triggers are clicked? One issue was that holding click and leaving the trigger box, then releasing the mouse would not call the release event (because the mouse is not on the trigger anymore) so the binoculars would continue to move while the player moved the mouse.

  • Let’s say the puzzle is solved - the player inserts the coin, clicks the levers and looks through, would I need to setup a “completed” state or event where the triggers (and everything on Tick) are disabled?

Any thoughts? Thanks!