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
Lua Commands
Category: image (18)
imagehitzoneCategories
Parameters
- id
- mode
- [x-offset] (optional)
- [y-offset] (optional)
- [width] (optional)
- [height] (optional)
Info
Adds, removes or modifies a hit zone for an image which reacts to shots/attacks
Each hit zone will trigger the hitzone-hook when it is hit by a shot/attack.
Available modes are:
Non-Blocking Modes (<=100, shots will pass through)
- 0 - no hit zone (this removes existing hit zones, other parameters don't matter)
- 1 - hit zone without effects (just register)
- 2 - wall effect
- 3 - blood effect
- 4 - green blood effect
Blocking Modes (>100, shots will get stopped)
- 101 - hit zone without effects + stop shot
- 102 - wall effect + stop shot
- 103 - blood effect + stop shot
- 104 - green blood effect + stop shot
All hit zones with modes which are higher than 100 will block the shots (objects behind them will not be damaged). They basically behave like walls but they have no influence on player movement or vision.
Note: Images are normally centered. So a hit zone for a 100x100 pixel image should have the values:
x-offset: -50
y-offset: -50
width: 100
height: 100
So x-offset is commonly -width/2 and y-offset -height/2
Note: Each image can have only one hit zone. If you call imagehitzone multiple times on the same image, the existing hit zone will be modified!
Note: You can call imagehitzone with mode 0 on an image which already has a hit zone to remove the hit zone completely.
Attention: The hit zone is always rectangular without rotation. Image rotation does NOT affect the hit zone in any way.
Attention: Defining a big number of hit zones can have a bad impact on the game performance (when shooting)!
Attention: Hit zones do not work with images which are drawn as HUD (image mode 2)!
Attention: Very thin hit zones might not react properly to all shots. A minimum width/height of 10 pixels is recommended!
Categories
Parameters
- id
- mode
- [x-offset] (optional)
- [y-offset] (optional)
- [width] (optional)
- [height] (optional)
Info
Adds, removes or modifies a hit zone for an image which reacts to shots/attacks
Each hit zone will trigger the hitzone-hook when it is hit by a shot/attack.
Available modes are:
Non-Blocking Modes (<=100, shots will pass through)
Blocking Modes (>100, shots will get stopped)
All hit zones with modes which are higher than 100 will block the shots (objects behind them will not be damaged). They basically behave like walls but they have no influence on player movement or vision.
Each hit zone will trigger the hitzone-hook when it is hit by a shot/attack.
Available modes are:
Non-Blocking Modes (<=100, shots will pass through)
- 0 - no hit zone (this removes existing hit zones, other parameters don't matter)
- 1 - hit zone without effects (just register)
- 2 - wall effect
- 3 - blood effect
- 4 - green blood effect
Blocking Modes (>100, shots will get stopped)
- 101 - hit zone without effects + stop shot
- 102 - wall effect + stop shot
- 103 - blood effect + stop shot
- 104 - green blood effect + stop shot
All hit zones with modes which are higher than 100 will block the shots (objects behind them will not be damaged). They basically behave like walls but they have no influence on player movement or vision.
Note: Images are normally centered. So a hit zone for a 100x100 pixel image should have the values:
x-offset: -50
y-offset: -50
width: 100
height: 100
So x-offset is commonly -width/2 and y-offset -height/2
x-offset: -50
y-offset: -50
width: 100
height: 100
So x-offset is commonly -width/2 and y-offset -height/2
Note: Each image can have only one hit zone. If you call imagehitzone multiple times on the same image, the existing hit zone will be modified!
Note: You can call imagehitzone with mode 0 on an image which already has a hit zone to remove the hit zone completely.
Attention: The hit zone is always rectangular without rotation. Image rotation does NOT affect the hit zone in any way.
Attention: Defining a big number of hit zones can have a bad impact on the game performance (when shooting)!
Attention: Hit zones do not work with images which are drawn as HUD (image mode 2)!
Attention: Very thin hit zones might not react properly to all shots. A minimum width/height of 10 pixels is recommended!