As the title implies, I want to know if making a tech that shoots a projectile on use is currently possible, and if yes, a quick explanation of how to do so would be super cool indeed! Thanks in advance!
You can use the world.spawnProjectile() function. There is a nice example of it in the vanilla mech tech on line 135
This is it world.spawnProjectile(mechProjectile, tech.anchorPoint("frontGunFirePoint"), tech.parentEntityId(), {math.cos(aimAngle), math.sin(aimAngle)}, false, mechProjectileConfig) Do you know what the parameters are? Projectile, MousePoint?, ?, Angle?, Angle?, false?, Config? All I'm sure about is the first 1 being which projectile. Also, How come i Can't find the projectile in my files? Where is it stored?
The parameters are Code: world.spawnProjectile("projectilename", spawn position, ID of the entity that spawned it, angle given by its cos and sin in a table, don't know, table of configuration parameters) The projectiles are usually found under assets/projectiles.
I believe that tech.position is the current location of the player. So using this as a base you can create a new position Code: local position = tech.position() position[1] = position[1] + 25 position[2] = position[2] + 25 and then use that as the spawn position Code: world.spawnProjectile("projecile", position, tech.parentEntityId(), {math.cos(aimAngle), math.sin(aimAngle)}, false,projectileConfig) If you want it to always have a static angle you will need to change the {math.cos(aimAngle), math.sin(aimAngle)} part to a static angle