Jump to content
Official BF Editor Forums
Sign in to follow this  
Rhino

Triggerables

Recommended Posts

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:

1_tn.jpg

(click to enlarge, like alot of the pics below)

To open these missile covers here:

2_tn.jpg

Like so:

3_tn.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 :)

4_tn.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".

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.

6_tn.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.

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.

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"

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.

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.

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:

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"

13.jpg

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

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"

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"

13.jpg

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

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:

16.jpg

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

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:

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:

19_tn.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"

20.jpg

Then you should see your triggerable work and mine just opened up, yay.

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.

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.

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

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

Edited by Rhino

Share this post


Link to post
Share on other sites

Great tutorial!

In testing I've noticed that the game doesn't allow any part of the moving statics to be at all under the terrain.

Is this a correct assumption or is there something I can do to make this happen?

In the editor things look fine, but ingame the statics are 'moved' up and just off the terrain.

I thought maybe the 2 .con files were being resaved and this was the problem, but that isn't the case.

Share this post


Link to post
Share on other sites

Hi , pretty well explained Rhino, thx.

Unfortunately a good thing brings a bad one with bf2' engine i guess. I checked with SF & FH2, it seems that the col0 is not fully working with the triggerable target, like the 2 previous mod the bullets go through the geom use, only grenade bounce against the door. col2 working. (i seek forum to find confirmation about that but don't)

I'm also wondering if it's possible to allowed only one team to use a triggerable.

Last question rejoins previous one in discriminate capabilities, I wish have a class of soldier with a key (lik the wrench in engee kit) who can open some door & only him . The key using would be great but in a triggerable way would be good enough !

Thanks in advance.

B.R.

Share this post


Link to post
Share on other sites
Hi , pretty well explained Rhino, thx.

Unfortunately a good thing brings a bad one with bf2' engine i guess. I checked with SF & FH2, it seems that the col0 is not fully working with the triggerable target, like the 2 previous mod the bullets go through the geom use, only grenade bounce against the door. col2 working. (i seek forum to find confirmation about that but don't)

I've recently found that if you set the collision type from Platform to Mesh it works much better thou not 100% on the bullets thou from what I can tell its stopping them like that but needs MP testing.

I'm also wondering if it's possible to allowed only one team to use a triggerable.

not that I know of, you may be able to try and add something like:

ObjectTemplate.team 1

to it, but dunno if that will work worth testing thou.

Last question rejoins previous one in discriminate capabilities, I wish have a class of soldier with a key (lik the wrench in engee kit) who can open some door & only him . The key using would be great but in a triggerable way would be good enough !

Thanks in advance.

B.R.

I dont think that would be possible, could play with things like CP capping links etc maybe?

Share this post


Link to post
Share on other sites

What does work is to give the class a weapon with special capabilities . E.g. we have tool which can destroy certain fences - but only the guys with the tool can do that.

Its a question of setting up materials which only react to certain projectiles.

Share this post


Link to post
Share on other sites

Hello, thanx 4 reply.

Unfortunately the platform physic type don't gimme better result, the crazy thing is 50% try show bullets collision in the level editor, soldier camera, but never in-game :huh:

Team restriction 4 triggerable don't seem to work, i try your suggestion & ObjectTemplate.DontClearTeamOnExit 1 ,

ObjectTemplate.teamOnVehicle 1 (even a "triggerableonteam 1" wich sounds good :lol: but none make the game !)

Then i export my door as a bundledmesh & make several trials like before, cause those code line refer to a vehicule but i don't catch the way BF2 recognize on wich side "vehicule" are & how it avoid enemy to drive it à la PR & FH2. (no find on vehicule .tweak)

I read threads on Python, specially the one of Mach 10 on #5 but those stuff are beyond my skills right now, i will have to play with triggerable placement to adapt gameplay.

Thx Mshoeldgen 4 the clue, like Python i will need some weeks (months...years... :rolleyes: ) to reach this stage but i have a direction...

Sorry Rhino to hijacked your tut... ;)

B.R.

Share this post


Link to post
Share on other sites

If you don't want the enemy to snatch your cars add a 'objectTemplate.teamOnVehicle 1' statement to the ObjectSpawner for this vehicle. Only the team from the originating CP can now use that vehicle.

Share this post


Link to post
Share on other sites

got some good news here guys, the CQB mod has managed to get sound working with the triggerables some how, I've yet got to work out how and they dont speak english so ive got to go over there code etc. Once I find out how they have done it I will update the tut and post here :D

Share this post


Link to post
Share on other sites
:o Sweet! Lemme know if you learn more...

Share this post


