Trigger

Avatar
Lostprophetpunk
409 Posts
Posted Jul 06, 2011
Heya there,

I am almost half way through building my map at the moment. I was wondering if it is possible to use a trigger, not for the player, but for a cube.

Such as when the cube touches the trigger, certain stuff will happen. I know how to do the stuff that will happen from the trigger, just need to know how to set the trigger off with the cube.

How would I go about this?

Advertisement
Registered users don’t see ads! Register now!
Avatar
Rubrica
305 Posts
Posted Jul 06, 2011
Replied 11 minutes later

http://developer.valvesoftware.com/wiki/Filter

Filters basically check if something fits a certain criteria (e.g., 'is a cube') and if it does, triggers the trigger. I thin there's a key value on trigger brushes that sets what filter it uses.

Avatar
taboo54
34 Posts
Posted Jul 06, 2011
Replied 56 minutes later
also make sure to check the 'Flags' tab in the Trigger's properties and make sure "Client' is unchecked and "Physics Objects" is checked
Avatar
Lostprophetpunk
409 Posts
Posted Jul 06, 2011
Replied 7 hours later
Thank you both, this has helped greatly.
Avatar
ChickenMobile
2,460 Posts
Posted Jul 06, 2011
Replied 2 hours later
Either one of those solutions will work. However I would suggest just using the trigger 'flag' option as this will reduce the amount of entities you need to use and 'de-complicate' it a little.

If you want a specific cube to activate it (for example you have a redirection cube and a frankenturret and you want the redirection cube to activate the trigger) then use a filter.

Avatar
Lostprophetpunk
409 Posts
Posted Jul 06, 2011
Replied 47 minutes later

chickenmobile wrote:
Either one of those solutions will work. However I would suggest just using the trigger 'flag' option as this will reduce the amount of entities you need to use and 'de-complicate' it a little.

If you want a specific cube to activate it (for example you have a redirection cube and a frankenturret and you want the redirection cube to activate the trigger) then use a filter.

I went with the easier option lol. Going to take me a while to get my head around filters. As I looked at that page and just got confused quite quickly.

Avatar
Marise
249 Posts
Posted Jul 06, 2011
Replied 20 minutes later
Filters sound scary, but they are actually pretty simple. For this example I will discuss filter_activator_name, which checks for any entity with a certain name, e.g. "cube1." In the filter's values, there is a setting which I believe is called Filter Name. That is where you type in the entity name you are filtering for ("cube1"). In Outputs, select OnPass and set up the output you want, such as opening a door. You can also set up OnFail to close the door, for example.

Now take your button or trigger and set the Output, OnPressed or OnTrigger, to command the filter to perform the action TestActivator. In other words, when the trigger is activated by any entity, it signals the filter to examine that entity. If it has the correct name, the filter fires its output. If not, it does nothing or else fires the OnFail output.

Think of the filter as one extra step. Rather than your trigger sending a command directly to a door, item dropper, etc, it instead commands the filter to do a quick pass/fail test, and then the filter sends the output.

So you might have something like this:

Trigger-
OnTrigger
filter1
TestActivator

Filter-
OnPass
door1
Open

OnFail
door1
Close

Advertisement
Registered users don’t see ads! Register now!
Avatar
Omnicoder
299 Posts
Posted Jul 06, 2011
Replied 1 hour later

Marise wrote:
Filters sound scary, but they are actually pretty simple. For this example I will discuss filter_activator_name, which checks for any entity with a certain name, e.g. "cube1." In the filter's values, there is a setting which I believe is called Filter Name. That is where you type in the entity name you are filtering for ("cube1"). In Outputs, select OnPass and set up the output you want, such as opening a door. You can also set up OnFail to close the door, for example.

Now take your button or trigger and set the Output, OnPressed or OnTrigger, to command the filter to perform the action TestActivator. In other words, when the trigger is activated by any entity, it signals the filter to examine that entity. If it has the correct name, the filter fires its output. If not, it does nothing or else fires the OnFail output.

Think of the filter as one extra step. Rather than your trigger sending a command directly to a door, item dropper, etc, it instead commands the filter to do a quick pass/fail test, and then the filter sends the output.

So you might have something like this:

Trigger-
OnTrigger
filter1
TestActivator

Filter-
OnPass
door1
Open

OnFail
door1
Close

Or just set the trigger's filter keyvalue to the name of the filter and it'll do all the work for you.