Page 1 of 1
Making a gun shoot Objects
Posted: Mon Oct 18, 2010 12:14 am
by Deadeye
Hey guys i need a ssm to make a gun such as the DP to shoot objects like the Defgun.
the code i used is:
ObjectTemplate.Active DP
ObjectTemplate.projectileTemplate Defgun
I want the gun to spawn a defgun with every bullet.But the code crashes the server when i click.
i want a gun that can do this:

Re: Making a gun shoot Objects
Posted: Mon Oct 18, 2010 4:34 am
by tanelorn
You must use a standard projectile with a firearm. However, there are a couple options that allow you to use a firearm to do this:
1. In the projectile code, attach a PCO (player occupiable object) to it. You can put spawners on the PCO. Review the game code to find PCOs (all vehicles are PCOs), and review the map spawning code for correct syntax for spawners.
2. You can make the firing effect (like the muzzle effect of the DP) throw out a bundle object. Bundle objects are alot like PCOs but lack some characteristics (such as, they can't be occupied). But you can attach spawners to them also (At least I think you can). This approach is for those who are familiar with effects coding and know what an emitter is.
If you're fresh to coding, then you'll have to spend alot of time becoming familiar with all of this stuff. If you're an experienced coder, then the above is enough for you to succeed.
Re: Making a gun shoot Objects
Posted: Mon Oct 18, 2010 7:31 pm
by Deadeye
Thanks, But i am very new to modding i would rather like a code to spawn them like i used this code:
ObjectTemplate.Active Type99
ObjectTemplate.addFireArmsPosition 0/0/0 0/0/0
ObjectTemplate.velocity 100
ObjectTemplate.Active barProjectile
ObjectTemplate.timeToLive CRD_NONE/0/0/0
ObjectTemplate.addTemplate ArtillerySpawner
ObjectTemplate.SetPosition 0/0/0
but when i fire the gun the defgun spawns above the soldier and little forward i want to make it shoot an object that you cannot get in, and that it appears level and in the middle of the screen, i also would like it to never dissapear. Sorry for being so picky

i just am not good at modding and need to learn. Thanks
Posted: Mon Oct 18, 2010 11:12 pm
by freddy
change value on FireArmsPosition 0/0/0 0/0/0
a guess 0/0/25 0/0/0 but try your way forward
or even better change SetPosition of spawner instead
Code: Select all
ObjectTemplate.addTemplate ArtillerySpawner
ObjectTemplate.SetPosition 0/0/0 <------ 0/0/25
Re: Making a gun shoot Objects
Posted: Tue Oct 19, 2010 2:03 am
by Deadeye
Ok i tried that, it worked, but when i shoot they only survive for 1 second then blow up i want them to never disappear. I have tried speedMod 0 and Time to live 999 none of them seems to work
Posted: Tue Oct 19, 2010 2:04 pm
by freddy
Deadeye wrote: they only survive for 1 second then blow up
does this happen if you only "shoot" out one defgun to?
Re: Making a gun shoot Objects
Posted: Wed Oct 20, 2010 12:30 am
by Deadeye
yea, but maybe it is spawning 2 per bullet, i put the code on a knife and it spawned 2 jeeps in one click.