Link to post
Share on other sites
got some good news here guys, the CQB mod has managed to get sound working with the triggerables some how, I've yet got to work out how and they dont speak english so ive got to go over there code etc. Once I find out how they have done it I will update the tut and post here :D

I'd be interested to know if they got it working in MP. Getting it to work in local and SP is easy (see my code in our map 'Sidi Rezegh' for something which works) but it doesn't and hasn't ever worked in MP, nor can I ever remember it working in SF either :(

The general idea is to objecttemplate.active the S_ templates attached to triggerables or triggerable targets and attach sounds to them. The editor tends to helpfully delete these for you, but you can stash them safely in your tmp.con.

Edited by [FH]ctz

Share this post


Link to post
Share on other sites

ye both me and 1/2hawk have been able to get sounds to work on local in the past but not dedi, aint looked into how they got it to work much yet but will do :)

Share this post


Link to post
Share on other sites

Hey Rhino, Nice tut ;)

Haven't tried it yet, but i'm definetly gonna use it in my next map!!

Which map is this?? It looks like a very cool map.. is it included in PR 0.75?

Share this post


Link to post
Share on other sites

Sorry to dig up an old thread - but did anybody ever figure out how to tie sounds to triggerables in MP?

Share this post


Link to post
Share on other sites

na, never got round to looking into how CQB did it, try downloading there latest build and looking into there code etc? :)

Share this post


Link to post
Share on other sites

I know this is a really old thread, but heres a question...

Why is it that the object i have moving, when i create a local, it works but, my jeep is able to pass through the object?

Share this post


Link to post
Share on other sites

The maze map i am creating, i want to have it so walls and gates close as there triggered. But i can still drive through them, il try the col1 later.

Share this post


Link to post
Share on other sites

Ok so i done a bit of testing on a brick wall that comes up from under the water.

First problem i had and still have is the triggerable dosent move if i save it in prime pos, I have to save it in sec pos, and thats pointless because i need it to move up to block the way after the trigger is hit....

Second is the triggerable only moves if im on foot or swimming. It dosent move if i use a boat or jeep. I have it set to type 3, move.

Third, i am ablet to drive a vech through different parts of the wall, not all the wall. I have changed the platform to mesh and others and also other settings but its mostly the same result...

But if im on foot, i cant pass throught it, its a solid object.

Anyone got any help to offer?

Share this post


Link to post
Share on other sites

If this is for BF2 the debugger is a valuable help here. Start your map with BF2_r.EXE and spawn on the map. Open the console and enter 'collisionManager.buildDebugCollisionmeshes' ( or similar, the debugger will autocomplete commands by pressing the TAB key so don't take this literally . Entering 'build' followed by TAB will give you the right syntax)

After a short moment this task is finished. Now enter 'collisionManager.drawMeshes <N> ' where N is the desired col<N> meshes , e.g. 1 will show col1's of your models . If there's no col1 , col0 will be displayed instead.

You can now examine the col's . There's no graphcal clipping on them which needs some time to get accustomed ,too but i always found that a great help in fiddling with problems like yours.

Note that the colmeshes of the vehicle you're using at the moment will not be displayed.

Share this post


Link to post
Share on other sites

I was wondering, can you make mobile triggerables? Lie in a vehicle.

Maybe making a .con file with a triggerable, and add it to a pco.

It would be great if it was or could be possible, then I can make the coolest destroyable carrier ever :P

EDIT:

Nah, impossible. But still: Can you make a triggerable inactive? (when something explodes)

Edited by bergerkiller

Share this post


Link to post
Share on other sites

If this is for BF2 the debugger is a valuable help here. Start your map with BF2_r.EXE and spawn on the map. Open the console and enter 'collisionManager.buildDebugCollisionmeshes' ( or similar, the debugger will autocomplete commands by pressing the TAB key so don't take this literally . Entering 'build' followed by TAB will give you the right syntax)

After a short moment this task is finished. Now enter 'collisionManager.drawMeshes <N> ' where N is the desired col<N> meshes , e.g. 1 will show col1's of your models . If there's no col1 , col0 will be displayed instead.

You can now examine the col's . There's no graphcal clipping on them which needs some time to get accustomed ,too but i always found that a great help in fiddling with problems like yours.

Note that the colmeshes of the vehicle you're using at the moment will not be displayed.

I figured that already. You have to set the mass in the tweeker to 1999999.

I also figured that if you save your trigger target in pirm pos, it also save the sec pos in the same place. So save your target in the prime and co to the .con files and change the secondery pos there. Waaalaaa it works.

But i still cant figure how to get cars and boats to trigger. Still only works when on foot.... ANYONE ANY IDEAS?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...