Triggerables

Information and tutorials related to modding BF2.
Post Reply
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Triggerables

Post by Rhino »

Due to a bunch of requests I've had here is a really simple, basic tut about Triggerables just so you can get the idea of how they work and how to set them up. Not going to go into amazing detail with these as they are slightly flawed when not being used in BF2 Special Forces xpack as you can not get sounds to work on them apart from on a local server if they are in any other "mod".

Just to give you a basic idea of what "Triggerables" are, they are basically mapper setup triggers that can get objects like a door or something to move when a player activates them. For exsample the tunnel door on OGT is a trigger able.
So what I want to do here is to get this switch panel here:
Image
(click to enlarge, like alot of the pics below)

To open these missile covers here:
Image

Like so:
Image


So the first thing you will want to do is setup your statics like I've done here, with even the object you want to have moving as a static for now, even thou we will be deleting it later.

Now I only have one moving object for this trigger, the hatches, even thou they may appear to be 4 objects they are in fact just 1 object which makes things easier for me, thou if they where separate objects I could give them very slightly diffrent delays which would make them look a little cooler, but no one will notice with them being all about 50m or more apart :p

Now what you need to do is place your moving object where you want it to "start" as such at the begging of the game in its exact spot. Once you have it in that position, give it a lightmap (preferably a final lightmap as you probaly wont want to lightmap it again as you will have to set it up as a static etc, its possible but best to do it now). Anyways back on track, now that your lightmap is done you will want to clone your moving object into its "secondary" position where it ends up after moving. Best way is to select your "moving" object, hold the "shift" key then select the direction you want to move it in and drag it in that direction to where you want it to end up. This will clone your object as your doing it as we want to keep the start postion for refinance later on :)

Image

now this may look abit odd but you will see later, its all for position ref and its how I work, thou you can do this in w/e way you want thou for now, best to stick to my way :)

Anyways once you have it setup like that, give your map a quick save, then go to your button.

Now you dont have to have your button/switch as a "static" but I always do as its easier to apply its lightmaps etc (you can give your triggerable button a geom).

So ye, to make your "Triggerable", right click on your map where abouts you want it, and click on "Create Triggerable".
Image

A window will popup asking for you to give it a name, with the default name of "Triggerable_" being there. Best to keep this begging bit, and then just add your name after it, so I'm going to call mine "Triggerable_MS_MissileCoversButton" with "MS" Standing for Missile Silo so I know what sort of area on the map it is when looking at the code, thou you can really name it bob and it will still work thou I wouldn't advise it :p

This is how your Triggerable should now look like.

Image

As you can see in the left, I have already setup a triggerable door before doing this triggerable on this map so just bare that in mind, ignore it for now I'm just pointing out with the arrow where you can find your triggerables on your map in your Resources bar.

Before I go on, just going to go though the triggerable "Tweaker" settings.

Image

AbsolutePosition = the location of the triggerable
Layer = what layer the triggerable is on
Radius = The radius where the trigger can be triggered
TriggerTypes = not 100% sure but take it that 3 (default) means triggerables, best not to touch this one unless you know what your doing :p
TriggerId = the ID nubmer of your trigger
Geometry = the geom of your triggerable, best to not have one IMO so leave it blank.

Image

Radius = The radius where the trigger can be triggered (again)
TriggerId = the ID nubmer of your trigger (again)
Events = Events are how you want users to trigger this trigger, the events are 0=none, 1=use, 2=shoot, 3=move, 4=explosion, 5=cp changed.
Chance = the chance that the trigger will be trigged in %, 100 means a 100% chance that the trigger will be trigged when pressed, 0 means no chance, 50 means 50% chance etc, if its a button best to leave it at 100, if its something like shoot, move or explosion then you could lower it down.
AvrageTimeBetweenTests = not sure on this one, done no testing, default is 10 thou.
MinimumTimeBetweenTriggering = time needed untill second trigger to respond
TriggerForEachActivatingPlayer = not sure on this one too.
NotCycledIfOccupied = not sure on this one aswell.


Now back to my trigger, the purple circle represents the radius you can trigger this button in, really I want it to be alot smaller than this so I'm going to tweak down the radius too around 3(meters), apposed to the 5 it is now. Also I'm going to change its events to 1 (use) so players have to press "e" when in the radius to trigger the triggerable. Going to keep all the other settings the same and save up my objects and triggerables before I move on.


Now we have our "Triggerable" setup, we need to move onto making some "TriggerableTargets" which is basically the moving objects. To make one, right click on the map and click on "Crate TriggerableTarget"

Image

A window will popup asking for you to give it a name, with the default start being "TriggerableTarget_", I'm going to call mine "TriggerableTarget_MS_MissileCovers". This at first will just be a blank object with only a bunch of tweaker settings. First I'll go though its settings before I go on.

Image

