| MCS' Coding Tips "Success!" |
![]() |
Making bosses react to sounds Written by MCS Tested by Quinnsey |
| Main Page News Wolfenstein 3D Texture Library MCS' Coding Tips - "Success"! Utilities Spear Resurrection Wolfendoom Wolf Collection Original Wolf 3D Doom/Duke maps Other Stuff Links Questions? Email us! |
| 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; SpawnNewObj (tilex,tiley,&s_bossstand); new->speed = SPDPATROL; new->obclass = bossobj; new->hitpoints = starthitpoints[gamestate.difficulty][en_boss]; new->dir = south; new->flags |= FL_SHOOTABLE|FL_AMBUSH; if (!loadedgame) gamestate.killtotal++; } 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. Success! MCS. |