Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
DeXiaZ

How to make elevators play two different sounds for up and down moving?

Recommended Posts

Hello, community. Sorry for bad eng, it's hard to explain my question in two words, so here goes explanation:

I'm making an upside-down map (UDMF). So, all doors are now an elevators. It's "ok", but elevators play classic elevator sound. I want to change it to door sound. I can do this manualy in slade editor (change sound files) or do a Sound Sequence script. But I've got a problem - I can't do special Sound Sequence script for platforms.

I mean:

:Platform
	playuntildone   plats/pt1_strt
	stopsound	plats/pt1_stop
end

I can choose "whooooooosh" moving sound and "bdut" stop sound. But "whoooooosh" sound plays twice when platform goes down and up.

I want to made platform play sound#1 (door open sound) for moving DOWN sequence and play sound#2 (door close sound) for moving UP sequence.

How I can do it? I thought about ACS scripts but it's too complicated because I'm not good in ACS scripting.

Or maybe I'm wrong and I can do simple edit in SNDSEQ?

 

Edited by DeXiaZ

Share this post


Link to post

I'm pretty sure (but not 100%) that you can't do it without ACS.

Here's a quick and dirty code for a door that opens and closes:

script 1 (int doorTag, int soundTag, int time) {
	PlaySound(soundTag, "doors/dr1_open");
	Plat_DownWaitUpStay(doorTag, 32, time*35);
	PlaySound(soundTag, "doors/dr1_clos");
}
doorTag is obvious, soundTag is for the sound to play from a mapspot thing you'll add to the middle of the door, so the sound comes out of the actual door. time is the time in seconds you want it to stay open. Also, that 32 is the speed, you might want to change it.

If you don't use actual platforms anywhere, just remove their sounds by adding this to your SNDINFO:
plats/pt1_strt dsempty
plats/pt1_stop dsempty
plats/pt1_mid dsempty
If you do need platforms with sounds, well, then we need more hackery. Same goes if you want doors that stay open forever. I'm willing to write the code for those cases, just say if you need them.

Share this post


Link to post

Thank you very much for reply and help!

I don't need the actual platforms anywhere so your plan with "disabling" sounds is ok.

I can't try your code right now but I'm sure that it will work fine. I'll add you in credits of my future WAD with this upside-down map!

Share this post


Link to post

Ah! I messed up something in the code, the name of the sounds. I edited the post so it's correct now, sorry for any inconvenience!

Share this post


Link to post

Tested it. It doesn't work properly. Or I don't get it how I must play new sounds.

Platform goes up and down, but I don't hear door sounds.

Share this post


Link to post

Did you put a mapspot with a respective TID near the platform to play the sounds from?

Also, you wouldn't have to use a mapspot if you used SoundSequenceOnSector instead of PlaySound, but they you'd have to refer to a SNDSEQ sound instead of a SNDINFO sound in its parameter.

Share this post


Link to post
scifista42 said:

Did you put a mapspot with a respective TID near the platform to play the sounds from?

Also, you wouldn't have to use a mapspot if you used SoundSequenceOnSector instead of PlaySound, but they you'd have to refer to a SNDSEQ sound instead of a SNDINFO sound in its parameter.


It's too complicated for me, I'm not a programmer. I can read wiki but most things for me looks like japanese language.

I've added mapspot, but I can't use his code properly. GZDoom builder says that line 2 "script 1 (int 6, int 106, int 150)" is wrong. I don't get it at all. If I'll change it to "script 1 (void)" it will play door closing sound every time when I'll press it.

Heh, it sucks, please, anyone, keep saying to me that Doom modding isn't mine.

Share this post


Link to post
DeXiaZ said:

it will play door closing sound every time when I'll press it.


My fault, there's another bug in my code.

script 1 (int doorTag, int soundTag, int time) {
	PlaySound(soundTag, "doors/dr1_open");
	Plat_DownWaitUpStay(doorTag, 32, time*35);
	Delay(time*35);
	PlaySound(soundTag, "doors/dr1_clos");
}
I tested this version and it works.

As for your error, don't change anything in the code other than that 32 if you want a faster / slower door. This is how you use it:

Share this post


Link to post

EDIT: Ok, now it worked. But when door is closing I hear closing sound but sector goes up 2 seconds later after sound playing

Share this post


Link to post

That's because the code mistakenly assumes that the platform moves instantly, but in reality, the platform's movement takes some time (depending on how tall the "door" is), and the sound's delay doesn't take this time into account. Instead of Plat_DownWaitUpStay, you would have to use an action that merely moves the platform downwards + play the opening sound, then use TagWait to wait until the movement finishes, then use Delay to wait, then use an action that merely moves the platform upwards + play the closing sound, then use TagWait to wait until the movement finishes before being able to activate the script again.

Share this post


Link to post

I've fixed this situation by changing delay formula.

Instead of 35 I've used 40. It worked much better.

You're right about door "height" but, thx to Doom 1 mappers, most doors had the same height so this formula mostly is universal

UPD: Whoops, did I say "Doom 1"? Well...nevermind. If everything will be ok, you'll see it...near the 2017, I think.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×