surface.create_entity{max_range=15}
Posted: Fri Dec 16, 2016 8:46 am
When you use surface.create_entity{} to create a Projectile, please add an optional parameter to specify the projectile's max_range as would normally be specified on the ammo that creates the projectile.
Currently I have a script that makes a vehicle fire at targets without player intervention. The projectiles are created with surface.create_entity and should mimic the vehicle's turret and loaded ammo, but there is no way to specify range of the projectile. Example: "cannon-shell" ammo creates a "cannon-projectile". The ammo specifies a max_range of 30. When lua creates the projectile it travels much further than 30.
Currently I have a script that makes a vehicle fire at targets without player intervention. The projectiles are created with surface.create_entity and should mimic the vehicle's turret and loaded ammo, but there is no way to specify range of the projectile. Example: "cannon-shell" ammo creates a "cannon-projectile". The ammo specifies a max_range of 30. When lua creates the projectile it travels much further than 30.