Alrighty, time for installment #3 of this small series. Today we'll be looking at defining the stuff that shoots out of guns (and all other things too). MOPixels, MOSParticles, and MOSRotatings (Attachments and AEmitters we will get to in a later tutorial).
These three particles alone make up a good 3/4 of cortex modding, and knowing how to define them properly will make everything very much easier.
Let us begin with the humble MOPixel. Here is a very basic definition of one.
AddAmmo = MOPixel PresetName = Basic MOPixel Mass = 0.01 LifeTime = 1 Sharpness = 0 HitsMOs = 0 GetsHitByMOs = 0 Color = Color R = 255 G = 0 B = 255 Atom = Atom Material = Material CopyOf = Air TrailColor = Color R = 255 G = 0 B = 255 TrailLength = 0
You may be wondering, "But Duh, that's hardly anything at all! How could it be so useful?". But, in actuality, MOPixels are quite useful. If you notice, MOPixels define two colors, simple Color, and TrailColor.
MOPixels are single pixels and collide as such (HitsMOs and GetsHitByMOs still apply), but you can add a non-colliding trail to them to make them more visible or to apply an affect (Lasers work particularly well with these).
Color affects the color of the colliding pixel, TrailColor affects the color of the noncolliding trail.
![]()
The red outline is the colliding pixel, the green outline the trail.
A quick but very important note, LifeTime controls how long the MOPixel will exist after it is spawned. When an object reaches it's LifeTime, it will simply disappear. No gibbing or anything, just plain disappearing. Things fired out of guns benefit from this, as you don't want your bullet to fly clear around the map and hit you in the back of the head.
Sharpness is not a value that did us much good for the HDFirearm, but here it is very important. Sharpness is a factor in both what kind of materials your MOPixel can penetrate, and also how much terrain damage it does. Setting Sharpness to 0 makes it so that your MOPixel will never damage the terrain, no matter how fast and/or heavy your MOPixel is. Setting it to a value greater than 0 increases the factor of how far into terrain your pixel will penetrate. Increasing the Sharpness, Mass, or Velocity (however you spawn them, usually FireVelocity in a Round) will increase the depth it will penetrate. Setting it too low, however, will leave you frustrated trying to do some damage to a door or other armored target. A good value for an MOPixel of weight 0.08 and velocity of about 50 is about 100 sharpness. There is no perfect formula to determine how far it will penetrate, however, so you must test, fiddle, and retest until you have it perfect.
A couple small things:
You can add in the line "GlobalAccScalar = X" to change the effect of gravity on the particle. GlobalAccScalar = 0.5 will halve gravity for the particle. GAS = 2 will double it. GAS = -1 will reverse gravity.
You can add in the line "AirResistance = X" to chance the effect of air on your particle. AirResistance = 0.5 will halve the velocity of the particle every frame. AR = 1 will totally stop the particle from moving, as in, subtracting 100% of the particle's intended velocity every frame. I haven't tried it, but I think AR = -0.01 will increase the particle's velocity by 1% previous every frame.
Now, you likely did not look into Materials for HDFirearms, so let us take a quick look at those. The stock materials (which you rarely need to deviate from) are defined in "Base.rte/Materials.ini". At some point you should open that up and take a look at it. The Material of your MOPixel (and any MO, like HDFirearms) determines several important factors. Bounce and Friction are the most important for MOPixels, though there are several more for when you begin to make BunkerModules.
You can also apply a ScreenEffect, which is an alpha-blended image centered on the pixel.
ScreenEffect = ContentFile FilePath = Base.rte/Effects/Glows/YellowTiny.bmp EffectAlwaysShows = 1//Set to 1, I don't know how you would make it NOT show EffectStartTime = 0//When in MS should the effect begin showing after spawning EffectStopTime = 2500//When in MS should the effect stop EffectStartStrength = 0.50//What to multiply the alpha effect by when at start time EffectStopStrength = 0.0//What to linearly scale the EffectStrength down to by the StopTime

