Page 1 of 1

Allow Lua To Create and Destroy Projectiles

Posted: 25 Jan 2010, 23:45
by Argh
Create:

Pretty straightforward: let a Lua function create a new projectile of (type, start position, vector, target).

Would allow for chained weapons, explosions that trigger more weapons (think cluster grenades, etc.) and other fun things.

Destroy:

Lua function to destroy (projectileID). Would probably require another function getting projectiles in a sphere, for short sorts.

Would allow for MIRV-type weapons without a lot hack-arounds, new types of Shield, anti-missile weapons that weren't vlaunch, and other useful things.

Re: Allow Lua To Create and Destroy Projectiles

Posted: 25 Jan 2010, 23:59
by Kloot
For the second part:

Code: Select all

Spring.SetProjectileCollision(number projectileID) -> nil

Re: Allow Lua To Create and Destroy Projectiles

Posted: 26 Jan 2010, 00:07
by Master-Athmos
+1

Would be cool to be able to kill a projectile and simply order another weapon to fire from its last position without much hassle (I guess just giving it a CEG to call preserving things like the direction would be a good idea)...

Re: Allow Lua To Create and Destroy Projectiles

Posted: 26 Jan 2010, 00:28
by Argh
Spring.SetProjectileCollision(number projectileID) -> nil
OK, so if we set that to true, the projectile dies? Does it then give us an Explosion to read the position of?

Re: Allow Lua To Create and Destroy Projectiles

Posted: 26 Jan 2010, 12:44
by KDR_11k
There's nothing to set to true, you just call it for the projectile and the projectile's collision code is called which usually makes it explode.