For the inaugural map hack post, I’m going to share what I think is the classic map hack. I first recall seeing it in a 100-brush map (I think it was by czg). Besides having a pedigree, it’s quite a straightforward hack and so it’s a good introduction for anyone who hasn’t seen them before. Most of my map hack posts will be short affairs containing the fields you need to make the hack work and maybe some explanation if you’re lucky; for the sake of people who are using this as an introduction we’ll go slowly and explain all the angles, starting with what a “map hack” is.
Map hacks are a way to get entities in your quake maps to do things they weren’t designed to do. They open up lots of exciting possibilities which otherwise would have required you to write a quake mod. To understand them you do need to have some understanding of how mods in quake work, but using them is very simple. They all involve setting properties on an entity in your map. The values you set are read by the QuakeC code, and the result is that your entity gets the behaviour of a different class!
Notation: when I write:
This actually means: add a key to your entity called
skin, and then set its value to
1. For brevity, I will often use the same notation to tell you which class of entity to add to the map:
means add a new entity to your map of class
info_notnull is often used in these hacks because it has no behaviour to begin with, it is a clean slate. Today the behaviour we will add is an ogre’s grenade exploding. Create an entity with these fields:
"classname" "info_notnull" "targetname" "explode" "use" "OgreGrenadeExplode"
If you add a trigger to your map which has a target called “explode”, you can use it to trigger an explosion at the origin of your
info_notnull. Why does this work? In quake, when a target is triggered, every entity with a matching targetname runs its
use function. Usually the QuakeC is responsible for setting a
use function for a class, e.g. to make a door open. Our hack allows us to set a
use function on an entity which usually doesn’t have one, and gives us free rein to choose any function. We cannot use this trick to alter the
use function of entities which already have one, because the QuakeC will always overwrite our choice.
OgreGrenadeExplode is a good choice for a cosmetic explosion, it looks right, and doesn’t do too much damage. Some alternatives we could try are
BecomeExplosionwhich does no damage and doesn’t throw out yellow shrapnel
barrel_explodewhich does much more damage – exactly like an exploding barrel
tbaby_die2which explodes exactly like a spawn dying, even down to the purple sparks
If you’re new to map hacks, it’s worth having a little experiment with this to get the feel of it. A really good exercise if you have a copy of the QuakeC source is to try out completely different kinds of functions, not just the ones about that make things go boom. You’ll probably find lots of them don’t do anything, and others work in strange ways. Some might even crash the entire map! In future we may explore how to get some of them to behave.