Post tutorial RSS Triggering events in other levels

How do you trigger something beyond a trigger_changelevel, an entity that's in another BSP? Here is how it's done.

Posted by on - Advanced Mapping/Technical

How to carry over outputs to other BSPs? According to Google searches, many people are trying to figure out how to trigger events in one map, that take place in another map. I wasn't able to find a good tutorial, so after scraping bits of information together, I decided to write this to explain how it works.

First off, I'll quickly run you through the system. You can't directly target an entity in another map. The I/O-system will simply not find the entity you are refering to, since it's not in the same map. Now Source has an entity called env_global to help you with this. It does not relay outputs as you might expect but it puts the game in a "state". This state is carried over to the next BSP. Now in the next BSP you can use a trigger_auto to read the state and then trigger events. Here is a step-by-step tutorial on to set it up:

1. Set up 2 rooms and a corridor with a 90 degree angle.
2. In room 1 create a func_button, a white light, an info_player_start, and an env_global.

Name: global
Global State to Set: redlighton (type this in the field, it's not in the drop down menu)
Flags: Set Initial State

Func_button's properties:
Flags: Don't Move
Output: OnPressed > global > TurnOn

3. In the corridor, place a trigger_changelevel brush and a info_landmark.

Trigger_changelevel's properies:
New Map Name: lvlchange2
Landmark Name: lvl_lvl2

Info_landmark's properties:
Name: lvl_lvl2

Room1 might look a bit like this now:

4. Now save your map as lvlchange1. Save it again as lvlchange2 and load up that map.

5. In lvlchange2, delete the info_player_start, func_button and env_global.

6. Now move the trigger_changelevel a bit towards the direction the player comes from. If he transitions into the next map, the trigger to lvlchange1 should be behind him. If the player touches the trigger_changelevel after the level change, you'll be stuck in an endless loop. Now change the properties:

New Map Name: lvlchange1

Note that the info_landmark should remain in the same position. This is the engines anchor point for level changes. All entities and geometry should always be the same relative from this position in both maps. You can actually select the entire map and move it somewhere else on the grid, as long as the distances between the landmark and the rest of the map remains the same.

7. In room2 set up a light and give it a red colour and the properties:
Name: red_light
Flags: Initially Dark

8. Now set up a trigger_auto.
Global State to Read: redlighton (type it)
Output: OnMapTransition > red_light > Toggle

Room 2's view:

9. All done! Compile both maps and load up lvlchange1. Before pressing the button, go into the other room to check if it's dark. Then go back and press the button in room 1. Now go through the corridor and there should be a red light in room2.

The button triggers the env_global and sets the game into the "redlighton" state. The trigger_auto reads that the "redlighton" state is activated and then fires it's outputs.

Example map can be downloaded here.


Well this is definitely a useful tutorial! I'm sure many will be thankful:D

Reply Good karma Bad karma+2 votes

In all my time modding Source I never was sure how this worked. Thanks!

Reply Good karma Bad karma+2 votes

funny to see it all written down here now in this tut, because i use this in a pretty similar way in my latest mod to achieve that choices that were made by the player in the first map will have affect in all the other maps after the first one.

never knew there wasn't a good tut for this around, good that you did write it so many other mappers can use it. because it is a nice future to use in your mod or mappack.


Reply Good karma Bad karma+2 votes

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.