Friday, March 1, 2013

Mini-update 1 March 2013 PLUS Playing Sounds Tutorial

Remember how I said I'd probably not build anything this week because of exams?

I lied.

Kindof.

...no, I definitely lied.

EDIT 9 Mar 2013: Tutorial is now easier!

This week I dealt more with sounds and such. No, I haven't found a better Rarity voice actor; yes, I would like to find one. Moving on.

I fixed a couple of sounds with Audacity. I increased the volume of Rarity fainting, the fluffy pony's active sound (me wan sketti!), added reverb to the double spreadshot firing sound (before, I'd just used the same one as the spreadshot), and added a few new sounds.

See, if you've played the game, you know that sometimes crossing invisible lines (linedefs) does things in the game, like open hidden doors or lower platforms. I wondered if there was a way to get a sound to play when you crossed the line; you know, add a little reality to the game. Turns out there is, but it's a longish process. And, since it frustrated me and caused me grief for three hours straight before I figured it out, I've decided to share the process to prove to the world that eff you, I am smarter than my software just in case someone else wants to do this, too.
(I assume that you already have a .wad and SLADE and DoomBuilder and are playing with ZDoom).

1) Record the sound. For example, "*sigh* King Sombra would approve." SLADE has read my .wav and .mp3 files without issue, but I'm sure it'll take .ogg files too.

2) Open SLADE (or whatever you're using) and import the file (Archive->New->Entry; name it, then right-click on that entry->Import File). Remember that only nine characters will be accepted, so I named it SOMBRAOK.

Now comes the tricky part.

3) Open the file called SNDINFO. This is a text file. For some reason, the engine thinks it's easier to parse this file for sound definitions instead of just calling the sound itself. Go figure. Files are named with base/type. Example: spider/pain     dsbomin3; grater/hit     dsgrtr (blogger doesn't let me hit tab, but you should hit tab twice in between the two phrases). I named it world/stairs, so my entry reads thus:

world/stairs      sombraok

Save your changes and close SLADE.

5) Open DoomBuilder (NEVER have these two programs open at once. I have lost three levels this way. You'd think I'd learn eventually but nooo...)
Make sure the map is in "ZDoom (Doom in Hexen *or* UDMF Format)" because "ZDoom (Doom in Doom format)" doesn't have scripting.

6) In Linedefs mode, select the line you want to be your trigger. Hitting L and drawing a line works, or select one already there. I chose one that was already part of my stairs. Right click on it.
This screen should come up:
Type in 80 into the action box. The bar will now say Script Execute and the boxes will change. You only need to worry about the first one, where it will say Script number. Choose any number you want, but remember it for later.
It should look like this:
The top part refers to a few properties of the line. The only one you should probably bother with here is Repeatable Action; if it should play the script every time the line is crossed or just the first time. In this map, you have to cross the stairs a few times, and having her say "King Sombra would approve" is only funny the first time if it's even funny at all, so I left that box unchecked.
Map number refers to... well... the number of the map you want the line to affect. Yeah. You can have a switch in level one open a door in level two. But that's too complicated for me, so I left it at zero (where it will only affect the map it is on). This script doesn't call for any other arguments, so leave those at zero as well.
The dropdown box on the bottom lists the different ways to trigger it. For example, you could set this on a switch on the wall and have the sound activate on "Player presses use". But that can be another tutorial.
Hit OK.

7) Hit F10. The scripts window will come up.
I'll be honest. ACS (the scripting language) confuses me still. But I have learned certain keywords that seem to work.
The first thing you must do is type this:

#include "zcommon.acs"

If you don't, ZDoom doesn't know how to interpret the scripts and you'll get a compiling error. (You'd think these definitions would be native...)
Then this:

Script 10 (void)
{
    AmbientSound ("world/stairs", 127);
}


Script 10 here refers to the number you chose earlier. (void) means it's only played when called. You can also put (open) and it'll run the script as soon as the map opens; for example, playing the opening challenge in the Trixie-ite level. The numbers indicate volume, with 127 as the maximum. Make sure you have everything I typed, especially that last semicolon.

Click the paper with the lightning bolt on the right of the line of icons. If nothing happens, it compiled without errors (you did it right).

8) Hit F9 to test your map.

That's it. Now, Rarity will give a sarcastic remark the first time she crosses those stairs.

You know, I kindof just did this in celebration that I finally figured it out. If I wanted to do tutorials, I should probably start with something smaller. Like making doors. Took me about an hour, no joke, to learn how to make a working door in Hexen format. Should I do more tutorials? I think I will...

No comments:

Post a Comment