PDA

View Full Version : Mapping Triggerables


Rhino
2008-01-28, 18:12
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.

2DQl9Rn6t9w

So what I want to do here is to get this switch panel here:
http://www.rhinorage.co.uk/images/tut_triggerables/1_tn.jpg (http://www.rhinorage.co.uk/images/tut_triggerables/1.jpg)
(click to enlarge, like alot of the pics below)

To open these missile covers here:
http://www.rhinorage.co.uk/images/tut_triggerables/2_tn.jpg (http://www.rhinorage.co.uk/images/tut_triggerables/2.jpg)

Like so:
http://www.rhinorage.co.uk/images/tut_triggerables/3_tn.jpg (http://www.rhinorage.co.uk/images/tut_triggerables/3.jpg)


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 :)

http://www.rhinorage.co.uk/images/tut_triggerables/4_tn.jpg (http://www.rhinorage.co.uk/images/tut_triggerables/4.jpg)

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".
http://www.rhinorage.co.uk/images/tut_triggerables/5.jpg

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.

http://www.rhinorage.co.uk/images/tut_triggerables/6_tn.jpg (http://www.rhinorage.co.uk/images/tut_triggerables/6.jpg)

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.

http://www.rhinorage.co.uk/images/tut_triggerables/7.jpg

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.

http://www.rhinorage.co.uk/images/tut_triggerables/8.jpg

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"

http://www.rhinorage.co.uk/images/tut_triggerables/9.jpg

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.

http://www.rhinorage.co.uk/images/tut_triggerables/10.jpg

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.


http://www.rhinorage.co.uk/images/tut_triggerables/11.jpg

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:
http://www.rhinorage.co.uk/images/tut_triggerables/12.jpg

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"
http://www.rhinorage.co.uk/images/tut_triggerables/13.jpg

Then select your TriggerableTarget again, right click on it and click on "Paste Transformation"
http://www.rhinorage.co.uk/images/tut_triggerables/14.jpg

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"
http://www.rhinorage.co.uk/images/tut_triggerables/15.jpg

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"
http://www.rhinorage.co.uk/images/tut_triggerables/13.jpg

Then select your TriggerableTarget again, right click on it and click on "Paste Transformation"
http://www.rhinorage.co.uk/images/tut_triggerables/14.jpg

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:
http://www.rhinorage.co.uk/images/tut_triggerables/16.jpg

And probaly a good idea to locate your TriggerableTarget at the same time, which should look something like this:
http://www.rhinorage.co.uk/images/tut_triggerables/17.jpg

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:
http://www.rhinorage.co.uk/images/tut_triggerables/18.jpg

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:
http://www.rhinorage.co.uk/images/tut_triggerables/19_tn.jpg (http://www.rhinorage.co.uk/images/tut_triggerables/19.jpg)

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"
http://www.rhinorage.co.uk/images/tut_triggerables/20.jpg

Then you should see your triggerable work and mine just opened up, yay :D
http://www.rhinorage.co.uk/images/tut_triggerables/21.jpg

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
51c7xB9ZNMY


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 :)

Rhino
2008-01-28, 18:20
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 :)

Pride
2008-01-28, 18:24
Nice tut.


But what i really wanted to say was:

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

CodeRedFox
2008-05-07, 08:42
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
2008-05-07, 13:18
coderedfox;670372']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 bitch to get working hehe, try reloading the editor :)

jaspercat444
2008-06-07, 23:11
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
2008-06-07, 23:19
WTF?!!?!

Testers, to the laboratory!

...mongol...

Dv83r
2009-02-07, 19:59
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

MCI
2009-11-21, 17:48
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?

J.F.Leusch69
2009-11-21, 17:58
the CA guys made this happen, but i dont know if its totaly glitch free :)

Outlawz7
2009-11-21, 18:19
It has no sound and slightly lags, the sound is somehow fixed in BF2 SF though.

Rhino
2009-11-21, 18:34
Outlawz;1188496']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.

McBumLuv
2009-11-22, 03:19
IIRC they just took the Iron Gator carrier, since there isn't any difference in the triggerables AFAIK.

armed Jester
2009-11-25, 14:25
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. :-(

armed Jester
2009-11-27, 20:55
it locks like EA removed the TriggerableTarget event type 2 and 4 in the 1.5 patch. :(

can someone help or got n idea?