Logic auto: Difference between revisions
Jump to navigation
Jump to search
Warning:Attempting to directly access or modify the player may cause Access Violation errors, because the outputs are fired before the player has spawned. Adding a slight time delay may overcome this.
Warning:This entity counts as an edict, not a logical entity as one would expect, and therefore it can contribute to the entity limit. If this is an issue, use logic_relay and its
Note:In
Counter-Strike: Source and
Counter-Strike: Global Offensive when a map loads and when the round is reset (
CS:GO including resets for warmup and resets in any other game mode), this entity fires the 3 outputs
Note:In
CS:GO the output
Thunder4ik (talk | contribs) m (→top: clean up, replaced: {{language subpage → {{langsp) |
m (Test) |
||
Line 7: | Line 7: | ||
{{note|In {{csgo|nt=1|4}} the output <code>OnMultiNewRound</code> is actually fired in response to the game events <code>round_start</code> and <code>teamplay_round_start</code> and does not depend on the <code>Global State to Read</code>. When a round is reset, it is fired before the previous 3, but not when a map is loaded.}} | {{note|In {{csgo|nt=1|4}} the output <code>OnMultiNewRound</code> is actually fired in response to the game events <code>round_start</code> and <code>teamplay_round_start</code> and does not depend on the <code>Global State to Read</code>. When a round is reset, it is fired before the previous 3, but not when a map is loaded.}} | ||
==Keyvalues== | == Keyvalues == | ||
{{ | {{:User:THE_OWL/Sandbox/Templates/OIF | ||
| target = Outputs | |||
==Outputs== | | item 1 = Global State to Read | ||
{{ | | item 1 desc = If set, this specifies a global state to check before firing. Outputs are only fired if this global state exists and if it is turned on. | ||
{{Note|Valve's [[FGD]]s always include the {{hl2|4}} global states here, but any value can be entered. See {{ent|env_global}} for a list of default global states in each game.}} | |||
}} | |||
== Flags == | |||
{{:User:THE_OWL/Sandbox/Templates/OIF | |||
| target = Outputs | |||
| item 1 = <nowiki>[ 1 ] : Remove on fire</nowiki> | |||
| item 1 desc = Whether the {{ent|logic_auto}} is deleted after firing. Delayed outputs will still work, however. | |||
}} | |||
== Outputs == | |||
{{:User:THE_OWL/Sandbox/Templates/OIF | |||
| target = Outputs | |||
| item 1 = OnMapSpawn | |||
| item 1 desc = Fired shortly after the entity spawns (including loading saves). | |||
{{Bug|{{tf2}} Also fires when a new round starts}} | |||
| item 2 = OnNewGame | |||
| item 2 desc = Fired when the map is loaded to start a new game. | |||
| item 3 = OnLoadGame | |||
| item 3 desc = Fired when the map is loaded from a saved game. | |||
| item 4 = OnMapTransition | |||
| item 4 desc = Fired when the map is loaded due to a level transition. | |||
| item 5 = OnBackgroundMap | |||
| item 5 desc = Fired when the map is loaded as a background to the main menu using {{ent|map_background}}. | |||
| item 6 = OnMultiNewMap | |||
| item 6 desc = Fired shortly after the entity spawns but only in multiplayer and if the round wasn't restarted | |||
| item 7 = OnMultiNewRound | |||
| item 7 desc = Fired shortly after the entity spawns but only in multiplayer and if round was restarted | |||
{{Warning|{{tf}} Does not get fired when tournament mode is enabled (mp_tournament 1). Use OnMapSpawn instead}} | |||
| item 8 = OnViolenceLow | |||
| item 8 desc = <div> {{only|{{sineps}}}} </div> Fired when the map is loaded for any reason if the game is in low-violence mode. | |||
| item 9 = OnViolenceHigh | |||
| item 9 desc = <div> {{only|{{sineps}}}} </div> Fired when the map is loaded for any reason if the game is not in low-violence mode. | |||
}} |
Revision as of 15:13, 4 May 2024
It fires outputs immediately after a map loads, unlike most other entities that wait for input first. It can be set to check a global state before firing, which allows you to fire events based on what took place in a previous map.
![]() |
---|
CLogicAuto |
![]() |


OnSpawn
output.



OnNewGame
/OnBackgroundMap
(exactly one of these, see below), OnMapSpawn
and OnMultiNewMap
in this order.

OnMultiNewRound
is actually fired in response to the game events round_start
and teamplay_round_start
and does not depend on the Global State to Read
. When a round is reset, it is fired before the previous 3, but not when a map is loaded.Keyvalues

This article has been marked as a candidate for speedy deletion because it is unwanted by the author.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.
Flags

This article has been marked as a candidate for speedy deletion because it is unwanted by the author.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.
Outputs

This article has been marked as a candidate for speedy deletion because it is unwanted by the author.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators / Moderators - Remember to check if anything links here and the page history before deleting.