Code Editing Tutorials
Random door opening sounds

With this you'll be able to control on which floor what sound is the door opening/closing sound. This is a new feature recently found out, so it's still unique to this site.

Step 1. Open WL_ACT1.C and search for "SND". The first time you should find:
//
// play door sound if in a connected area
//
area = *(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex)-AREATILE;
if (areabyplayer[area])
{
PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}


Step 2. Change this to, for example:

//
// play door sound if in a connected area
//
area = *(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex)-AREATILE;
if (areabyplayer[area])
{
if (gamestate.mapon >= 16) // anything above level 17 has the new sound
PlaySoundLocTile(DOGBARKSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
else
PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}
Step 3. Now search for "SND" again. This time you find:
ConnectAreas ();
if (areabyplayer[area1])
{
PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}

Step 4. Change this to, for example:

ConnectAreas ();
if (areabyplayer[area1])
{
if (gamestate.mapon >= 16)
PlaySoundLocTile(DOGBARKSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
else
PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}

Step 5. Save and compile. Oh yeah, change the sounds you used too, or else the players starts wondering where that barking sound comes from...

Get back to the Dome tutorials
Jump to the top