Now, on to MOSParticles. There is almost no change from MOPixel to MOSParticle, except for one important point. They are pretty much MOPixel++'s
AddAmmo = MOSParticle PresetName = Bare MOSParticle Mass = 0.01 Sharpness = 0 HitsMOs = 0 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = Base.rte/Null.bmp FrameCount = 1 SpriteOffset = Vector X = 0 Y = 0 AngularVel = 0 Atom = Atom Material = Material CopyOf = Air TrailLength = 0 Framerate = 0
And that's pretty much it for MOSParticles. On to MOSRotatings. You will notice a lot in common with HDFirearms and MOSRotatings, mainly because HDFirearms are MOSRotatings with extra functionality.
AddAmmo = MOSRotating PresetName = Basic MOSRotating Mass = 1 Sharpness = 0 HitsMOs = 0 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = Base.rte/Null.bmp FrameCount = 1 SpriteOffset = Vector X = 0 Y = 0 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Air Resolution = 1 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Air Resolution = 1 Depth = 1 DeepCheck = 0 AddGib = Gib GibParticle = MOSParticle CopyOf = Fire Puff Small Count = 3 Spread = 3.14 MaxVelocity = 10 MinVelocity = 4 InheritsVel = 1
And that's pretty much it for a MOSRotating. Here, let's make a fun gun out of contact explosive MOSRotatings.
Define first the little bits that the MOSRotating will explode into.
Quote:
AddAmmo = MOPixel
PresetName = Mod Grenade Launcher Grenade Bit
Mass = 0.05
LifeTime = 50
Sharpness = 40
HitsMOs = 1
GetsHitByMOs = 0
Color = Color
R = 200
G = 200
B = 200
Atom = Atom
Material = Material
CopyOf = Mega Metal
TrailColor = Color
R = 180
G = 180
B = 180
TrailLength = 10
AddAmmo = MOSRotating PresetName = Mod Grenade Launcher Grenade Mass = 1 Sharpness = 0 HitsMOs = 1 GetsHitByMOs = 0 OrientToVel = 1 SpriteFile = ContentFile FilePath = Coalition.rte/Devices/Pistols/MagazinePistolShortA.bmp FrameCount = 1 SpriteOffset = Vector X = -2.5 Y = -3 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Metal Resolution = 2 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Metal Resolution = 2 Depth = 1 DeepCheck = 0 AddGib = Gib GibParticle = MOPixel CopyOf = Mod Grenade Launcher Grenade Bit Count = 20 Spread = 3.14 MaxVelocity = 50 MinVelocity = 25 InheritsVel = 0 GibImpulseLimit = 0.01//To make it explode at the slightest touch GibSound = Sound//Give it a little oomph AddSample = ContentFile FilePath = Base.rte/Sounds/Explode1.wav AddSample = ContentFile FilePath = Base.rte/Sounds/Explode2.wav
AddAmmo = Round PresetName = Round Mod Grenade Launcher ParticleCount = 1 Particle = MOSRotating CopyOf = Mod Grenade Launcher Grenade Shell = MOSParticle CopyOf = Shell FireVelocity = 20 ShellVelocity = 8 Separation = 0 AddAmmo = Magazine PresetName = Magazine Mod Grenade Launcher Mass = 1 // kg HitsMOs = 0 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = Base.rte/Null.bmp FrameCount = 1 SpriteOffset = Vector X = 0 Y = 0 ParentOffset = 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 = 3 Depth = 1 DeepCheck = 1 JointStrength = 200 JointStiffness = 1 JointOffset = Vector X = 0 Y = 0 DrawAfterParent = 0 RoundCount = 5 RTTRatio = 0 RegularRound = Round CopyOf = Round Mod Grenade Launcher TracerRound = None
I made the magazine invisible, just because. You can set a SpriteOffset and JointOffset and ParentOffset for a null magazine, but I don't see the point.
Last but not least, the gun itself. I'll be copying the SMG again, because it's easy.
AddDevice = HDFirearm PresetName = Mod Grenade Launcher AddToGroup = Weapons Mass = 10 HitsMOs = 0 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Base.rte/Devices/SMGs/SMG.bmp FrameCount = 2 SpriteOffset = Vector X = -7 Y = -4 EntryWound = AEmitter CopyOf = Dent Metal ExitWound = AEmitter CopyOf = Dent Metal GoldValue = 50 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 10 DeepCheck = 1 JointStrength = 75 JointStiffness = 0.5 JointOffset = Vector X = -3 Y = 3 DrawAfterParent = 0 StanceOffset = Vector X = 6 Y = 5 SharpStanceOffset = Vector X = 7 Y = -2 SupportOffset = Vector X = 5 Y = 4 SharpLength = 165 Magazine = Magazine CopyOf = Magazine Mod Grenade Launcher ParentOffset = Vector X = 3 Y = 1 Flash = Attachable CopyOf = Muzzle Flash SMG FireSound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1601.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1602.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1603.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1604.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1605.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1606.wav EmptySound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/EmptyClick3.wav ReloadStartSound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/ReloadStart.wav ReloadEndSound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/ReloadEnd.wav RateOfFire = 200 ReloadTime = 1500 FullAuto = 0 FireIgnoresThis = 1 ShakeRange = 10 SharpShakeRange = 2 NoSupportFactor = 3 ParticleSpreadRange = 3 ShellSpreadRange = 8 ShellAngVelRange = 2 MuzzleOffset = Vector X = 10 Y = 0 EjectionOffset = Vector X = 1 Y = -1 AddGib = Gib GibParticle = MOPixel CopyOf = Spark Yellow 1 Count = 6 Spread = 2.25 MaxVelocity = 20 MinVelocity = 8 AddGib = Gib GibParticle = MOPixel CopyOf = Spark Yellow 2 Count = 5 Spread = 2.25 MaxVelocity = 20 MinVelocity = 8 AddGib = Gib GibParticle = MOPixel CopyOf = Drop Oil Count = 4 Spread = 2.25 MaxVelocity = 10 MinVelocity = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Rust Micro A Count = 6 Spread = 2.25 MaxVelocity = 15 MinVelocity = 5 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Count = 4 Spread = 2.25 MaxVelocity = 15 MinVelocity = 5 AddGib = Gib GibParticle = MOSRotating CopyOf = Gib Device Small K Count = 1 Spread = 2.25 MaxVelocity = 10 MinVelocity = 1 AddGib = Gib GibParticle = MOSRotating CopyOf = Gib Device Small I Count = 1 Spread = 2.25 MaxVelocity = 10 MinVelocity = 1 GibWoundLimit = 3
Now, stick that code into a .ini file, load it in the index.ini, and try it out.
Here is the modified Mod.rte with the new gun inside. Check it out if you're getting errors.