| MCS' Coding Tips
Making bosses react to sounds
Written by MCS
Tested by Quinnsey
Tips - "Success"!
Original Wolf 3D
|When making level designs, it's easy to make normal guards react to sounds. As most of you will know, this is done by the use of floor codes.
For more information, please refer to the documentation that comes with the MapEdit package. If you don't have it yet, it can be downloaded from our Utilities page.
Basically, if a guard is on the same floor code as the player, no matter what room both of them are currently in, the guard will be alerted and will start moving towards the player, unless he's made "deaf" or "steadfast" by a so-called ambush marker (floor code 106).
This doesn't work for bosses, though. The engine assigns an ambush marker to every boss at spawn time, so they will never react to sounds, no matter what floor code they are on.
You can add a surprising element to your game by removing this coded ambush marker.
Doing so will give you the same freedom of design as with normal guards.
You can change this setting for each boss individually. Let's say you want to remove the ambush marker for Hans Grosse. Here's how to do it:
Open WL_ACT2.C and locate the SpawnBoss routine:
void SpawnBoss (int tilex, int tiley)
unsigned far *map,tile;
new->speed = SPDPATROL;
new->obclass = bossobj;
new->hitpoints = starthitpoints[gamestate.difficulty][en_boss];
new->dir = south;
new->flags |= FL_SHOOTABLE|FL_AMBUSH;
And replace the white line with:
new->flags |= FL_SHOOTABLE;
That's all. Compile and link up. Make a simple level design with Hans Grosse behind a door, modify the floor codes, fire a shot and watch him open the door :-)
Of course, you can still make him "deaf" by using the map ambush marker.