CS2 Workshop Tools scripting: cs_script, point_script entities, and the API Valve documents

A place to share, discuss, and download mods and custom maps created for CS 1.6.
Post Reply
ice
Site Admin
Posts: 90
Joined: Tue Aug 27, 2024 5:17 am

CS2 Workshop Tools scripting: cs_script, point_script entities, and the API Valve documents

Post by ice »

Quick summary

CS2 custom maps can run JavaScript. The system is called cs_script, it lives on a point_script entity inside your map, and Valve publishes the API reference on the Developer Community wiki. This covers where the scripting system sits, what an addon needs to run it, and which parts of the API are documented.

Where scripting fits in a CS2 addon

A CS2 addon is a folder under content/csgo_addons. Inside it you have maps, materials, models and a scripts folder. A map that wants logic places a point_script entity in Hammer and points it at a JavaScript file.

The scripting system in CS2 is cs_script, which uses JavaScript. That is a change from earlier Source 2 titles: Half-Life: Alyx, Dota 2 and SteamVR Home used Lua-based VScript, and CS:GO used Squirrel-based VScript. Valve also has a visual scripting system called Pulse, but it is not available to end users.

Valve ships a demonstration map. The documentation calls it script_zoo and the .vmap file sits at content/csgo/maps/editor/zoo. You can also load it from the console with map editor/zoo/script_zoo. A separate cs_script_demo.vmap lives in content/csgo_addons/cs_script_demo/maps and demonstrates the point_script entity.

The API surface

Scripts attached to a point_script entity import the top level API from "cs_script/point_script". The documented classes include:
  • Instance, the top level API for a script attached to a point_script entity, with methods and hooks.
  • Entity, for working with entities the script holds a handle to.
  • CSWeaponType, an enum covering KNIFE, PISTOL, SUBMACHINEGUN, RIFLE, SHOTGUN, SNIPER_RIFLE, MACHINEGUN, C4, TASER, GRENADE, EQUIPMENT, STACKABLEITEM and UNKNOWN.
  • CustomCameraMode, an enum for scripted cameras with DISABLED, CONTROLLED, CONTROLLED_POSITION and FOLLOW_POSITION.
  • CSWeaponAttackType, an enum with INVALID, PRIMARY and SECONDARY.
The API page also documents type aliases that scripts use, including Vector, QAngle, Color, InputValue and BeforeDamageResult.

What the 2026 updates added

Valve has been adding scripting surface in the regular updates rather than in one batch. From the official update list:
  • September 22, 2026 added the CSRadarPoint and CSObservablePoint entities, the AddTeamMoney API method, and the OnPlayerTeamChanged callback.
  • September 9, 2026 reworked the scripted camera class, renaming CSPlayerCamera to CustomPlayerCamera and adding GetPlayer, GetMode, SetMode and SetFollowConfig.
  • August 24, 2026 added the custom_hud_layout entity and the cs_player_camera entity, plus Instance.Delay, Instance.OnBombPlantStart, Instance.OnBombPlantAbort, Instance.OnBombDefuseStart, Instance.OnBombDefuseAbort, Instance.OnCustomHudClicked and Instance.IsDedicatedServer.
  • August 3, 2026 added Instance.TracePlayer, Instance.OnWeaponPickup, Instance.OnBombExplode and Instance.SpawnGrenadeProjectile.
  • August 19, 2026 updated the community workshop versions of the Boulder and Poseidon maps.
A note on documentation gaps

The Scripting page carries an update-needed banner and two open todos, one about Pulse and one about JavaScript. Treat the wiki as a starting point and read the shipped demo map for working patterns. Errors thrown during the initial script run are logged to the console, which is the fastest way to find a typo in a new script.

Sources
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests