Page 1 of 2

Mako's guide to triggers

Posted: Tue Feb 17, 2009 11:08 am
by Mak0
Read the Documentation first.

*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

Image


Step 1.

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.
Image

Step 2.
On the yellow section create a top section. This will be the part of the gun that recoils.
Image

Step 3.
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.
Image
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.


Step 3.5
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.


Step 4.

With the top section selected, right click on the blaster and from the context menu press 'Set on trigger 1'


Step 5.
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.
Image

Testing it.
Press F11 to go into preview mode and keep mashing 'q' to testfire till you get bored

Posted: Tue Feb 17, 2009 11:08 am
by Mak0
Tutorial 2. Making a bow
Image
This example will be a bow shaped..thing that contracts every time a shot is fired from the triggered weapon. As the weapon reloads for the next shot the bow arms slowly raises to help you know when the next shot is ready.


Step 1.
Onto the main body attach a weapon and a section to be used as a pivot (the red one below), then onto that section attach an arm.
Image


Step 2.
Select the pivot point and change it's settings in edit to as follows:
Image
In the ED2 menu of the pivot in the rotating section, set borders to enabled, CW border to 0 and CCW border to 90.

Now with pivot selected right click on the weapon and press 'set on trigger 1'

If you go into preview mode (F11) and test fire (q) you'll see that for a weapon like a railgun, that our bow arm doesn't give properly reflect the charge up time and fire time.


Step 3.
To time the actions of our arm to the weapon speed click the weapon and go into edit. For a railgun the reload time is 120 frames.
Go back to the pivots' ED2 menu and set CCW Rot frames to 5, and CW Rot frames to 95.
When the weapon is fired, this results in the bow arm quickly drawing back, then slowly returning to the original position before standing still for 20 frames till the next shot.


Step 4.
When you press 'm' to mirror the ship components, the components will have no triggers attatched to them but will retain and inverse their trigger settings (e.g. CW is changed to CCW). All you need to do is click the pivot and set it to trigger 1 on the weapon.

Posted: Tue Feb 17, 2009 11:08 am
by Mak0
Reserved for pictorial goodness

Posted: Tue Feb 17, 2009 3:09 pm
by D00D!
Gah! I've been beaten to it! :mrgreen:

Ah well, that just means less work for me to do then. Its not a bad guide though although you should warn them about some of the known bugs like weapon trigger not cloning/mirroring properly.

Don't worry though, if you can handle the basics then that's one less thing I have to cover when I finish my guides. :lol:

BTW, may I have permission to link to your guide? Its good enough to teach people the basics with it.

Posted: Tue Feb 17, 2009 3:19 pm
by Mak0
Lol, nice name, disgaea fan i assume?

Yeah, was planning on covering the more advanced stuff like rotations, timing and mirroring next.

Feel free to link away :roll:

Re: Mako's guide to triggers

Posted: Tue Feb 17, 2009 6:08 pm
by Kaelis
Mak0 wrote:... and have seen very little information on how triggers work and operate on the forums ...
How about the documentation?

Yes, i know, im pushing it, but i don't want people to get the impression that they can just skip it and feed with guides, or that there should be guides for everything. Thats kind of the vibe your guide gives off. It should be more like read documentation first, then guides.

Posted: Tue Feb 17, 2009 8:33 pm
by Mak0
Hmm....i see what you mean. In that case i'll leave it at those two examples for those starting with triggers. :mrgreen:

Also, my bad, there is alot of information in the documentation and around the forums on triggers, but not many examples or explanations of how to implement them.

Posted: Wed Feb 18, 2009 2:33 am
by TheBlueEcho
Well, How about you Edit the first post with a link to the documentation stating that they should read it first, then give them guides and tuts on how to implement whats there. Some links to good ships that use Triggers and weapon linking would be good as well.

Posted: Wed Feb 18, 2009 11:17 am
by parameciumkid
Nice tutorial and all - I'd probably use it if I didn't already know how to do that stuff - but you do realize that real bows work the other way?
As in, they contract when being drawn, i.e. reloading, and then spring forward when fired. I'm not trying to insult you, but you may or may not want to change that.

Posted: Wed Feb 18, 2009 1:46 pm
by Mak0
@Blue: Done! thx for the advice

@Paramecium: Yes, i know real bows work the other way ;) hence my stating
bow shaped..thing
If it were more accurate to a real bow you just need to turn the CW rot frames to something low so the bow draws and snaps back as soon as it fires.
But for a tute on rotation triggers and syncing'em up to weapon reloads (i.e. a cooldown timer), a slow snap back was more suitable.

Posted: Wed Feb 18, 2009 6:41 pm
by th15
Good, guide, stickying.

Posted: Mon Mar 09, 2009 12:08 am
by pokd
what update do i need to use triggers and add in sprites, and where can i find it?

Posted: Mon Mar 09, 2009 12:30 am
by lightstriker
www.wyrdysm.com
the download at the top of the page
:wink:

Posted: Fri Mar 13, 2009 9:18 pm
by Zoid Crusader
I have a question why is it set to 5 and 95? does it have a reason? or does it have to do with 120?

Posted: Sun Mar 15, 2009 7:19 pm
by Mak0
For a railgun the reload time is 120 frames.
Go back to the pivots' ED2 menu and set CCW Rot frames to 5, and CW Rot frames to 95.
When the weapon is fired, this results in the bow arm quickly drawing back, then slowly returning to the original position before standing still for 20 frames till the next shot.
So yes, it does have to do with the 120 frames :shock: