Duh102's Guide to Emitter Rounds (v1.0 3/16/09 22:44 GMT)
Okidoke, so this may be a bit of an overreaction, but recently a whole bunch of people have been asking questions that have the same answer. How do I reduce recoil/make smoke come out of my gun when it fires/make my bullet have a smoke trail. The answer is simply "Emitters".
The first two are exactly the same process. First, you make the bullet and any effects you want to happen when you fire it. This can be smoke, fire, flying gnomes, whatever you like.
Someone better make some flying gnomes nowThen, next in the file you should define a one-shot emitter to do all your firing for you. The basic emitter is the same for all of these, so if you're going to use a whole bunch of them you might want to define the bulk of the emitter somewhere above all the rest of your file and use CopyOf to shorten the amount of script you have to type.
This is how you define the one shot emitter using the base and CopyOf, which I affectionately call "Emit One". Note that * = tab.
Code:
AddAmmo = AEmitter
*PresetName = Emit One
*Mass = 1
*OrientToVel = 1
*HitsMOs = 0
*GetsHitByMOs = 0
*SpriteFile = ContentFile
**FilePath = Base.rte/Null.bmp
*LifeTime = 1
*FrameCount = 1
*SpriteOffset = Vector
**X = 0
**Y = 0
*EntryWound = AEmitter
**CopyOf = Dent Metal
*ExitWound = AEmitter
**CopyOf = Dent Metal
*AtomGroup = AtomGroup
**AutoGenerate = 1
**Material = Material
***CopyOf = Military Stuff
**Resolution = 2
**Depth = 0
*DeepGroup = AtomGroup
**AutoGenerate = 1
**Material = Material
***CopyOf = Military Stuff
**Resolution = 4
**Depth = 1
*DeepCheck = 1
*EmissionEnabled = 1
*EmissionsIgnoreThis = 0
*BurstTriggered = 1
That is the basic emitter chunk, now for the specific portion for making a usable emitter.
Code:
AddAmmo = AEmitter
*CopyOf = Emit One
*PresetName = Recoil Control Gun1
*AddEmission = Emission
**EmittedParticle = MOSRotating
***CopyOf = Big Hunk Of Metal
**ParticlesPerMinute = 0
**BurstSize = 1
**Spread = 0.0
**MaxVelocity = 100
**MinVelocity = 100
**PushesEmitter = 0
//*EmissionAngle = Matrix
//**AngleDegrees = 90
*EmissionOffset = Vector
**X = 5
**Y = 0
Now, to explain what I did. The copy will shoot out one (BurstSize = 1) MOSRotating called "Big Hunk Of Metal" at exactly 0.0 deviation from the gun's heading, going exactly 100.
The EmissionAngle is commented out because it is not useful for guns, though you can enable it to play with if you like.
The EmissionOffset
is enabled because when you are flying and shooting, emitters lag just a
little bit behind firing, so without putting the emission 5 px in front of the gun's muzzle (X = 5), you might be caught in the middle of the emission and have a projectile teleported into your clone's midsection. Not pretty.
Now you may be asking "But hey, I don't see anywhere to put the smoke/fire/gnomes!". This is a good question, I didn't define the smoke/fire/gnomes yet. It's easy, really, just keep adding AddEmission blocks (ends at "PushesEmitter = 0") for all the different particles going all the different speeds and directions you want.
Now, for when you want your projectile to trail smoke/fire/gnomes.
I'm serious about those gnomes. Someone better do it.This is accomplished in a very similar manner, though in reverse. This time, you actually
want to fire an emitter. This is most useful for rockets and the like that have thrust trails behind them. In case you didn't look through the basegame files, both the Coalition rocket launcher and the Ronin bazooka use this.
Here is a basic definition of a emitter projectile, copied from Coalition.rte and modified to simplify. Again, * = tab.
Code:
AddAmmo = AEmitter
*PresetName = Particle Rocket Launcher
*LifeTime = 2000
*Mass = 4
*GlobalAccScalar = 0.3
*RestThreshold = -500
*HitsMOs = 1
*GetsHitByMOs = 0
*SpriteFile = ContentFile
**FilePath = Coalition.rte/Devices/RPGs/RocketA.bmp
*FrameCount = 1
*OrientToVel = 0.6
*SpriteOffset = Vector
**X = -4
**Y = -3
*EntryWound = AEmitter
**CopyOf = Dent Metal
*ExitWound = AEmitter
**CopyOf = Dent Metal
*AtomGroup = AtomGroup
**AutoGenerate = 1
**Material = Material
***CopyOf = Military Stuff
**Resolution = 2
**Depth = 0
*DeepGroup = AtomGroup
**AutoGenerate = 1
**Material = Material
***CopyOf = Military Stuff
**Resolution = 4
**Depth = 1
*DeepCheck = 1
*EmissionAngle = Matrix
**AngleDegrees = 180
*ScreenEffect = ContentFile
**FilePath = Base.rte/Effects/Glows/YellowBig.bmp
*EffectStartTime = 0
*EffectStopTime = 55
*EffectStartStrength = 1.0
*EffectStopStrength = 0
*EffectAlwaysShows = 1
*BurstTriggered = 1
*AddEmission = Emission
**EmittedParticle = MOSParticle
***CopyOf = Explosion Smoke 2
**ParticlesPerMinute = 10000
**StopTimeMS = 70
**BurstSize = 1
**Spread = 1.0
**MaxVelocity = -5
**MinVelocity = -1
**PushesEmitter = 0
*EmissionEnabled = 1
*EmissionsIgnoreThis = 0
*BurstSize = 1
*BurstScale = 1
*BurstTriggered = 1
*BurstSpacing = 500
*EmissionDamage = 0
*GibImpulseLimit = 20
*AddGib = Gib
**GibParticle = MOPixel
***CopyOf = Glow Explosion Huge
**Count = 1
**Spread = 2.25
**MaxVelocity = 0.1
**MinVelocity = 0
**InheritsVel = 0
It works in much the same way. The stuff you want to trail behind the projectile is added via AddEmission blocks, and in this case, when the projectile hits something with enough force to hit the GibImpulseLimit, it will gib into a nice explosion glow.
Notice the EmissionAngle in this case is used. This is because the AEmitter will accelerate due to emitting thruster particles (removed for simplicity). If you didn't set the EmissionAngle, this rocket would fly back into your face when you launched it! Thrust particles emitted should not define PushesEmitter, or set it to 1 so that they affect the Emitter's course.
For both of these, your round definition for your gun should look something like this. * = tab
Code:
AddAmmo = Round
*PresetName = Round Massive SMG
*ParticleCount = 1
*Particle = AEmitter
**CopyOf = MSMG Recoil Control
*Shell = MOSParticle
**CopyOf = Casing
*FireVelocity = 5
*ShellVelocity = 0
*Separation = 0
The FireVelocity should be a number greater than 0, even if it doesn't affect your recoil control emitters, because otherwise OrientToVel will not work on it. FireVelocity works as it normally does for AEmitter particles, so set it to what you want your rockets and whatnot to start at.
And that's about it for basic emitter usage. You can do a lot of cool things with emitters in B22, look around for things like the "wide beam" and zalo/numgun/shook's pinpoint accurate summoning method if you want to see amazingly cool usage.