Layer = what layer the TriggerableTarget is on
AbsolutePosition = the location of The triggerableTarget, and where the object "starts" in its "primary position"
AbsolutePositionSecondary = the Secondary location of the object, ie, where it moves too after it has been triggered (only need to fill this out if your object moves in a transitional form and not rotational)
Rotation = the rotation of the object (also if your object is going to rotate when it moves, this will be its primary/start rotation.
RotationSecondary = the Secondary rotation of the object (only need to fill this out if your object moves in a rotational form and not transitional)
MovementType = How your object moves, movementTypes are 0=transitional, 1=rotational.
MovementSpeed = how fast your object moves/rotates.
DelayBeforeStart = the delay after you trigger the Triggerable before this TriggerableTarget starts moving.
DelayBeforeCycle = If you have your Cycels set to more than 1, then this is the time between each of thous cycels.
DelayBeforeEnd = Aint tested this so not 100% sure on it tbh, best to do your own testing here :)
Cycles = How many times your object will move between the Primary and Secondary locations before coming to a stop at each push of the button.
Geometry = The Geom of the TriggerableTarget, ie, what object you want it to be.


Image

MovementSpeed = how fast your object moves/rotates (again)
MovementType = How your object moves, movementTypes are 0=transitional, 1=rotational (again)
Clockwise = if it moves in a rotational form, then this will tell the object to move clockwise or anticlockwise.
DelayBeforeStart = the delay after you trigger the Triggerable before this TriggerableTarget starts moving. (again)
DelayBeforeCycle = If you have your Cycels set to more than 1, then this is the time between each of thous cycels. (again)
DelayBeforeEnd = Aint tested this so not 100% sure on it tbh, best to do your own testing here (again)
Cycles = How many times your object will move between the Primary and Secondary locations before coming to a stop at each push of the button. (again)
StartingSplinePoint = ehhh for some reason this is the first time I have seen this hehe, ehhh, got to look into this ;)


Anyways back to our TriggerableTarget. Now first I want it to take the form of these Missile Silo Covers so first thing to do is fill out the geom box. The exact object name of this static is "missile_silo_covers" so all you need to do for your TriggerableTarget to have the same geom is to fill out its name (or the name of your object you want) into its Geometry tweaker box:
Image

Then hit enter and its geom will pop up.

Now to get this position of this thing sorted. Select the object in the Secondary position you want for your TriggerableTarget, then right click on it and click on "Copy Transformation"
Image

Then select your TriggerableTarget again, right click on it and click on "Paste Transformation"
Image

This will set your objects position to the exact same spot as the object you copied its transformation from.

With your TriggerableTarget still selected, right click on it and click on "Set Secondary POSITION"
Image

If you now unselect and reselect your object you will notice its "AbsolutePositionSecondary" tweaker box will now be updated.

Now select the object which is in your Primary location (for me, closed) and right click on it, and click on "Copy Transformation"
Image

Then select your TriggerableTarget again, right click on it and click on "Paste Transformation"
Image

Then save up what you have done (both objects and triggerabes) and then close the editor.


Now go to your map's folder in "\mods\*your mod*\levels\*your map*\" then find and open the "TriggerableTemplates.con" with your favorite text editor (like Notepad), I'm going to use the Crimson editor.

This .con contains most of the data on your triggerables, apart from the positions, rotations and stuff like that which is kept in the "Triggerables.con" but dont need to worrie about that now.

Anyways to get your Triggerable to trigger your TriggerableTarget you now need to link them. This I have found can only be done via hand editing this .con file thou there may be a way to do it in the editor, if there is I aint found it. Anyways what you need to do is first locate your Triggerable for a start, it shouldn't be too hard to find as there shouldn't be that much in this file. It should look something like this:
Image

And probaly a good idea to locate your TriggerableTarget at the same time, which should look something like this:
Image

Anyways back to your Triggerable, Just below the "ObjectTemplate.notCycledIfOccupied 0" line of your Triggerable, you will need to add this line of code "ObjectTemplate.addTriggerableTarget " Then after it give it the name of the of your TriggerableTarget, which mine is if you remember "TriggerableTarget_MS_MissileCovers" (you can find the name below where you located your triggerable target earlier just copy and paste it) then it should look something like this:
Image

Also bare in mind, you can have more than one TriggerableTarget attached to a Triggerable.

After you have done that and it looks more or less like it dose to my code above, then you can save it up and load the level editor and your map back up.


Once you have loaded your map back up, fly over to the location of your Triggerable, then delete your static missile covers (or w/e object you used) so you can just see your TriggerableTarget. You should also notice that your TriggerableTarget has some lightmaps applied too it from the lightmaps you generated from the static that was there before. Anyways your TriggerableTarget should be in its Primary (for me, closed) position, and you should always have it in its primary location when saving this file too otherwise you will feck things up. Should look something like this:
Image

Now to test your Triggerable :D
To test it, first select your Triggerable in the resources tab then right click on it, and click on "Test Triggerable"
Image

Then you should see your triggerable work and mine just opened up, yay :D
Image

If it dont then you have done something wrong, and exit your map without saving and go back over this tut.

Then just click on "Test Triggerable" to close it again, like i said befre, NEVER save your triggerables with it in its secondary position as it will feck things up.

Now that your Triggerable moves and is working, good idea to now tweak it so we can get it just right :D

