Commands/Lua
Reference for console commands, Lua hooks and Lua commands in CS2D.
- Console Commands are entered in console, executed with key-binds, cfg-files or with Lua parse
- Lua Hooks execute Lua when events occur - some have a return value which can change the game behavior
- Lua Commands are used to retrieve game data or to perform actions in Lua scripts
CS2D Console Commands
Lua Hooks
Category: object (5)
hitzone
Categories
Parameters
- image id: dynamic object id of image with hit zone (the image that was hit)
- player id: id of player who shot (or player who built the shooting object)
- object id: id of dynamic object that shot (or 0 if shot is from a player)
- weapon: weapon type ID (can also have other, higher values in case of turrets, NPCs etc)
- impact x: impact x position (in pixels)
- impact y: impact y position (in pixels)
- damage: damage of the shot that hit the hit zone
Info
When a hit zone (assigned with imagehitzone) of a Lua image is hit by a shot/attack.
You can change the damage of the shot by returning something different than 0. This way you can make barriers which reduce the damage of a shot but don't completely stop/neutralize it.
You can change the damage of the shot by returning something different than 0. This way you can make barriers which reduce the damage of a shot but don't completely stop/neutralize it.
Note: player id is 0 if the hitzone was hit by an NPC or by a neutral turret
Note: object id is 0 if the hitzone was hit by a player
Note: player id and object id are both not 0 at the same time if the hitzone was hit by a turret which is owned by a player (player is is then the id of the player who built that turret)
Note: The shot will simply pass through the hitzone if it is a non-blocking hit zone (hit zones with mode <=100).
Note: In case of a non-blocking hit zone the shot will even continue if you set its damage to 0. So it will LOOK like the shot passed through but everything which is hit afterwards won't get damaged.
Return Values
- 0: proceed normally (without changing the damage)
- >0: set damage to this value
- <0: set damage to 0