Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Command Lua Commands

Category: projectile (2)

Lua Command projectile

Categories

Parameters

  • id
  • player
  • "value"

Info

Returns a value of a projectile (projectiles are grenades and most stuff launched by weapons which is visible for multiple frames. Regular bullets are NO projectiles though):

  • exists: boolean, true if projectile with this ID exists, false otherwise

  • type: internal type ID (equal to the IDs of the corresponding weapons)
    items

  • x: current x position on map (in pixels)

  • y: current y position on map (in pixels)

  • dir: current flight direction

  • rot: current rotation angle (just for the visual effect)

  • flydist: distance in pixel this projectile will fly (relevant for flying projectiles)

  • time: countdown in seconds until object will be removed (relevant for ground projectiles)



Note: Projectiles are managed in two lists: "flying" and "ground"! "flying" holds all projectiles which are currently flying. "ground" holds the projectiles which are idle on the ground.

Note: Projectiles in the ground list never move even if their values (like "flydist") might indicate something else!

Note: Server projectile values and actual client values can be different due to internet lag and latency!

Note: There is no projectile(0,"table") as it is common for comparable commands! Use the command "projectilelist" instead!

Attention: There can be multiple projectiles with the same ID (each player has its own projectile ID-space)! That's why you have to specify the ID and the player because only the combination of those two values is unique and therefore suited to address a certain unique projectile