#Need help creating an interactive cockpit.

1 messages · Page 1 of 1 (latest)

molten shuttle
#

I have looked everywhere online for any tutorials but nothing works, I am currently working on a UH-60 black hawk and an F/A-18 super hornet, I want to make it so that you have to do a start up sequence, similar to this (https://youtu.be/n6j4eIWfzaU?si=4-6CE88vfANfaICM). Even just a step in the right direction would be great.

It's a simple, quick video on how to start up the A-10 Warthog in Blackhawk Rescue Mission 5. Special thanks to Hawisgood for giving me tips regarding it.

Be careful not to stall, it usually happens at ~200 speed or lower.

Tips from Hawk:
#1 Don't crash into something over 50 speed.
#2 It costs 12.5k to repair. (It now costs 1/4 of the origina...

▶ Play video
stone remnantBOT
#

studio** You are now Level 1! **studio

spring burrow
#

Click detectors

molten shuttle
#

or is it just a bunch of, if then, else's

hushed yew
#

Check the doc it will answer you question

spring burrow
leaden spear
# molten shuttle Do you know a way to make them have to be clicked in an order to work?

There might be a better way but heres an idea.

Create a stack of the players button presses: {}
Whenever the player presses a button, append to the stack.

If the player clicks the power switch, clicks the fuel switch, clicks the light switch, and clicks the ignition key you'd have: {"power_switch", "fuel_switch", "light_switch", "ignition_key"}

From there you can define sequences of inputs that will do things.

local sequences = {
  {"power_switch", "fuel_switch", "ignition_key"} = function()
    print("Starting the plane!")
  end,
  {"light_switch"} = function()
    print("Turning the lights on")
  end,
  {"mystery_button", "ignition_key"} = function()
    print("easteregg")
  end,
}

Then whenever the player presses a new button, try and match their stack of button presses against all defined sequences

-- Store a table of each sequence's path and how far it is completed
local working_sequences = {}
for path, callback in sequences do
  working_sequences[path] = 0
end

-- For every action in the stack
-- In example stack is
-- {"power_switch", "fuel_switch", "light_switch", "ignition_key"}
for _, action in stack do
  -- For every sequence that hasn't been completed
  for path, depth in working_sequences do
    -- If the current action in the stack matches the next
    -- action for this sequence, increment it
    if action == path[depth+1] then
      working_sequences[path] += 1
    end
    -- If this sequence's depth is at the end,
    -- that means its complete and we can call its
    -- action and remove it from the working table
    if working_sequences[path] == #path then
      action()
      working_sequences[path] = nil
    end
  end
end

-# bit messy, might be bugs. Just a proof of concept

This could be expanded to cause some sequences to fail if an invalid key is pressed or if one of the keys in its chain are pressed in the wrong order. The current system is very lenient but I'm sure you can build off it.