Info gamemode: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (Fix minor grammar mistake)
 
(21 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{lang|Info gamemode}}
{{LanguageBar}}
{{CD|CInfoGameMode}}
{{CD|CInfoGameMode}}
{{Entity|info_gamemode|sprite=1|type=e0|series=Left 4 Dead}} When a map is loaded, this entity can fire outputs depending on the current game mode. This allows the all game modes to be available in a single map instead of having separate maps for each game mode. {{clr}}
{{this is a|logical entity|sprite=1|name=info_gamemode|series=Left 4 Dead}} When a map is loaded, this entity can fire outputs depending on the current game mode. This allows all game modes to be available in a single map instead of having separate maps for each game mode. {{clr}}
{{note|This entity counts as an [[edict]]. There is also not much reason to use more than one per map as the entity can hold any number of outputs.}}


== Keyvalues ==
== Outputs ==
{{KV Targetname}}
{{O|OnCoop}}
{{O|OnVersus}}
{{O|OnSurvival}}
{{O|OnScavenge|Fired when the map spawns in specified mode.
:{{note|OnCoop fires in realism}}
:{{bug|Killing the info_gamemode itself in one of these outputs with 0 delay crashes the game|tested=l4d2}}|in=L4D2}}
 
{{O|OnCoopPostIO|only={{l4d2}}}}
{{O|OnVersusPostIO|only={{l4d2}}}}
{{O|OnSurvivalPostIO|only={{l4d2}}}}
{{O|OnScavengePostIO|Fired shortly after all scavenge items have been populated|only={{l4d2}}}}
:{{note|This doesn't mean item populating causes the output to be fired, mentioning item being populated just as a frame of reference}}
:{{tip|Useful when wanting to spawn templated weapon_* entities and not have it affected by info_map_parameters densities {{confirm}}}}
:{{Confusion|Description in FGD is not correct. This output does fire later than On<Mode> outputs but it doesn't wait until IO generated by it finishes. Doesn't even wait for the delays specified in On<Mode> outputs to expire.}}
{{bug*|On<mode> and On<mode>PostIO outputs simply check base gamemode to determine whether to fire. So if a [[mode file]] specifies something else than coop, realism, versus, scavenge, survival as its base none of them will fire}} <!-- not sure if this warning should be on this page since it feels quite useless to whoever works with info_gamemode -->
 
{{O|OnScavengeMatchStart|Fired on the first map load of a scavenge match. Doesn't fire on round restarts. {{note|Fires shortly after OnGameplayStart of info_director is fired}}|only={{l4d2}}}}
{{O|OnNavAnalyze|Fired when the map is loaded with -navanalyze on the command line.|only={{l4d2}}}}


== Inputs ==
== Inputs ==
{{IO|PostSpawnActivate|Unknown. Appears to crash}}
{{I|PostSpawnActivate|Called internally and causes On<Mode> output to fire. {{warning|Crashes the game via infinite recursion if used by [[I/O]] system. Internally it's called using AcceptInput function which isn't exposed to vscript.}}|nofgd=1}}
{{IO|PreRoundActivate|Unknown.}}
{{I|PreRoundActivate|Called internally and causes On<Mode>PostIO output to fire.|nofgd=1}}
{{IO|FireScavengeMatchStart|Unknown.}}
{{I|FireScavengeMatchStart|Called internally and causes OnScavengeMapStart output to fire.|nofgd=1}}


== Outputs ==
{{Idea|Vscripts [[Left_4_Dead_2/Script_Functions#Hooks|Input{{!(}}InputName{{)!}}]] hook can be used  on these. {{todo| What happens when preventing these to fire by returning false ?}} }}
{{IO|OnCoop|Fired when the map spawns in coop games.}}
{{IO|OnVersus|Fired when the map spawns in versus games.}}
{{IO|OnSurvival|Fired when the map spawns in survival games.}}
{{IO|OnScavenge|Fired when the map spawns in scavenge mode.|in=L4D2}}
{{IO|OnCoopPostIO|Fired after all entity IO generated by <code>OnCoop</code> has finished.|since=L4D2}}
{{IO|OnVersusPostIO|Fired after all entity IO generated by <code>OnVersus</code> has finished|since=L4D2}}
{{IO|OnSurvivalPostIO|Fired after all entity IO generated by <code>OnSurvival</code> has finished|since=L4D2}}
{{IO|OnScavengePostIO|Fired after all entity IO generated by <code>OnScavenge</code> has finished|since=L4D2}}
{{IO|OnScavengeMatchStart|Fired on the first map load of a scavenge match. Doesn't fire on round restarts.|since=L4D2}}
{{IO|OnNavAnalyze|Fired when the map is loaded with -navanalyze on the command line.|since=L4D2}}


== See Also ==
== See also ==
* {{ent|logic_auto}}
* [[Left 4 Dead Level Creation]]
* [[Left 4 Dead Level Creation]]
* [[Left 4 Dead 2 Level Creation]]
* [[Left 4 Dead 2 Level Creation]]

Latest revision as of 18:52, 18 July 2025

English (en)Translate (Translate)
C++ Class hierarchy
CInfoGameMode
CBaseEntity
Info gamemode.png

info_gamemode is a logical entity available in Left 4 Dead seriesLeft 4 Dead series Left 4 Dead series. When a map is loaded, this entity can fire outputs depending on the current game mode. This allows all game modes to be available in a single map instead of having separate maps for each game mode.

Note.pngNote:This entity counts as an edict. There is also not much reason to use more than one per map as the entity can hold any number of outputs.

Outputs

OnCoop
OnVersus
OnSurvival
OnScavenge
Fired when the map spawns in specified mode.
Note.pngNote:OnCoop fires in realism
Icon-Bug.pngBug:Killing the info_gamemode itself in one of these outputs with 0 delay crashes the game  (tested in: l4d2)


OnCoopPostIO  (only in Left 4 Dead 2)
OnVersusPostIO  (only in Left 4 Dead 2)
OnSurvivalPostIO  (only in Left 4 Dead 2)
OnScavengePostIO  (only in Left 4 Dead 2)
Fired shortly after all scavenge items have been populated
Note.pngNote:This doesn't mean item populating causes the output to be fired, mentioning item being populated just as a frame of reference
Tip.pngTip:Useful when wanting to spawn templated weapon_* entities and not have it affected by info_map_parameters densities [confirm]
Warning.pngRisk of Confusion:Description in FGD is not correct. This output does fire later than On<Mode> outputs but it doesn't wait until IO generated by it finishes. Doesn't even wait for the delays specified in On<Mode> outputs to expire.
Icon-Bug.pngBug*:On<mode> and On<mode>PostIO outputs simply check base gamemode to determine whether to fire. So if a mode file specifies something else than coop, realism, versus, scavenge, survival as its base none of them will fire


OnScavengeMatchStart  (only in Left 4 Dead 2)
Fired on the first map load of a scavenge match. Doesn't fire on round restarts.
Note.pngNote:Fires shortly after OnGameplayStart of info_director is fired
OnNavAnalyze  (only in Left 4 Dead 2)
Fired when the map is loaded with -navanalyze on the command line.

Inputs

PostSpawnActivate  !FGD
Called internally and causes On<Mode> output to fire.
Warning.pngWarning:Crashes the game via infinite recursion if used by I/O system. Internally it's called using AcceptInput function which isn't exposed to vscript.
PreRoundActivate  !FGD
Called internally and causes On<Mode>PostIO output to fire.
FireScavengeMatchStart  !FGD
Called internally and causes OnScavengeMapStart output to fire.
Tip.pngIdea:Vscripts Input[InputName] hook can be used on these.
Todo:  What happens when preventing these to fire by returning false ?

See also