Profile image

Damage activated buttons/lights

847 ZeroRaven87  1.9 years ago

For an aircraft design I’m working on, I was hoping to have alert switches trip if damage to a certain part is obtained.

cockpit

In the top left of the upper panel there are 2 red indicators labeled ENG1 and ENG2. I’m hoping to have them trip of damage to an engine reaches 50% or greater.

Could this be done using funky trees in a “ if partID health<50% set value=1 “ sort of thing?

  • Log in to leave a comment
  • Profile image
    26.0k Kendog84

    If you don't mind cluttering the weapons menu, you can use a cannon or missile (with very low explosionScale--but not zero) as the trigger for the alarm. To be more precise, their ammo count. Attach them to the part, name them "Wing left" or "Tail", and if they get destroyed with the part, their ammo goes to 0. And that will trigger the alarm.
    (You can use something like "clamp01(ammo("Tail")=0)" for the light's input (not the activationGroup))

    +1 1.7 years ago
  • Profile image
    6,378 11qazxc

    For "part" in general you can make light work always and attach sort of shutter to part you're interested in.
    So if part will be destroyed shutter will fall off and reveal light.

    +2 1.8 years ago
  • Profile image
    77.3k MrCOPTY

    @ZeroRaven87 Exactly, And.....What's This Smell?.....Oh Yeah My Brian Is Burning Because you move the throttle forward but not above 0%

    1.8 years ago
  • Profile image

    @MrCOPTY So the coding for the light works (unintentionally triggers when you move the throttle forward but not above 0% lol).
    The coding for the Button does bot seem to work for me.

    Engine part variable: (Trust: Eng1Thrust)
    Input for button: Eng1Alarm
    Variable: Eng1Alarm: (code)

    I kept the Eng1Thrust part variable since your code still calls for it.

    +1 1.8 years ago
  • Profile image
    77.3k MrCOPTY

    @ZeroRaven87 Work Only For Light, But For Button U Must Use This:

    .
    Button Input:

    .
    Eng1Alarm

    .
    Add A Variable:

    .
    Eng1Alarm : Fuel>0 & Throttle>0 & Eng1Thrust=0 ? 1: 0

    +1 1.8 years ago
  • Profile image

    @MrCOPTY ok so check me in case I’m misunderstanding this.

    The “Fuel>0 & Throttle>0 & Eng1Thrust=0” goes into the input section of the button/light. This means when Thrust of ENG1 is 0 and the other 2 values are above 0, the light should light.

    The Engine Output goes under the Part Variables heading Thrust as “Eng1Thrust” to match the variable in the input string, so when the engine is producing thrust, the output value is <0.

    I’ve tried this and the button/light isn’t switching. Presently they are rectangular button labeled “ENG1 ALERT” and “ENG2 ALERT”

    +2 1.9 years ago
  • Profile image
    77.3k MrCOPTY

    @ZeroRaven87 No, U Can Use This For Light
    Fuel>0 & Throttle>0 & Eng1Thrust=0

    +2 1.9 years ago
  • Profile image

    @MrCOPTY I’m assuming that’s funky tree coding. Would I then set the input for the button/light to Eng1Thrust ?

    +1 1.9 years ago
  • Profile image
    77.3k MrCOPTY

    Use This Code:
    Fuel>0 & Throttle>0 & Eng1Thrust=0


    And U Should Add Engine Output:
    Thrust: Eng1Thrust


    The Principle Of This Code Is That The Light Turn On When The Engine Throttle Is Greater Than 0 & Fuel Level Greater Than 0 (Engine Should Be On) And The Engine Off Even When He Should Be On.


    U Can Do Same Thing For The 2nd Engine By Changing Eng1Thrust To Eng2Thrust, Hope This Work And Thank You.

    +2 1.9 years ago
  • Profile image

    @HuskyDynamics01 well that’s a shame. Seems like it would be something relatively easy to add to the game since it’s basically comparing the value of a part and triggering a function based on that.

    Oh well. 🤷🏼‍♂️

    1.9 years ago
  • Profile image

    There is unfortunately no way to read/output the damage or health of a part, no.

    1.9 years ago