Read the Documentation
*cheers th15 for the sticky
Since i've had a few messages on how to use triggers, and have seen very few examples on how triggers work and operate on the forums i've decided to write a pictorial on specific examples of how to use triggers, and how to test them.
Tutorial 1. Weapon recoil
For this example we'll be making a gun that recoils whenever the weapon it's set to is fired
On a new ship create a 'base' section (yellow here) and place a blaster on top of it. This yellow section is static and won't do anything other than hold up the gun.
On the yellow section create a top section. This will be the part of the gun that recoils.
On the left hand panel click edit and you should see a triggers section down the bottom. Change trigger on action 1 to 'weapon fire and trigger off action 1 to Mov.Reach origin (s), leave mode as move.
What does this mean?, the part will enter move mode when the triggered weapon fires, and it will stop moving once it returns to it's starting point.
On the left hand panel click ED2.
Change target distance to 10 and direction to 180. This results in the part going backward 10 units, then coming back to it's origin.
Set advance frames to 5 and Return frames to 10. This achieves a quick recoil of the top section with a slower return to the origin.
With the top section selected, right click on the blaster and from the context menu press 'Set on trigger 1'
Click on the blaster to select it, then press 'w'. This should place it on the base section and hide it behind the top section.
Press F11 to go into preview mode and keep mashing 'q' to testfire till you get bored