Author Topic: Missing sounds (doors, containers, etc)  (Read 2660 times)

Missing sounds (doors, containers, etc)
« on: December 21, 2014, 02:09:37 pm »
Alright, so I've got a problem with the SDK.

A lot of the sounds are missing, such as the ones for opening and closing doors. Music and various combat sounds still play. I tried extracting some of the Fallout 2 .acm files to \Client\data\sound\sfx, which didn't fix the issue.

The protos for doors and such just have these SoundIDs but these aren't really defined anywhere in the server files. At least, a thorough search with Notepad++ didn't reveal anything at all.

Are these sounds just something that wasn't implemented in the earlier revisions? (I'm using 408 because later revisions don't work well for me for some reason) Or am I just missing something simple?

JovankaB

  • Guest
Re: Missing sounds (doors, containers, etc)
« Reply #1 on: December 21, 2014, 03:09:24 pm »
The door and locker sounds are played from scripts, check out lockers.fos.
At least in 2238 but it's probably taken from original SDK.

Re: Missing sounds (doors, containers, etc)
« Reply #2 on: December 21, 2014, 04:13:31 pm »
Hm, okay. I guess I'll just have to figure out how to do it via script then.

Can you tell me though what purpose do SoundIDs have?
« Last Edit: December 21, 2014, 04:27:55 pm by ffsake »

JovankaB

  • Guest
Re: Missing sounds (doors, containers, etc)
« Reply #3 on: December 21, 2014, 05:20:21 pm »
As far as I remember in some cases these are used in some weird way to identify the correct sound file to play (it's ascii code of the last letter of the sound file, or something like that). I only needed it once and then I quickly forgot how it works. I only remember that I thought "that's stupid" when I learned about it.
« Last Edit: December 21, 2014, 05:32:39 pm by JovankaB »

Re: Missing sounds (doors, containers, etc)
« Reply #4 on: December 21, 2014, 08:34:16 pm »
Decided to try something as simple as making the doors play AIRSIREN.ogg when you open them on lockers.fos.

At times it worked when I compiled the script but now it just throws me the "Expected expression value" error.

Code: [Select]
            // Change state
            if( FLAG( locker.LockerCondition, LOCKER_ISOPEN ) )
                locker.LockerClose();
                map@ map = GetMap(locker.MapId);
                map.PlaySound( "AIRSIREN.ogg" );
            else
                locker.LockerOpen();

Strangely enough at one point I got it to work with more or less similar lines, though the sound was only supposed to play when the door opened. It played when the door was both opened and closed.

Might be just some stupid newbie mistake I've made, I'm not that good at AS yet.
« Last Edit: December 21, 2014, 08:37:22 pm by ffsake »

JovankaB

  • Guest
Re: Missing sounds (doors, containers, etc)
« Reply #5 on: December 21, 2014, 09:48:15 pm »
If you have more than one statement after if(condition), you have to put them in brackets:

            if( FLAG( locker.LockerCondition, LOCKER_ISOPEN ) )
            {
                locker.LockerClose();
                Map@ map = GetMap(locker.MapId);
                map.PlaySound( "AIRSIREN.ogg" );
            }
            else


Also notice that it's Map@ map not map@ map, AngelScript is case sensitive! And class names start with uppercase letter (it's just a naming convention though, to make them easily distinguishable from variables).
Maybe there is more errors, but that's what I noticed at first glance.
« Last Edit: December 21, 2014, 10:04:48 pm by JovankaB »

Re: Missing sounds (doors, containers, etc)
« Reply #6 on: December 21, 2014, 10:14:38 pm »
Alright, thanks. It works now properly (though I need to change the sound to something else, that air siren obviously gets annyoing really quickly)

Now to just figure out if I can make the script play a sound based on it SoundID. I'm thinking about using the bool LockerOpen(Item& item) bit from the end of 2238's lockers.fos and tweaking a bit. Not sure if will work at all, but it's worth a shot.

EDIT:

Code: [Select]
            // Change state
            if( FLAG( locker.LockerCondition, LOCKER_ISOPEN ) )
            {
                 locker.LockerClose();
         Map@ map = GetMap(locker.MapId);
         string sound = locker.GetType() == ITEM_TYPE_DOOR ? "SODOORSA.ACM" : "IOCNTNRA.ACM";
         sound = locker.Proto.SoundId;
         map.PlaySound(sound);
    }
            else
                locker.LockerOpen();
        }

Didn't get any errors when it compiled, but doesn't work either. Might have something to do with the map.PlaySound statement?
« Last Edit: December 21, 2014, 10:37:02 pm by ffsake »

JovankaB

  • Guest
Re: Missing sounds (doors, containers, etc)
« Reply #7 on: December 22, 2014, 02:38:04 am »
OK, first of all, map.PlaySound() requires an argument that is a string (a sequence of characters) holding the sound's filename. Nothing else will work. You can do it directly, just like you did:
Code: [Select]
map.PlaySound("AIRSIREN.ogg");
Or pass it as a variable with string type, which stores the filename:
Code: [Select]
string mySirenSound = "AIRSIREN.ogg";
map.PlaySound(mySirenSound);

The stuff you did:
Code: [Select]
sound = locker.Proto.SoundId;
map.PlaySound(sound);
doesn't work, because locker.Proto.SoundId isn't even a string! It has uint8 (unsigned 8-bit integer) type - which means it can hold ONLY numbers in a range from 0 to 255. It can't be used to store a filename and it doesn't magically identify them. I don't even know what's the result of an expression like this (sound = locker.Proto.SoundId), maybe an empty string or something like "48" but not any meaningful filename for sure. That's why it doesn't play.

