A note from the author, I assume you know nothing about modding, but if you do, this tutorial may help you learn some new things or brush up on old, forgotten ideas, so, lets get down to the basics. You'll need the base files before you can do anything. Now normally, you'd search the ".pk4" files for what you need when you need it, but today we're gonna change things up for the sake of simplicity. In case you're wondering what'll happen if un-modified files are copied out of your ".pk4" files and added to your q4base, the answer is absolutly nothing. Quake 4 will continue to act "vanilla" (meaning the same as the actual unmodded game). If you didn't understand any of what I just went on about, its ok, I'll simplify it and go over it thoroughly later.
The next thing I want to discuss is modding style. I know this'll sound cheesy, but every modder has their own modding style. Some prefer to work in the q4base folder, so they don't have to load their mod up every time they wanna test it. Others start with a new folder in the Quake 4 directory (a different way of saying "folder") and add a ".pk4" file which they modify as they go along. I'm sure some people have developed other ways of going about it. The bottom line is we're going to start using my way, as this is a tutorial subjective to my personal style and knowledge. I prefer to make folders in the q4base directory and add in files as I go. Not only is it quicker and easier, it seems to be less problematic.
Lets get started then, ok?
First thing to do is learn the layout of Quake 4 and it's file system. This is critical to your success as a modder. If you can't properly locate and edit files, how are you going to mod? First lets find the main Quake 4 directory, this is usually in your "Program Files\id Software" folders on Windows. Mine is located at: "C:\Program Files\id Software\Quake 4". Inside this folder you'll see a folder which will be the one most focused on in this tutorial: "q4base". In short, "q4base" is the base of Quake 4, the foundation, if you will. It contains the ".pk4" files with all the content seen and used in Quake 4 as well as various other important files.
"q4base" is where we start this modding adventure. First I want you to create a new folder, name it "def". Not too hard yet, right? Thats about how hard this tutorial will get, so if you're worried about messing it up, don't sweat it. I'd like to point out that if you're following my directions properly, the worst case scenario is you will have to delete this "def" folder and your Quake 4 will be back to normal. If this folder already exists, open it up and go the the next step. Now that you're inside your "def" folder, I want you to create a folder called "weapons", if it exists, check to see if it has anything it it, if it has 11 or so ".def" files named after Quake 4 weapons, you can skip the next step.
Now that we have mastered folders it's time to move on to bigger fish. Navigate back to your q4base folder and open up "pak001.pk4". This folder contains most of the Quake 4 ".def" files as well as various other files. Let me take a moment to explain ".def" files for you: ".def" files are like simple script files which anyone can modify safely with no fear of permanently damaging their Quake 4 game. All you need to edit them is Notepad or some Linux/Mac equivalent. They amount to .txt files that tell your Quake 4 game how to do certain things. However, with their simplicity comes a lack of true, unlimited modding power. Don't expect to change certain things scripted into the engine such as amount of hitscans or fire-modes. Anyhow, back to the topic at hand. With your "pak001.pk4" open in front of you, navigate to the "def" folder, then to the "weapons" folder, then copy the contents into your "weapons" folder you made in your "q4base\def" directory. You should now have 11 weapon files in your "q4base\def\weapons folder", if you do, congrats, you're on your way to your first Quake 4 weapon mods. A hint: there may be 10 or 12 ".def" files in your weapons folder, don't panic if this is the case, as it varies depending on whether the Gauntlet and Napalm gun ".def" files are present.
Alright my fellow modders, time to make that final push. We (hopefully) have now nailed folder layout and ".def" files, now that we have the chick-chick, it's time for the boom: weapon mods. Lets start with every marines favorite: the Machinegun. I'd start with the Blaster, but the Machinegun is easy to mod and has more options (clip-size, ammo count, reloading, etc). Open up the "machinegun.def" folder and marvel at the lines of meaningless code. I'd like you to learn a very important feature: the search box. Hit control + f to bring it up on Windows, Linux and possibly Mac. This search feature is like a lifeboat during the sinking of the Titanic... you can't live without it! Now that we're suited up and ready for action, lets do this!
In your search box, type in "clipsize" and then press enter. Watch as your computer seeks out the clipsize parameter for you. "clipsize" may be highlighted, but I want you to pay attention to something a few inches hortizontal of this word, the number "40" in quotes. The brighter crayons in my box of pupils may have figured out that indeed, this number controls the amount of bullets in your clip. Now I'm going to get all sentimental on you guys again and readdress the issue of modding styles. I'm willing to bet a lot of you went "OOO! Goody!" and changed the number 40 to 100, making a super-Machinegun or something (I did that once, I'll admit it). But lets just say this somehow didn't work out and Quake 4 crashed and your mod had to be deleted to fix it. To make it worse, you didn't test your changes until a week later when you wanted to frag some squibs. You're left scratching your head with no recollection of what you modifed a week ago and how you modifed it. Obviously if you did this modification correctly thats not going to happen, but roll with it for a second, as it will happen later with bigger and more ambitious modding attempts. It's happened to me, and I'm sure it's happened to others.
Documenting Your Work
Something critical in preventing head-through-monitor syndrome as well as helping other modders understand how your mod functions is documenting your work. Here is an example of a documented adjustment to my machinegun's clipsize:
"clipSize" "30" //was 40
Hint: forget grammar, make it short and sweet, and never more than a single line. To document your work, all you need to do is write two right-tilting slashes and anything after that is gone, the game engine skips right over it. Be careful though, putting slashes like this:
//"clipSize" "30" was 40
Will probably crash your game or at best, mess up your machinegun. Another mistake is forgetting the slashes completly, forcing the game enging to try and read your documentation (hint: thats bad). Here is a demonstration of a good way to mess up your game:
"clipSize" "30" was 40
By now, you're probably rolling your eyes thinking "OK Adam, we get it, tell me how to make a fully-auto DMG now!" but I can't stress proper documentation's importance enough. Just today I was wracking my brain for half an hour wondering why my game crashed upon picking up a nailgun, the answer: I had written "/was 50" instead of "//was 50". One slash missing: 30 minutes of torment. You've been warned.
By now, you should be comfortable with going through your weapon ".def" files and changing the clipsizes. A hint for you eager modders: "0" (zero) in the clipsize parameter means it doesn't reload (lightning gun, DMG, etc) giving these weapons a clipsize could be a very dumb idea. However, giving the Railgun, for example, a clipsize of "0" would allow you to make a Railgun that didn't require reloading. Simply put: you can take away reloading, but without a fair bit of skill, you can't add it in. Stay tuned for part 2, covering fire-rate and damage values. Take care guys,