Half-Life 2: Deathmatch/Scripting/Game Events: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{{toc-right}} This article lists game events in Half-Life 2: Deathmatch. These were retrieved from <code>serverevents.res</code>, <code>gameevents.res</code> and <code>modevents.res</code> in the <code>resource</code> folder. {{warning|Some events have parameter 'class' which cannot be accessed with dot syntax, i.e. <code>params.class</code>, as <code>class</code> is a reserved word in Squirrel. Instead, use string indexing like so: <code>params["class"]</code>}} {{t...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{toc-right}}
{{toc-right}}{{back|VScript}}
This article lists game events in [[Half-Life 2: Deathmatch]]. These were retrieved from <code>serverevents.res</code>, <code>gameevents.res</code> and <code>modevents.res</code> in the <code>resource</code> folder.
This article lists game events in [[Half-Life 2: Deathmatch]], in addition to the [[Source 2013 MP/Scripting/Game Events|base game events]]. These were retrieved from <code>modevents.res</code> in the <code>resource</code> folder.
{{warning|Some events have parameter 'class' which cannot be accessed with dot syntax, i.e. <code>params.class</code>, as <code>class</code> is a reserved word in Squirrel. Instead, use string indexing like so: <code>params["class"]</code>}}
{{warning|Some events have parameter 'class' which cannot be accessed with dot syntax, i.e. <code>params.class</code>, as <code>class</code> is a reserved word in Squirrel. Instead, use string indexing like so: <code>params["class"]</code>}}
{{tip|To see what events fire during the game, download [https://raw.githubusercontent.com/ficool2/vscript_tf/refs/heads/main/scripts/vscripts/showevents.nut this script] (right click and ''Save Page''), place it into your <code>scripts/vscripts/</code> folder and run <code>script_execute showevents</code> in console.}}
{{tip|To see what events fire during the game, download [https://raw.githubusercontent.com/ficool2/vscript_tf/refs/heads/main/scripts/vscripts/showevents.nut this script] (right click and ''Save Page''), place it into your <code>scripts/vscripts/</code> folder and run <code>script_execute showevents</code> in console.}}
Line 6: Line 6:


== achievement_earned ==
== achievement_earned ==
Unused, as HL2DM lacks achievements.
* <b>player</b> <small>(byte)</small> - entindex of the player
* <b>player</b> <small>(byte)</small> - entindex of the player
* <b>achievement</b> <small>(short)</small> - achievement ID
* <b>achievement</b> <small>(short)</small> - achievement ID
== achievement_event ==
* <b>achievement_name</b> <small>(string)</small> - non-localized name of achievement
* <b>cur_val</b> <small>(short)</small> - # of steps toward achievement
* <b>max_val</b> <small>(short)</small> - total # of steps in achievement
== achievement_increment ==
* <b>achievement_id</b> <small>(long)</small> - ID of achievement that went up
* <b>cur_val</b> <small>(short)</small> - # of steps toward achievement
* <b>max_val</b> <small>(short)</small> - total # of steps in achievement
== ammo_pickup ==
* <b>ammo_index</b> <small>(long)</small>
* <b>amount</b> <small>(long)</small>
* <b>total</b> <small>(long)</small>
== base_player_teleported ==
* <b>entindex</b> <small>(short)</small>
== bonus_updated ==
* <b>numadvanced</b> <small>(short)</small>
* <b>numbronze</b> <small>(short)</small>
* <b>numsilver</b> <small>(short)</small>
* <b>numgold</b> <small>(short)</small>
== break_breakable ==
* <b>entindex</b> <small>(long)</small>
* <b>userid</b> <small>(short)</small>
* <b>material</b> <small>(byte)</small> - BREAK_GLASS, BREAK_WOOD, etc
== break_prop ==
* <b>entindex</b> <small>(long)</small>
* <b>userid</b> <small>(short)</small>
== browse_replays ==
== cart_updated ==
== client_beginconnect ==
client tries to connect to server
* <b>address</b> <small>(string)</small> - Name we used to connect to the server
* <b>ip</b> <small>(long)</small>
* <b>port</b> <small>(short)</small> - server port
* <b>source</b> <small>(string)</small> - what caused us to attempt this connection?  (blank for general command line, "serverbrowser", "quickplay", etc)
== client_connected ==
client has completed the challenge / handshake process and is in SIGNONSTATE_CONNECTED
* <b>address</b> <small>(string)</small> - Name we used to connect to the server
* <b>ip</b> <small>(long)</small>
* <b>port</b> <small>(short)</small> - server port
== client_disconnect ==
client side disconnect message
* <b>message</b> <small>(string)</small> - Why are we disconnecting?  This could be a localization token or an English-language string
== client_fullconnect ==
* <b>address</b> <small>(string)</small> - Name we used to connect to the server
* <b>ip</b> <small>(long)</small>
* <b>port</b> <small>(short)</small> - server port
== econ_inventory_connected ==
== enter_vehicle ==
* <b>vehicle</b> <small>(long)</small> - entindex of the vehicle
== entered_performance_mode ==
== entity_killed ==
* <b>entindex_killed</b> <small>(long)</small>
* <b>entindex_attacker</b> <small>(long)</small>
* <b>entindex_inflictor</b> <small>(long)</small>
* <b>damagebits</b> <small>(long)</small>
== flare_ignite_npc ==
* <b>entindex</b> <small>(long)</small> - entity ignited
== game_end ==
a game ended
* <b>winner</b> <small>(byte)</small> - winner team/user id
== game_init ==
sent when a new game is started
== game_message ==
a message send by game logic to everyone
* <b>target</b> <small>(byte)</small> - 0 = console, 1 = HUD
* <b>text</b> <small>(string)</small> - the message text
== game_newmap ==
send when new map is completely loaded
* <b>mapname</b> <small>(string)</small> - map name
== game_start ==
a new game starts
* <b>roundslimit</b> <small>(long)</small> - max round
* <b>timelimit</b> <small>(long)</small> - time limit
* <b>fraglimit</b> <small>(long)</small> - frag limit
* <b>objective</b> <small>(string)</small> - round objective
== gameui_activate ==
== gameui_hide ==
== gc_lost_session ==
== gc_new_session ==
== helicopter_grenade_punt_miss ==
== hltv_changed_mode ==
* <b>oldmode</b> <small>(short)</small>
* <b>newmode</b> <small>(short)</small>
* <b>obs_target</b> <small>(short)</small>
== hltv_changed_target ==
* <b>mode</b> <small>(short)</small>
* <b>old_target</b> <small>(short)</small>
* <b>obs_target</b> <small>(short)</small>
== host_quit ==
== inventory_updated ==
== item_schema_initialized ==
== leave_vehicle ==
* <b>vehicle</b> <small>(long)</small> - entindex of the vehicle
== physgun_pickup ==
* <b>entindex</b> <small>(long)</small> - entity picked up
== player_activate ==
* <b>userid</b> <small>(short)</small> - user ID on server
== player_changename ==
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>oldname</b> <small>(string)</small> - players old (current) name
* <b>newname</b> <small>(string)</small> - players new name
== player_chat ==
a public player chat
* <b>teamonly</b> <small>(bool)</small> - true if team only chat
* <b>userid</b> <small>(short)</small> - chatting player
* <b>text</b> <small>(string)</small> - chat text
== player_class ==
a player changed his class
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>class</b> <small>(string)</small> - new player class / model
== player_connect ==
a new client connected - we should only really have server listeners for this, due to the IP being exposed
* <b>name</b> <small>(string)</small> - player name
* <b>index</b> <small>(byte)</small> - player slot (entity index-1)
* <b>userid</b> <small>(short)</small> - user ID on server (unique on server)
* <b>networkid</b> <small>(string)</small> - player network (i.e steam) id
* <b>address</b> <small>(string)</small> - ip:port
* <b>bot</b> <small>(short)</small> - is a bot
== player_connect_client ==
a new client connected
* <b>name</b> <small>(string)</small> - player name
* <b>index</b> <small>(byte)</small> - player slot (entity index-1)
* <b>userid</b> <small>(short)</small> - user ID on server (unique on server)
* <b>networkid</b> <small>(string)</small> - player network (i.e steam) id
* <b>bot</b> <small>(short)</small> - is a bot


== player_death ==
== player_death ==
Line 180: Line 15:
* <b>attacker</b> <small>(short)</small> - user ID who killed
* <b>attacker</b> <small>(short)</small> - user ID who killed
* <b>weapon</b> <small>(string)</small> - weapon name killed used
* <b>weapon</b> <small>(string)</small> - weapon name killed used
== player_disconnect ==
a client was disconnected
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>reason</b> <small>(string)</small> - "self", "kick", "ban", "cheat", "error"
* <b>name</b> <small>(string)</small> - player name
* <b>networkid</b> <small>(string)</small> - player network (i.e steam) id
* <b>bot</b> <small>(short)</small> - is a bot
== player_hintmessage ==
* <b>hintmessage</b> <small>(string)</small> - localizable string of a hint
== player_hurt ==
* <b>userid</b> <small>(short)</small> - player index who was hurt
* <b>attacker</b> <small>(short)</small> - player index who attacked
* <b>health</b> <small>(byte)</small> - remaining health points
== player_info ==
a player changed his name
* <b>name</b> <small>(string)</small> - player name
* <b>index</b> <small>(byte)</small> - player slot (entity index-1)
* <b>userid</b> <small>(short)</small> - user ID on server (unique on server)
* <b>networkid</b> <small>(string)</small> - player network (i.e steam) id
* <b>bot</b> <small>(bool)</small> - true if player is a AI bot
== player_say ==
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>text</b> <small>(string)</small> - the say text
== player_score ==
players scores changed
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>kills</b> <small>(short)</small> - # of kills
* <b>deaths</b> <small>(short)</small> - # of deaths
* <b>score</b> <small>(short)</small> - total game score
== player_shoot ==
player shoot his weapon
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>weapon</b> <small>(byte)</small> - weapon ID
* <b>mode</b> <small>(byte)</small> - weapon mode
== player_spawn ==
player spawned in game
* <b>userid</b> <small>(short)</small> - user ID on server
== player_team ==
player change his team
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>team</b> <small>(byte)</small> - team id
* <b>oldteam</b> <small>(byte)</small> - old team id
* <b>disconnect</b> <small>(bool)</small> - team change because player disconnects
* <b>autoteam</b> <small>(bool)</small> - true if the player was auto assigned to the team
* <b>silent</b> <small>(bool)</small> - if true wont print the team join messages
* <b>name</b> <small>(string)</small> - player's name
== player_use ==
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>entity</b> <small>(short)</small> - entity used by player
== ragdoll_dissolved ==
* <b>entindex</b> <small>(long)</small>
== replay_saved ==
== replay_youtube_stats ==
* <b>views</b> <small>(long)</small>
* <b>likes</b> <small>(long)</small>
* <b>favorited</b> <small>(long)</small>
== round_end ==
* <b>winner</b> <small>(byte)</small> - winner team/user i
* <b>reason</b> <small>(byte)</small> - reson why team won
* <b>message</b> <small>(string)</small> - end round message
== round_start ==
* <b>timelimit</b> <small>(long)</small> - round time limit in seconds
* <b>fraglimit</b> <small>(long)</small> - frag limit in seconds
* <b>objective</b> <small>(string)</small> - round objective
== server_addban ==
* <b>name</b> <small>(string)</small> - player name
* <b>userid</b> <small>(short)</small> - user ID on server
* <b>networkid</b> <small>(string)</small> - player network (i.e steam) id
* <b>ip</b> <small>(string)</small> - IP address
* <b>duration</b> <small>(string)</small> - length of the ban
* <b>by</b> <small>(string)</small> - banned by...
* <b>kicked</b> <small>(bool)</small> - whether the player was also kicked
== server_changelevel_failed ==
* <b>levelname</b> <small>(string)</small> - The level name that failed changelevel
== server_cvar ==
a server console var has changed
* <b>cvarname</b> <small>(string)</small> - cvar name, eg "mp_roundtime"
* <b>cvarvalue</b> <small>(string)</small> - new cvar value
== server_message ==
a generic server message
* <b>text</b> <small>(string)</small> - the message text
== server_removeban ==
* <b>networkid</b> <small>(string)</small> - player network (i.e steam) id
* <b>ip</b> <small>(string)</small> - IP address
* <b>by</b> <small>(string)</small> - removed by...
== server_shutdown ==
server shut down
* <b>reason</b> <small>(string)</small> - reason why server was shut down
== server_spawn ==
send once a server starts
* <b>hostname</b> <small>(string)</small> - public host name
* <b>address</b> <small>(string)</small> - hostame, IP or DNS name
* <b>ip</b> <small>(long)</small>
* <b>port</b> <small>(short)</small> - server port
* <b>game</b> <small>(string)</small> - game dir
* <b>mapname</b> <small>(string)</small> - map name
* <b>maxplayers</b> <small>(long)</small> - max players
* <b>os</b> <small>(string)</small> - WIN32, LINUX
* <b>dedicated</b> <small>(bool)</small> - true if dedicated server
* <b>password</b> <small>(bool)</small> - true if password protected
== single_player_death ==
== spec_target_updated ==
== store_pricesheet_updated ==
== take_armor ==
* <b>amount</b> <small>(long)</small>
* <b>total</b> <small>(long)</small>
== take_health ==
* <b>amount</b> <small>(long)</small>
* <b>total</b> <small>(long)</small>
* <b>entindex</b> <small>(long)</small>
== team_info ==
info about team
* <b>teamid</b> <small>(byte)</small> - unique team id
* <b>teamname</b> <small>(string)</small> - team name eg "Team Blue"
== team_score ==
team score changed
* <b>teamid</b> <small>(byte)</small> - team id
* <b>score</b> <small>(short)</small> - total team score
== teamplay_broadcast_audio ==
emits a sound to everyone on a team
* <b>team</b> <small>(byte)</small> - unique team id
* <b>sound</b> <small>(string)</small> - name of the sound to emit


== teamplay_round_start ==
== teamplay_round_start ==
Line 337: Line 20:
* <b>full_reset</b> <small>(bool)</small> - is this a full reset of the map
* <b>full_reset</b> <small>(bool)</small> - is this a full reset of the map


== user_data_downloaded ==
== spec_target_updated ==
fired when achievements/stats are downloaded from Steam or XBox Live
 
== vote_cast ==
* <b>vote_option</b> <small>(byte)</small> - which option the player voted on
* <b>team</b> <small>(short)</small>
* <b>entityid</b> <small>(long)</small> - entity id of the voter
* <b>voteidx</b> <small>(long)</small>
 
== vote_changed ==
* <b>vote_option1</b> <small>(byte)</small>
* <b>vote_option2</b> <small>(byte)</small>
* <b>vote_option3</b> <small>(byte)</small>
* <b>vote_option4</b> <small>(byte)</small>
* <b>vote_option5</b> <small>(byte)</small>
* <b>potentialVotes</b> <small>(byte)</small>
* <b>voteidx</b> <small>(long)</small>
 
== vote_ended ==
 
== vote_failed ==
* <b>team</b> <small>(byte)</small>
* <b>voteidx</b> <small>(long)</small>
 
== vote_options ==
* <b>count</b> <small>(byte)</small> - Number of options - up to MAX_VOTE_OPTIONS
* <b>option1</b> <small>(string)</small>
* <b>option2</b> <small>(string)</small>
* <b>option3</b> <small>(string)</small>
* <b>option4</b> <small>(string)</small>
* <b>option5</b> <small>(string)</small>
* <b>voteidx</b> <small>(long)</small>
 
== vote_passed ==
* <b>details</b> <small>(string)</small>
* <b>param1</b> <small>(string)</small>
* <b>team</b> <small>(byte)</small>
* <b>voteidx</b> <small>(long)</small>
 
== vote_started ==
* <b>issue</b> <small>(string)</small>
* <b>param1</b> <small>(string)</small>
* <b>team</b> <small>(byte)</small>
* <b>initiator</b> <small>(long)</small> - entity id of the player who initiated the vote
* <b>voteidx</b> <small>(long)</small>
 
== weapon_equipped ==
* <b>class</b> <small>(string)</small>
* <b>entindex</b> <small>(long)</small>
* <b>owner_entindex</b> <small>(long)</small>

Latest revision as of 12:43, 5 June 2025

VScript

This article lists game events in Half-Life 2: Deathmatch, in addition to the base game events. These were retrieved from modevents.res in the resource folder.

Warning.pngWarning:Some events have parameter 'class' which cannot be accessed with dot syntax, i.e. params.class, as class is a reserved word in Squirrel. Instead, use string indexing like so: params["class"]
Tip.pngTip:To see what events fire during the game, download this script (right click and Save Page), place it into your scripts/vscripts/ folder and run script_execute showevents in console.
Todo: Distinguish which events are clientside and/or serverside

achievement_earned

Unused, as HL2DM lacks achievements.

  • player (byte) - entindex of the player
  • achievement (short) - achievement ID

player_death

a game event, name may be 32 charaters long

  • userid (short) - user ID who died
  • attacker (short) - user ID who killed
  • weapon (string) - weapon name killed used

teamplay_round_start

round restart

  • full_reset (bool) - is this a full reset of the map

spec_target_updated