You should  check out the 2238 LockerOpen code again. It does something slightly different:
Code: [Select]
sound[7] = item.Proto.SoundId;Notice the 7 in square brackets. It means "8th character of the sound string". Why 7 means 8th? Because the index starts from 0 (sound[0] means the first character of the sound string, sound[1] the second character etc).

So the code doesn't replace the whole sound string, only 8th character of it. What does it replace with? With a character which has ASCII code equal to item.Proto.SoundId. You have to look it up in the ASCII table.

So in case of "SODOORSA.ACM" it replaces the bold "A" with a character which ascii code is equal to the locker.Proto.SoundId. I guess it just happens that the door filenames sounds have only different the last character, so in their case item.Proto.SoundId is used to store this character's ASCII code. It's a bit primitive way to do it (to put it mildly), but it works for original Fallout door sounds.



BTW, I just realized it probably didn't work in your SDK (before you made any changes) because of added UNICODE and changes in string handling, that happened in FOnline some time ago. That most likely would brake the "sound[7]" crap.
It might be fixed in later revisions of the script, so just check later version of lockers.fos.
« Last Edit: December 22, 2014, 03:33:48 am by JovankaB »

Re: Missing sounds (doors, containers, etc)
« Reply #8 on: December 22, 2014, 01:30:38 pm »
The "sound[7]" crap indeed seems to be broken, so I just worked around it. You could probably call it primitive at best but it works for me.

Code: [Select]
            // Change state
            if( FLAG( locker.LockerCondition, LOCKER_ISOPEN ) )
    {
                                locker.LockerClose();
Map@ map = GetMap(locker.MapId);
uint8 sound = locker.Proto.SoundId;
if(sound == 65)
map.PlaySound("SCDOORSA.ACM");
if(sound == 66)
map.PlaySound("SCDOORSB.ACM");
if(sound == 67)
map.PlaySound("SCDOORSC.ACM");
if(sound == 68)
map.PlaySound("SCDOORSD.ACM");
if(sound == 69)
map.PlaySound("SCDOORSE.ACM");
if(sound == 70)
map.PlaySound("SCDOORSF.ACM");
if(sound == 71)
map.PlaySound("SCDOORSG.ACM");
if(sound == 72)
map.PlaySound("SCDOORSH.ACM");
if(sound == 73)
map.PlaySound("SCDOORSI.ACM");
if(sound == 74)
map.PlaySound("SCDOORSJ.ACM");
if(sound == 75)
map.PlaySound("SCDOORSK.ACM");
if(sound == 76)
map.PlaySound("SCDOORSL.ACM");
if(sound == 77)
map.PlaySound("SCDOORSM.ACM");
if(sound == 78)
map.PlaySound("SCDOORSN.ACM");
if(sound == 79)
map.PlaySound("SCDOORSO.ACM");
if(sound == 80)
map.PlaySound("SCDOORSP.ACM");
if(sound == 81)
map.PlaySound("SCDOORSQ.ACM");
if(sound == 82)
map.PlaySound("SCDOORSR.ACM");
if(sound == 83)
map.PlaySound("SCDOORSS.ACM");
if(sound == 84)
map.PlaySound("SCDOORST.ACM");
    }
            else
    {
                                locker.LockerOpen();
Map@ map = GetMap(locker.MapId);
uint8 sound = locker.Proto.SoundId;
if(sound == 65)
map.PlaySound("SODOORSA.ACM");
if(sound == 66)
map.PlaySound("SODOORSB.ACM");
if(sound == 67)
map.PlaySound("SODOORSC.ACM");
if(sound == 68)
map.PlaySound("SODOORSD.ACM");
if(sound == 69)
map.PlaySound("SODOORSE.ACM");
if(sound == 70)
map.PlaySound("SODOORSF.ACM");
if(sound == 71)
map.PlaySound("SODOORSG.ACM");
if(sound == 72)
map.PlaySound("SODOORSH.ACM");
if(sound == 73)
map.PlaySound("SODOORSI.ACM");
if(sound == 74)
map.PlaySound("SODOORSJ.ACM");
if(sound == 75)
map.PlaySound("SODOORSK.ACM");
if(sound == 76)
map.PlaySound("SODOORSL.ACM");
if(sound == 77)
map.PlaySound("SODOORSM.ACM");
if(sound == 78)
map.PlaySound("SODOORSN.ACM");
if(sound == 79)
map.PlaySound("SODOORSO.ACM");
if(sound == 80)
map.PlaySound("SODOORSP.ACM");
if(sound == 81)
map.PlaySound("SODOORSQ.ACM");
if(sound == 82)
map.PlaySound("SODOORSR.ACM");
if(sound == 83)
map.PlaySound("SODOORSS.ACM");
if(sound == 84)
map.PlaySound("SODOORST.ACM");
}
        }
« Last Edit: December 22, 2014, 01:32:13 pm by ffsake »

Offline Wipe

  • Rotator
  • Random is god
Re: Missing sounds (doors, containers, etc)
« Reply #9 on: December 22, 2014, 07:28:53 pm »
Ugh, that's just horrible :D

If you work on SDK r400+, instead of
Code: [Select]
someString[7] = item.Proto.SoundId;use
Code: [Select]
someString.rawSet( 7, item.Proto.SoundId );
Games are meant to be created, not played...

Re: Missing sounds (doors, containers, etc)
« Reply #10 on: December 22, 2014, 07:45:11 pm »
Yeah, it looks pretty terrible. I'm not that good at scripting yet.

Oh well, at least I learned a few things in this thread. I'm going to use the "someString.rawSet( 7, item.Proto.SoundId );" bit you suggested from now on.

Also:


I keep getting these black lines/grids on the intro videos. Any idea what could be causing them?