Profile image

Automatically opening missile silos

10.3k VisionAviation  2.3 years ago

Hi there,

Does anybody know a way to use variables where I can make automatically opening missile silos? I'm making an aircraft with 8 anti air missiles and I want to tuck them into little missile silos with doors that open when the missiles fire.

So basically, I'd like to have a bit of code that check which missile is the active missile (so which one of the 8 is going to shoot next) and then it opens the corresponding door of the silo that the said missile is in.

I'm thinking about a way where I can name each missile using a variable, and than a bit of code on the door hinge input that looks for "Guardian "1" active ?" Or something like that.

Thanks in advance!

  • Log in to leave a comment
  • Profile image
    13.9k ChrisPy

    you are going to use the ammo function but thats pretty much it

    +1 2.3 years ago
  • Profile image

    @VisionAviation awesome!! And of course!
    .
    I honestly have no clue, but I presume it is because you need a variable to control the hinge, while using the weapon as the variable that opens it
    .
    The first section (each section is defined by the ?) Is for what selecting the weapon does, which is set the rotator to 0 from it's original position, but you can change that
    The second section states that once the weapon reaches 0 amount, it will lock at it's closed space and stop it from functioning
    The third section, the one you are asking about, is the backup to open it, but it only works when the aforementioned value is greater than 0, and is not empty

    +2 2.3 years ago
  • Profile image

    @LieutenantSOT That works perfectly, thanks! Just out of curiosity though, why do you have to define an activation group, if it basically just ignores the activation groups anyway? Like, I set my missile with no activation groups, same as the rotator and then gave the code activation group the number 1. And it works. Even though there's nothing actually assigned to activation group 1?

    +2 2.3 years ago
  • Profile image

    Put this on the rotator, I hope this helps!

    +1 2.3 years ago
  • Profile image

    ((ammo("[Weapon Name]")=0) ? 0 : ((SelectedWeapon="[Weapon Name]") ? 1 : (Activate[NumberValue1-8])

    +2 2.3 years ago
  • Profile image

    Yes, I have a code for that. I'll share it with you, one sec

    +1 2.3 years ago