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:
- Set up 2 rooms and a corridor with a 90 degree angle.
- In room 1 create a func_button, a white light, an info_player_start, and an env_global.
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
- 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
-
Now save your map as lvlchange1. Save it again as lvlchange2 and load up that map.
-
In lvlchange2, delete the info_player_start, func_button and env_global.
-
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.
-
In room2 set up a light and give it a red colour and the properties:
Name: red_light
Flags: Initially Dark -
Now set up a trigger_auto.
Global State to Read: redlighton (type it)
Output: OnMapTransition > red_light > Toggle -
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 from here.