In this tutorial I'll look at the following topics:
Brac-a-brac divides naturally into two types, stuff the player acquires when they bump into it ( weapons, mana, artifacts, items), and stuff they don't, objects.
The acquireable stuff is rather easy, because there is only one basic field, spawnflags, where a value of 1 means that the item floats exactly where you put it in the map, rather than dropping down to a convenient distance off the floor. So you can test this by putting an item such as greenmana in your map, and noting the effect of the spawnflag. That's all the basics for this stuff, tho there is a bit more to it in the triggering and spawning sections.
There's a bit more to the objects; their most important field is angle, which specifies the direction the object is facing, in the same style as with doors and buttons. Some objects, such as corpes and books, can also usefully be given 3d angle fields, which can be used to tilt the object in any direction (so that a book can sit on a slanted lecturn, a corpse on a slope, or a sword stick out of a body at an artistic angle).
Objects can also take a health field, which determines how much damage it takes to destroy them (the destructible ones also have a default health, so you don't actually have to specify one unless you want a special effect), and there are also mass and abslight fields, as discussed on the reference page.
So if you haven't done it yet, you should put a few random objects into a test map, and experiment with these fields. Some objects have additional fields, such as skin, or automatically take on different skins in different `worldtypes', see the reference page for more on these topics when you actually want to use the relevant objects in a map..
Map items can participate in triggering and targetting. Both acquirables and objects can have targets, which acquirables trigger when they are acquired, and objects trigger when they are destroyed (so in both cases, the targets are triggered when the item disappears from the map). Destructible objects can furthermore be targetted; when they are triggered, they are destroyed.
So you can try all this out by putting, say, a Krater of Might (art_manaboost) and a cauldron (obj_cauldron) in your map, putting the cauldron where you can see it from the position of the Krater, with the krater targetting the cauldron. Now run the map, and take the krater, watching the cauldron explode. Anything that can be triggered at all can be triggered by the taking of an takeable item.
There is an interesting variant on orginary targetting, which is `killtargetting'. Any entity that can take a target field can also take a killtarget field. Then when the entity `fires' (triggers its targets), it also removes its `killtargets' (entities whose targetname-value is the same as its killtarget-value). This can be used for example to present the player with a choice between two desireable items. You can have for example Krater of might (art_manaboost) and a Mystic urn (art_superHBoost), each killtargetting the other. Now if the player takes the urn, the krater vanishes, and vice-versa. A more sophisticated use of killtargetting is to make an item appear at different places in the map, depending on what the player does earlier: the item can be initially placed at multiple locations, and all but one removed by killtargetting (this requires care, obviously, I've actually had considerable trouble with finding the Treasury Key in Blackmarsh, & I suspect killtargetting bugs as perhaps being the culprit). It's my belief that absolutely all entities can be killtargetted; if you killtarget an entity such as a door that owns brushes, they disappear too.
Spawning is when some event causes a new item to appear in the map, where it previously wasn't. For newbies interested in making deathmatch maps, most important point about spawning is this:
In deathmatch, stuff you can take respawns automatically; you don't have to do anything to make it happen, and you can't change the way it works (unless maybe you want to get into serious HexenC coding). In fact if deathmatch maps is what you're interested in, stop now, since the rest of this has nothing to do with you. |
The way it works is pretty simple, although a bit cumbrous, it seems to me. The object or monster takes fields which specify what is spawned and how much. For mana, the fields are greenmana and bluemana, and the values say how much mana the mana-blob contains (there doesn't seem to be any way to produce combined mana, tho you could get the same effect in a less pretty way by producing equal amounts of green and blue). For the other artifacts there are fields like cnt_tome, cnt_torch, etc., and their values are numbers saying how many of the items to produce. So you could produce 6 tomes and 5 kraters of might, if you wanted to. To tamp this down with an example, here are the fields for a chest that produces a torch when you smash it:
classname: | obj_chest1 |
cnt_torch: | 1 |
A list of all of these spawning fields is given here.
The other way to spawn is with an item-spawner, which spawns the item at its location when it's triggered; now you should be able to read the reference, especially because it has an example at the end.