Trigger Events Between Levels

== Introduction ==
As levels become more complex, you may be unable to create a sequence where, for example, a button toggles a light due to engine limits. However, this doesn't mean it isn't possible to have an activator trigger an event in another map.
== Single Use Env_Global ==
This first section highlights how to create an env_global that can be fired once only after being activated by an activator, which will be a button in this article.
=== The Maps Setup ===
==== First Map - Entity Setup ====
In the first map, you need:
*An activator (in this example - a button named button with a delay before reset set to -1 and Don't Move set in Flags)
*An env_global named light_global- with a Global State To Read set to turn_on_light
*(Optional) A game_text named text_button_on to check the env_global's state
==== Second Map - Entity Setup ====
In the second map, you need:
*A logic_auto - with a Global State To Read set to turn_on_light (it must be the same as the env_global's)
*The entity you want to fire (in this example - a light named red)
=== The Input/Output Setup ===
==== First Map - Outputs ====
Open the activator (the button here) that will fire the env_global.
:
	My Output >	Target Entity	Target Input	Parameter	Delay	Only Once
	OnPressed 	light_global 	TurnOn 	<none> 	0.00 	Yes
	OnPressed 	!self 	Lock 	<none> 	0.01 	Yes
If you are using a game_text, fire it as well as you enable the env_global. Remember that the game_text is only used for debugging purposes. Remove it before shipping your level.
:
	My Output >	Target Entity 	Target Input	Parameter	Delay	Only Once
	OnPressed 	text_button_on	Display 	<none> 	0.00 	Yes
==== Second Map - Outputs ====
Open the logic_auto that will fire the entity or sequence (the light here).
:
	My Output >	Target Entity	Target Input	Parameter	Delay	Only Once
	OnMapSpawn 	red 	TurnOn 	<none> 	0.00 	Yes
And that's it. If the button isn't pressed, the light will be off in the next level. As soon as it is pressed, the light will be turned on.
== Multiple Use Env_Global ==
Let's say we want the light to be toggled on and off when pressing the button. It requires a little more setup, but the process is fairly easy.
==== First Map - Entity Setup ====
In the first map, you need:
*An activator (in this example - a button named button with a delay before reset set to -1 and Toggle and Don't Move set in Flags)
*2 env_global entities:
**The first one named light_global- with a Global State To Read set to turn_on_light
**The second one named light_global_off- with a Global State To Read set to turn_off_light
*(Optional) 2 game_text entities to check the env_global entities state
**The first one named text_button_on
**The second one named text_button_off
==== Second Map - Entity Setup ====
*2 logic_auto entities:
**The first one with a Global State To Read set to turn_on_light (it must be the same as the first env_global in the first map)
**The second one with a Global State To Read set to turn_off_light (it must be the same as the second env_global in the first map)
*The entity you want to fire (in this example - a light named red)
==== First Map - Outputs ====
Open the activator (the button here) that will fire the env_global entities.
:
	My Output >	Target Entity 	Target Input	Parameter	Delay	Only Once
	OnPressed 	light_global 	TurnOn 	<none> 	0.00 	No
	OnPressed 	light_global_off	TurnOff 	<none> 	0.00 	No
	OnPressed 	text_button_on 	Display 	<none> 	0.00 	No
	OnPressed 	!self 	Lock 	<none> 	0.01 	No
	OnUseLocked	light_global_off	TurnOn 	<none> 	0.00 	No
	OnUseLocked	light_global_on 	TurnOff 	<none> 	0.00 	No
	OnUseLocked	text_button_off 	Display 	<none> 	0.00 	No
	OnUseLocked	!self 	Unlock 	<none> 	0.01 	No
==== Second Map - Outputs ====
Open the logic_auto with Global State To Read set to turn_on_light (logic_auto that will turn on the light)
:
	My Output >	Target Entity	Target Input	Parameter	Delay	Only Once
	OnMapSpawn 	red 	TurnOn 	<none> 	0.00 	No
Open the logic_auto with Global State To Read set to turn_off_light (logic_auto that will turn off the light)
:
	My Output >	Target Entity	Target Input	Parameter	Delay	Only Once
	OnMapSpawn 	red 	TurnOff 	<none> 	0.00 	No
And that's all there is to it.
== External links ==
Multiplayer - Change The Nature Of Next Round
==See also==
* Env_global
* Logic_auto
Category:Level Design