1. Quake 4 InstaGib
In this mod we will replace all weapons with the railgun, and additionally have the railgun do 1000 damage.
Areas Modified: DefinitionFiles
Difficulty: Beginner
Download the mod
1.1. Overview
To implement something like InstaGib, modifying def files is the easiest approach. Def files specify the properties of almost every gameplay element in the game. Specifically, by editing the appropriate def file we'll be able to change the railgun damage, etc.
1.2. Getting Started
First, we'll setup our ModDirectory. A good way to start is to copy over the files we'll be editing. This gives us a good base to work off.
Create a Quake 4\instagib directory. Create this is a sub-directory of your Quake 4 installation. This will be our ModDirectory.
Create sub-directories that will hold our mod's def files
- Quake4\instagib\def
- Quake4\instagib\def\weapons
Open Quake4\baseq4\pak001.pk4 (see the article on pk4 files for information on how to open them)
- Extract the following files from pak001.pk4 and copy them to the mod directory
Quake4\instagib\def pak001.pk4\def\player.def -> Quake4\instagib\def pak001.pk4\def\ammo.def -> Quake4\instagib\def Quake4\instagib\def\weapons pak001.pk4\def\weapons\gauntlet.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\dmg.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\grenadelauncher.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\hyperblaster.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\lightninggun.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\machinegun.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\nailgun.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\rocketlauncher.def -> Quake4\instagib\def\weapons pak001.pk4\def\weapons\shotgun.def -> Quake4\instagib\def\weapons
1.3. Time to mod!
Now that we've got our mod directory setup we can get crackin'. We'll create Quake 4 InstaGib in five steps.
Replace each weapon pickup with railgun weapon pickup This will turn all weapon pickup entities into the railgun pickup. That way, no matter what map we play our mod on, the only weapon you'll be able to pickup is the railgun.
Replace all ammo pickups with railgun ammo Since we've made the railgun the only weapon you can pickup, we'll want to change any ammo pickups to give you railgun ammo.
Make the railgun the player's starting weapon Otherwise, players will still spawn in with machine guns on our rail-only maps
Make the railgun do 1000 damage Ahh the coup-de-grace, gibs-ahoy.
Make the gauntlet do 1000 damage We'll add some close-quarters instagibbing as well.
1.3.1. Replace each weapon pickup with railgun weapon pickup
Since we want to replace all weapons with the railgun, we need to make sure that players won't be able to pickup any other weapons. One way to do this would be to edit each MapFile and replace all weapons with the railgun weapon pickup. This isn't the best way of going about this - we would have to edit a ton of maps, and our mod wouldn't work on any new maps people might make.
What we'll do instead is replace all weapon pickups with the railgun weapon pickup. That is, we'll change the behavior of the shotgun pickup, rocket launcher pickup, etc to give you the railgun instead of whatever weapon these pickups were giving before.
This means that any map we run with our mod will only have railguns.
We'll be modifying each weapon pickup's EntityDefinition to have it give the player a railgun regardless of the type of pickup.
The entity def for weapon pickups placed in maps are called weapon_weaponname, and are located in the def files in def\weapons
Use a text editor (such as Notepad) to open up Quake4\instagib\def\weapons\dmg.def. Scroll down to the EntityDefinition named weapon_dmg_mp. (See the note on MultiplayerEntityDefinitions)
entityDef weapon_dmg_mp { "inherit" "weapon_dmg" "def_mod1" "" "editor_ignore" "1" "def_projectile" "projectile_dmg_mp" "inv_icon" "gfx/guis/hud/icons/item_darkmatter_colored" "inv_start_ammo_dmg" "3" "triggerSize" "32" "muzzle_kick_time" "0" "muzzle_kick_maxtime" "0" "muzzle_kick_angles" "0 0 0" "muzzle_kick_offset" "0 0 0" "recoilTime" "0" "recoilAngles" "0 0 0" "respawn_Team DM" "30" "respawn_Tourney" "15" }
This EntityDefinition describes the multiplayer version of the Dark Matter Gun weapon pickup. When you run over a weapon_dmg entity placed in a map (see the note on MultiplayerEntityDefinitions), the GameCode gives you a weapon based on the information in this EntityDefinition.
You'll notice the use of the inherit keyword. This copies over the single-player Dark Matter Gun values which saves us from having to redefine parts of the EntityDefinition that are the same in single player and multiplayer. Instead, we inherit the single-player as a base, then override whichever values we want to change for multiplayer.
The part of the EntityDefinition that the GameCode uses to give you a weapon is the "weaponclass" key found in weapon_dmg. We could change this from rvWeaponDarkMatterGun to rvWeaponRailgun, but this wouldn't immediately work. In addition to the "weaponclass" the EntityDefinition specifes a ton of other information needed to make the weapon work (i.e. muzzle kickback, starting ammo, reload time, etc). If we just replaced the "weaponclass" you would get a Railgun with the handling characteristics of the DMG.
Another way we could turn the DMG into the railgun is by copy and pasting all the weapon_railgun fields into the weapon_dmg EntityDefinition. This would work, but doing this for all the weapons is a large amount of work. Furthermore, if we ever want to change something about the railgun, we'd have to make sure to change it in each weapon.
By now you probably see where I'm going with this. Remember the inherit functionality? The easiest way to turn the DMG into a railgun is just to have the weapon_dmg EntityDefinition inherit from the weapon_railgun EntityDefinition. So go ahead and change the weapon_dmg_mp to
entityDef weapon_dmg_mp { "inherit" "weapon_railgun_mp" }
This will change any weapon_dmg entities that have been placed on any map to give you the railgun when you pick it up. We'll repeat the same step for the other weapons.
Quake4\instagib\def\weapons\grenadelauncher.def
entityDef weapon_grenadelauncher_mp { "inherit" "weapon_railgun_mp" }
Quake4\instagib\def\weapons\hyperblaster.def
entityDef weapon_hyperblaster_mp { "inherit" "weapon_railgun_mp" }
Quake4\instagib\def\weapons\lightninggun.def
entityDef weapon_lightninggun_mp { "inherit" "weapon_railgun_mp" }
Quake4\instagib\def\weapons\nailgun.def
entityDef weapon_nailgun_mp { "inherit" "weapon_railgun_mp" }
Quake4\instagib\def\weapons\rocketlauncher.def
entityDef weapon_rocketlauncher_mp { "inherit" "weapon_railgun_mp" }
Quake4\instagib\def\weapons\shotgun.def
entityDef weapon_shotgun_mp { "inherit" "weapon_railgun_mp" }
1.3.2. Replace all ammo pickups with railgun ammo
Now that we've got all the weapon pickups acting like railguns, we'll do the same thing for ammo pickups.
Quake4\instagib\def\ammo.def
entityDef ammo_machinegun_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_nailgun_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_shotgun_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_hyperblaster_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_rocketlauncher_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_grenadelauncher_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_lightninggun_mp { "inherit" "ammo_railgun_mp" }
entityDef ammo_dmg_mp { "inherit" "ammo_railgun_mp" }
1.3.3. Make the railgun the player's starting weapon
Now that we've got the map weapon and ammo pickups converted to railguns, we need to make sure the player spawns in with a rail. Otherwise new players will find themselves with a dinky machinegun going up against 1000 damage rails.
Let's take a look at the multiplayer player EntityDefinition, player_marine_mp. It's a big definition, so we'll only show the relevant parts.
Quake4\instagib\def\player.def
entityDef player_marine_mp { "inherit" "player_marine" "weapon" "weapon_machinegun,weapon_gauntlet" "current_weapon" "1" ... "ammo_none" "-1" "ammo_railgun" "0" "ammo_machinegun" "100" "ammo_nailgun" "0" "ammo_blaster" "-1" "ammo_shotgun" "0" "ammo_hyperblaster" "0" "ammo_rocketlauncher" "0" "ammo_grenadelauncher" "0" ... }
The "weapon" KeyValue determines the starting weapon(s) for the player. The "current_weapon" key determines the initial selected weapon. Go ahead and replace the "weapon" and "current_weapon" lines with
Quake4\instagib\def\player.def
entityDef player_marine_mp { ... "weapon" "weapon_railgun,weapon_gauntlet" "current_weapon" "7" ... }
Make sure you leave the rest of the lines alone - we'll need them to keep everything working with the player.
Now we'll need to tweak the starting ammo values in the player.def. Remove the starting machine gun ammunition, and give the player 10 rail rounds to start with.
Quake4\instagib\def\player.def
entityDef player_marine_mp { ... "ammo_none" "-1" "ammo_railgun" "10" "ammo_machinegun" "0" "ammo_nailgun" "0" "ammo_blaster" "-1" "ammo_shotgun" "0" "ammo_hyperblaster" "0" "ammo_rocketlauncher" "0" "ammo_grenadelauncher" "0" ... }
That's it for the player.def.
1.3.4. Make the railgun do 1000 damage
So now we have railguns all-around. But it won't quite be InstaGib unless it's one-hit-one-gib. To accomplish this, let's give the railgun a large amount of damage - 1000 should suffice.
HitscanWeapons define their damage in their HitscanDefinition. In this case, the railgun's HitscanDefinition, hitscan_railgun_mp, uses the DamageDefinition damage_railgun. Keeping in mind the rules of MultiplayerEntityDefinitions, we'll want to look at damage_railgun_mp.
Quake4\instagib\def\weapons\railgun.def
entityDef damage_railgun_mp { "inherit" "damage_railgun" "damage" "100" }
Let's bump that number up!
Quake4\instagib\def\weapons\railgun.def
entityDef damage_railgun_mp { "inherit" "damage_railgun" "damage" "1000" }
1.3.5. Make the gauntlet do 1000 damage
As a final touch, let's add the gauntlet as a viable close-quarters option in our InstaGib fragfest. We'll modify the gauntlet's DamageDefinition to also do 1000 damage.
Quake4\instagib\def\weapons\gauntlet.def
entityDef damage_gauntlet { "damage" "50" "gib" "1" "dv_time" "100" "dv_scale" ".05" "deathPush" "200" "deathPushMin" "2000 400" "deathPushMax" "4000 500" "knockback" "50" "bleed" "1" }
Change that sucker to
Quake4\instagib\def\weapons\gauntlet.def
entityDef damage_gauntlet { "damage" "1000" "gib" "1" "dv_time" "100" "dv_scale" ".05" "deathPush" "200" "deathPushMin" "2000 400" "deathPushMax" "4000 500" "knockback" "50" "bleed" "1" }
That completes the mod.
1.4. Testing
To test your mod, make sure your instagib directory is a subdirectory of your Quake 4 install.
Default install: C:\Program Files\id Software\Quake 4 Instagib should be in: C:\Program Files\id Software\Quake 4\instagib
Navigate to C:\Program Files\id Software\Quake 4 and make a shortcut to Quake4.exe and re-name it InstaGib. Edit the properties of the shortcut and add the following command line arguments to the shortcut.
+set fs_game instagib +set developer 1
You're done! Double click the shortcut to play your mod. See PackagingMods for how to distribute instagib to your friends.
Download the mod (Unzip to Quake 4\ directory)
Questions? E-mail David ddynerman@ravensoft.com