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!
@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
@Jeffrey214 Changed it a bit:
(SelectedWeapon = "Kh-38M" & ammo(SelectedWeapon) > 0) ? 1 : (floor(sum(2)) = 2 ? 1 : 0)
@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?
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.