Profile image

Help With XML for Delay on Internal Weapons Bay

182 Jeffrey214  2.3 years ago

I am modifying a plane with an internal weapons bay and I have run into an issue.

Currently my XML input code is as follows for the hinge rotator part that opens the bombay.

SelectedWeapon = "Kh-38M" & ammo(SelectedWeapon) > 0 ? 1 : 0

This does a good job of opening the correct bay when the correct weapon is selected, but I run into a problem when I launch the weapons, after pressing launch on the second weapon, the doors close before the weapon has cleared the bay. I was looking at XML code on the forum that uses the smooth() function, but I don't know how to implement it.

Please Help! Thanks!

  • Log in to leave a comment
  • Profile image

    @DeveloperKorzalerke will check that in a bit here. Had a mirror post on reddit and this ended up working for me.

    smooth( (SelectedWeapon = "R-74M2" & ammo(SelectedWeapon) > 0 ? 1 : 0) ,1 ) > 0 ? 1: 0

    +1 2.3 years ago
  • Profile image
    11.6k JesusChrist

    @Jeffrey214 Changed it a bit:

    (SelectedWeapon = "Kh-38M" & ammo(SelectedWeapon) > 0) ? 1 : (floor(sum(2)) = 2 ? 1 : 0)

    +1 2.3 years ago
  • Profile image

    @DeveloperKorzalerke Tried that, now the bombay foors don't open at all when I select the weapon. Wierd, it looked like it would work. Any other suggestions?

    2.3 years ago
  • Profile image
    11.6k JesusChrist

    Try

    SelectedWeapon = "Kh-38M" & ammo(SelectedWeapon) > 0 & (ammo(SelectedWeapon) = 0 ? floor(sum(2)) : 0) ? 1 : 0

    It should wait 2 seconds before closing the bay, but only if the ammo is equal to 0.

    +1 2.3 years ago