info_command

message
targetname

This key takes the form of a console command. When triggered, the command is executed as normal. For example
"message" "r_wateralpha 1"
This can be a quick way to ensure the ideal wateralpha value is set for your map when it is loaded, regardless of the player’s previous r_wateralpha setting. As of Quoth 2.2 you no longer need to terminate commands with \n, by default the mod does this for you. If you need the old behaviour back, apply spawnflag 8 to the entity. Multiple commands can be sent at once if the commands are separated by a semicolon.

Some commands are not sensible to send via info_command – for example cheat commands which toggle a state like “god” cause a problem because you may not know whether you are enabling or disabling the status.

Note that this is a point entity and therefore does not require a brush model or an engine precache. It does require something to trigger it, however, via its targetname.

Co-op
If you want to support co-op in your map, you need to carefully plan your use of info_command. Firstly you must consider whether the command needs to go to the server or client. Commands that affect the renderer e.g. v_cshift, fog, r_wateralpha, gl_farclip should be sent to the client. Commands that affect the physics like sv_gravity, host_framerate need to go to the server instead, using an info_command_server. You also need to consider which players in the server need to receive the command. The default is for all players to be sent the command string. If you only want the activating player to receive the command, set spawnflags 2 on the info_command.

Saved Games
The info_command class will update the environment variables if spawnflag 4 is set, see the linked article for details.

<-Back to the tutorial

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s