—» Home
—» Screens
—» Help
—» F.A.Q.
—» Armory
—» Download
Help Home

Tutorials

Weapon Scr. I
Weapon Scr. II

Cmd Reference

All Commands
General
Load
Graphics
HUD
Sounds
Player
Terrain
Projectiles
Particles
Collision
Objects
AI

Commands: projectiles

Legend

X - X is a number
'X' - X is a string (a letter/word/text)
[X=0] - X is an optional parameter with value 0 when omitted (NEVER add [] to your script!)


createprojectile(TYPE)

Parameters:
TYPE - projectile type ID (return value of addprojectile)
Returns:
ID - unique projectile ID
Creates a new instance of a projectile of the given TYPE.
This projectile will then automatically call the corresponding draw and update Lua functions.
The turn will not end until it has been deleted with freeprojectile.

It is recommended to use the Lua table "projectiles" as an array to store your projectile data. The array index is the ID of the projectile. Carnage Contest will reset this table for each turn.
Example:
projectiles[id].myvariable

freeprojectile(ID)

Parameters:
ID - unique projectile ID (return value of createprojectile)
Frees the projectile with the given ID.

projectileid()

Returns:
ID - unique projectile ID
Returns the unique ID of the current projectile.
This function only works properly when called within the draw or update Lua function of a projectile!