Select your TriggerableTarget and lets go though its settings. The speed of it at 1 is for these just right, thou think im going to add a 0.3sec delay before it starts with also adding a 20sec delay before Cycle and bumping up the Cycels to 2 so it opens, then waits 30secs before it closes itself :)
Then give it a quick test to see if its what you want, then keep on tweaking, trial and error mainly till you get it right :D

Heres a quick video of it, with the Cycel delay turned down to 5secs so you dont have to wait ages watching blank video :p

Now from here you can experiment what other things you can do to Triggerables, afew little notes thou:
  • cant have "distructible trigger ables", so you cant have for exsample a door that can be destroyed, but also opened via a trigger able
  • you can test triggerables in the editor also in player camera mode, by pressing the "e" key when inside the radius
  • When a object can be triggered by more than one button, you need to add the line "ObjectTemplate.hasPartner 1" to the code somewhere, aint done much testing on this tbh.
Hope you find this tut useful :)
Last edited by Rhino on 2008-10-25 14:19, edited 1 time in total.
Image
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Post by Rhino »

also please dont spam this topic about "what map is that" etc, we will be doing a Dev Journal update on it shortly I'm sure :)

keep on topic, thanks :)
Image
Pride
Retired PR Developer
Posts: 1467
Joined: 2007-07-19 18:13

Post by Pride »

Nice tut.


But what i really wanted to say was:

'ZOmg Operation Barracuda has a Missile Silo!!1! :smile: :smile:'
Image

eddie: the MoD aren't just going to start blurring their faces so they look 'well ard' are they?
CodeRedFox
Retired PR Developer
Posts: 5919
Joined: 2005-11-08 00:47

Re: [Tutorial] Triggerables

Post by CodeRedFox »

anyone else not able to get ObjectTemplate.clockwise "1" to work, It wont save in the editor so it has to be added manualy. But it does nothing.
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: [Tutorial] Triggerables

Post by Rhino »

[R-DEV]coderedfox wrote:anyone else not able to get ObjectTemplate.clockwise "1" to work, It wont save in the editor so it has to be added manualy. But it does nothing.
its a ***** to get working hehe, try reloading the editor :)
Image
jaspercat444
Posts: 599
Joined: 2007-12-19 06:11

Re: [Tutorial] Triggerables

Post by jaspercat444 »

So... Does this mean that we are getting movable objects in upcoming maps? If so... Thats awesome. You know... This makes me want to start mapping myself... Awesome, awesome, and AWESOME!!! :mrgreen: :mrgreen:
Mongolian_dude
Retired PR Developer
Posts: 6088
Joined: 2006-10-22 22:24

Re: [Tutorial] Triggerables

Post by Mongolian_dude »

WTF?!!?!

Testers, to the laboratory!

...mongol...
Military lawyers engaged in fierce legal action.

[INDENT][INDENT]Image[/INDENT][/INDENT]
MCI
Posts: 431
Joined: 2007-08-28 21:47

Re: [Tutorial] Triggerables

Post by MCI »

Dv83r wrote:Wait a second, If you can make triggerables that easily you could add that to U.S.S Essex like in the map The Iron Gator in BF2:SF. That be cool for a map for a plane to go up the triggerable but the bad thing is if the plane goes down if will start to free fall and take mild damage
Is this possible DEVs?
Image
J.F.Leusch69
Retired PR Developer
Posts: 2988
Joined: 2008-04-23 16:37

Re: [Map Tutorial] Triggerables

Post by J.F.Leusch69 »

the CA guys made this happen, but i dont know if its totaly glitch free :)
Outlawz7
Retired PR Developer
Posts: 17261
Joined: 2007-02-17 14:59

Re: [Map Tutorial] Triggerables

Post by Outlawz7 »

It has no sound and slightly lags, the sound is somehow fixed in BF2 SF though.
Image
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: [Map Tutorial] Triggerables

Post by Rhino »

[R-CON]Outlawz wrote:It has no sound and slightly lags, the sound is somehow fixed in BF2 SF though.
afaik the CQB mod managed to get the triggerable sound working on dedicated servers but not looked into how they have done it.
Image
McBumLuv
Posts: 3563
Joined: 2008-08-31 02:48

Re: [Map Tutorial] Triggerables

Post by McBumLuv »

IIRC they just took the Iron Gator carrier, since there isn't any difference in the triggerables AFAIK.
Image

Image

Image
armed Jester
Posts: 18
Joined: 2009-06-02 16:53

Re: [Map Tutorial] Triggerables

Post by armed Jester »

dont use the BF2editor build 0.1.064 !! it dosnt support the create triggerable and create triggerabletaget funktion !

it took me 3 days to find out. :-(
Image
armed Jester
Posts: 18
Joined: 2009-06-02 16:53

Re: [Map Tutorial] Triggerables

Post by armed Jester »

it locks like EA removed the TriggerableTarget event type 2 and 4 in the 1.5 patch. :(

can someone help or got n idea?
Image
Post Reply

Return to “Modding Tutorials”