Counter-Strike 2 Expands Workshop Map Scripting Capabilities
On Thursday, February 26th, the developers released a patch for Counter-Strike 2, primarily focused on expanding the scripting capabilities for workshop maps. In addition to new tools, the update addressed a number of technical inaccuracies and expanded the compatibility of guides for the de_ancient map.
The patch added a save data system with Steam Cloud support — workshop maps can now save up to 1 MB of data, with saves synchronized via Steam Cloud and remaining accessible even after reinstalling the game. The save file size limit can be configured using the sv_workshop_map_save_data_max_filesize_mb command.
New functions have been added for working with saves:
- Instance.SetSaveData — allows saving data
- Instance.GetSaveData — provides access to saved data
Damage handling capabilities have been expanded:
- Added the Instance.OnModifyPlayerDamage function, which is called after all damage parameters are calculated — just before modifying the player's armor and health. It replaces Instance.OnBeforePlayerDamage and includes the hitgroup parameter in the event data.
- The hitgroup parameter has also been added to the OnPlayerDamage event data.
- The CSDamageFlags.IGNORE_ARMOR flag has been introduced, expanding damage customization options.
The following methods have been added for handling player input:
- CSPlayerPawn.IsInputPressed — checks if a specific key is currently being held
- CSPlayerPawn.WasInputJustPressed — determines if a key was pressed in the last frame
- CSPlayerPawn.WasInputJustReleased — captures the moment a key is released
The CSInputs enumeration has also been introduced, simplifying work with various input types.
Furthermore, a bug that caused CSDamageTypes to be exported under the name CSDamageType has been fixed.
The developers have expanded guide compatibility. Guides for the de_ancient map can now be used on de_ancient_night and vice versa. This simplifies navigation and learning for players familiar with the classic version of the location.