posted February 10, 2005 05:58 PM
That's actually a pretty simple mod to do... You really only need to change a handful of things to get everything working correctly. Since you're not really changing the behavior of the weapon, it's just a matter of changing the way the weapon looks, for the most part.In case you didn't know already, the first thing you want to do is make an Addons directory in your Treadmarks directory. This is where mods go for Treadmarks to recognize them. While you could technically just add the files in with the TM stock ones, it's not a good idea, as the more complicated mods can span a lot of different .ent files, and scattering those in with your stock files can make things messy.
So, starting from a clean Addons dir, create a directory in the Addons dir called Entities. This is where Treadmarks looks for any modded .ent files to load. Once you've got that done, create three subdirectories in the Entities dir, called Weapon, Smoke, and Projectile. Basically, each subdirectory in the Entities dir holds information about a different type of "thing" in the game world. Any .ent file in the Weapon dir contains information such as which mesh(es) a weapon uses, how rare it is, how much ammo it has, what kind of projectile it fires, etc. Entity files in the Projectile directory contain information about the different types of projectiles, such as speed, damage, what kind of explosion they create under different circumstances, guidance. The Smoke entities describe the different type of smoke effects (but not the explosion ones). These are mainly used for the different types of smoke trails in the game.
Once you've got your basic directory structure set up, go to Treadmarks\Entities\Weapon and copy MassDriver.ent to Treadmarks\Addons\Entities\Weapon. Make sure that you don't cut and paste, but copy and paste, so the original file stays put. Next, copy Treadmarks\Entities\Projectile\Sniper.ent to Treadmarks\Addons\Entities\Projectile\.
Once those two files are copied over, we'll do the easiest change first, which is to give the mass driver the Nuke's explosion effect and damage properties.
Open up the Sniper.ent file in the Addons\Projectile directory with a text editor. Find the following lines:
ExploEnt = YellowSparks
#ExploHitEnt = explosphere\fireenv2
ExploHitEnt = Mas****
You can ignore any lines that have a # in front of them. The # makes it so that Treadmarks just ignores that line. It's a good thing to use when you're messing around with different values but want to make sure to remember an older value or something. The ExploEnt and ExplotHitEnt values control what graphical effect the projectile will call under certain circumstances, as follows:
The ExploEnt explosion effect is called when the projectile hits the ground. There's also another parameter called Detonate that can be set to either 1 or 0. If Detonate is 1, then the ExploEnt will be called when the projectile's lifetime is up (like when the plasma mines disappear after a short while). If Deonate is set to 0 (which it is by default), then the projectile will just vanish with no explosion.
The ExploHitEnt value is the explosion that is called when the projectile hits another object in the game world, like another tank, a tree, or one of the static meshes scattered about. One thing to note is that if you only want the projectile to explode in one way (as this one will), then you only need the ExploEnt value. If there's no ExploHitEnt, then the ExploEnt effect will be called for all situations.
The values that are being called by ExploEnt and ExploHitEnt, as well as a whole lot of other values you'll see later on, such as SmokeEnt, SoundEnt, EntityChain, etc, are just other .ent files located in the Treadmarks\Entities directory. So the line:
ExploEnt = YellowSparks
Refers to Treadmarks\Entities\Explo\YellowSparks.ent
One thing that I should bring up now that stumps practically every TM modder at some point or another is how TM actually identifies the different entities. While you may think that it's by filename, it actually isn't. Every .ent file will start with a pair of lines such as:
class = projectile
type = Sniper
These are the actual identifiers of the entity, not the file name. While the name is the same as the type name 99+% of the time, it's merely a convention. If you don't change your type names to match what the entity is being called by, then it simply won't be called.
Now that that's all out of the way, on to the fun stuff...
Back to your Sniper.ent file, making sure it's the one in the Addons subdirectory, change the line "ExploEnt = YellowSparks" to "ExploEnt = Nuke". Next, delete the line "ExploHitEnt = Mas****".
Those two small changes have now made it so that every Mass Driver will now have the effect of a Nuke when it hits either the ground or another object. If you want, go ahead and check it out and make sure that you did the changes correct.
Now that the graphics for the explosion are done, it's time to actually make it act like it looks. Even though it may now look like a nuke's going off where it hits, the actual damage done is still identical to the original Mass Driver. This is due to the fact that the splash effects are handled by the projectile, not the explosion. Just to make things simple, we're going to use the same values from the Nuke for this weapon.
First, change the line "damage = 0.5" to "damage = 1.5". The damage value only determines how much damage a direct hit with the projectile does to a tank, not the splash damage. For that, we're going to copy a few lines from Treadmarks\Entities\Projectile\NukeMissile.ent
SplashRadius = 100
SplashDamage = 1.5
SplashPush = 50
Copy those anywhere into your Sniper.ent file (again, make sure it's the Addons one!).
Now's a good time to mention that in most of the stock Entities directories, there's readme files. These files contain descriptions of some of the parameters and values of each class of entity. So if you're unclear as to what those three lines I put up there do, check out Treadmarks\Entities\Projectile\readme.txt for a description of those, as well as most of the other major Projectile values and parameters. These readmes are a great resource for getting started, and make a good reference for some of the more complicated types of ents (like Spewers).
Once you've copied those three lines into your Sniper.ent file, there's one more quick change to be made... Find the line:
HitScanRange = 300.0
and change the 300.0 to something like 1000.0.
This changes the distance the shot travels before disappearing, and will allow you to use the new weapon without blowing yourself up in the process.
As far as changing the way it acts, that's pretty much it. Now the Mass Driver has gone from the usual railgun-esque weapon to being able to create a nuclear explosion a kilometer away (assuming you saved the changes). Not balanced, but it's fun.
Once you're done blowing AIs apart with a single click, it's time to make this a weapon of its own, instead of just replacing the Mass Driver. First, we're going to change the name of the projectile. For the sake of the lesson here, let's call the weapon "The Big Bang". Back to Sniper.ent, first change the type to BigBangProj. You can call this anything, but it's a good idea to make it something self explanatory and easy to remember.
Next, delete the line "nameid = 18". What that line does is reference the Weapons.txt file in one of the Treadmarks\Local\ subdirectories to display the kill message when another tank is killed by this weapon. Since this is no longer a mass driver, we're going to change the kill message. To do that, put this line in the Sniper.ent file:
name = a Big Bang
Next, close your editor and rename the file to BigBangProj.ent. Again, it's not required for the filename to match the type name (you could call it GrilledCheese.ent, and it would still work), but it's a good practice to get into, for when you're trying to edit your stuff later on.
However, now that we've changed the type name to something else, the Mass Driver is going to fire its regular projectile once again. Treadmarks loads the standard entities first, then looks in the Addons folder. If any entities in the Addons folder are of the same class and type as a stock one, then TM uses the Addons one instead.
So, we're off to a different file, finally. First off rename Treadmarks\Addons\Entities\Weapon\MassDriver.ent to BigBang.ent.
Next, open up BigBang.ent and change the type to BigBang. Next, find the line:
projectile = Sniper
and change that to, you guessed it...
projectile = BigBangProj
Now your weapon is a seperate weapon, and will spawn along every other TM weapon in-game, and will work just fine. The last change we're going to do in this file is to change the name that shows up on a player's HUD when they grab the weapon. Simply enough, just go to the line:
Name = Mass Driver
and change "Mass Driver" to "A Big Bang" or whatever you like.
There's a bunch of other values that you may want to tinker with, such as the reload time, weight of the weapon (how often it spawns compared to other weapons), and so on, but I'll leave that for you, as this is already getting a little long.
Now, when you said you wanted to change something to red and orange, did you mean the weapon itself, or did you want to replace the green smoke rings with something that would look more suited to a nuclear blast? If it's the former, then you'd have to draw a new texture, or just slap on one of the other stock ones. If you're interested in replacing the green smoke rings, here's all you need to do...
First, copy the file Treadmarks\Entities\Smoke\MassRing.ent to the Addons\Entities\Smoke directory. Next, rename the file to BigBangSmoke.ent, and change the type value to BigBangSmoke.
A Smoke entity doesn't control the whole trail, but just how a single unit of the smoke trail will look and act. So the file Smoke\MassRing.ent set up a single one of the green rings, and it's the projectile that determines that it will be used as a smoke trail. In order to change the appearance of the smoke, we have to assign a different sprite to it. The stock Treadmarks sprites are located in Treadmarks\Art\Sprites\. If you look in the BigBangSmoke.ent file, notice the line:
Texture = sprites/GreenRing.bmp
If you look at the file GreenRing.bmp, you'll notice that it's the good old Mass Driver ring. What we want to do is change this. Now, you can either use one of the standard sprites, or make your own. Me, I stink at drawing, so I stick with just reusing the stock sprites. Change the Texture line so that it reads:
Texture = sprites/FlareBrightOrange2.bmp
Now, this particular kind of smoke will act exactly like the Mass Driver's smoke (how long it hangs around, the size, etc), but will just have a different sprite.
Finally, we just need to tell our Big Bang projectile to use the new BigBangSmoke ent for a smoke trail instead of the old MassRing ent.
Open up the BingBangProj.ent file, and find the line:
SmokeTrailEnt = smoke/MassRing
and change it to:
SmokeTrailEnt = smoke/BigBangSmoke
That's it. After modifying a mere three files you should have something that looks a little like this:
There's plenty of other neat things you can do once you get the hang of how everything works. One thing I noticed about your original idea is that you wanted multiple explosions for a single projectile. While it is possible, it pretty much requires the use of spewers and some creative modding. Take a look at my Annihilator weapon (available from RC's site at http://treadmarks.cjb.net/). That's got a neat little effect with multiple large explosions.