SoundSequence Issue - Linedef Script vs Weapon Pickup Script

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
droscoe
Posts: 37
Joined: Fri Mar 13, 2015 9:03 pm

SoundSequence Issue - Linedef Script vs Weapon Pickup Script

Post by droscoe »

I'm a bit confused, I expected this to work properly. When you walk over a chaingun, I have it set to run Script 7 and do a few things. (change light color, brightness, open a couple doors...)

All of these script functions work flawlessly, except my SoundSequence function. It just will not play the sound sequence. Yes, I have my SndInfo and SndSeq. Whenever I make a linedef run the script when you walk across it, it plays the sound no problem. But when I make the chaingun run the script when you pick it up, it won't play. But everything else runs perfectly.

ACS

Code: Select all

script 7 (void)
{
	SoundSequence("blaugh1");
	Thing_Deactivate(43);
	Thing_Activate(45);
	ACS_Terminate(6,0);
	Sector_SetColor(39,700,0,0);
	Sector_SetColor(44,700,0,0);
	Sector_SetColor(5,700,0,0);
	Light_ChangeToValue(39,255);
	Light_ChangeToValue(46,256);
	Delay(70);
	Door_Raise(40,64,0,0);
	Delay(70);
	Door_Raise(41,64,0,0);
}
If you have an answer for this, great. But if you have a solution for how I can get AROUND this, that'd be great too. I have a chaingun in the middle of the floor, the player is trapped and a couple doors open up when they pick it up...I've tried to make a square around the chaingun so that when the player crosses a linedef, it runs the script instead. But if you walk over one linedef that runs the script, the rest of them are still 'active' and you can walk over them too, each of them running the script again and again. (since its a square, it would run 4 times if you ran over each of the four lines). Is there a way to 'deactivate' the rest of these linedefs once ONE of them has been crossed?

I can't just make one linedef, the player could, by accident or mistake, or on purpose even, go AROUND the chaingun and come from the other side, and not set off the linedef script.

Thanks,
Dustin

Image
User avatar
Kappes Buur
 
 
Posts: 4182
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by Kappes Buur »

droscoe wrote: ..... But if you walk over one linedef that runs the script, the rest of them are still 'active' and you can walk over them too, each of them running the script again and again.
For a case like this use a variable, for example

Code: Select all

#include "zcommon.acs"

int door = 0;

script 1 (void)
{    
    while ( door == 0 )
    {
       do stuff here
       do more stuff here
    
       door = door + 1 ;  // now increment door to prevent another activation
    }
}
droscoe
Posts: 37
Joined: Fri Mar 13, 2015 9:03 pm

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by droscoe »

Thank you so much Kappes. I appreciate your help. That works just great!

Little preview here. Thanks again. I'm still surprised it wouldnt play when the script was attached to the chaingun pickup, but this works just fine anyway.

https://youtu.be/dY7HW7DbChM
yqco
Posts: 80
Joined: Sat Jul 06, 2013 9:19 pm

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by yqco »

The issue might be that the sound is emanating from the Chaingun itself and that its removal is forcing the sound to stop prematurely. You could try calling one of the variant functions like [wiki]SoundSequenceOnSector[/wiki] or [wiki]SoundSequenceOnActor[/wiki] and passing it a separate actor.
droscoe
Posts: 37
Joined: Fri Mar 13, 2015 9:03 pm

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by droscoe »

yqco wrote:The issue might be that the sound is emanating from the Chaingun itself and that its removal is forcing the sound to stop prematurely. You could try calling one of the variant functions like [wiki]SoundSequenceOnSector[/wiki] or [wiki]SoundSequenceOnActor[/wiki] and passing it a separate actor.
I might look into that. Thank you. Both methods would accomplish my goal, but it seems a bit more satisfying for it to work the moment you acquire the chaingun, so I'll try something like that.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by Gez »

droscoe wrote:Is there a way to 'deactivate' the rest of these linedefs once ONE of them has been crossed?
Give a lineid to all your lines that activate that script, and in the script use [wiki]SetLineSpecial[/wiki] to set all these lines to have special 0.

I've used that in ZDCMP2 to clean away activation lines. You can activate display of lines with a special on them in the automap, and even if you make it so that the script will have no further effect, the lines will still be highlighted in the automap -- unless you nullify their specials.
droscoe
Posts: 37
Joined: Fri Mar 13, 2015 9:03 pm

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by droscoe »

Ahh, nice. Thank you. That would work just great. Consider this topic solved, I now have the knowledge to take over the world!

Wad. Take over the wad.
User avatar
arookas
Posts: 265
Joined: Mon Jan 24, 2011 6:04 pm
Contact:

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by arookas »

Don't forget you can also assign the special to the chaingun actor itself, so it activates a script upon pickup without the need of any linedefs (judging by the screenshot, it appears you're using UDMF). Also, you could have a mapspot in the same spot as the chaingun with a unique TID and play the sound sequence on that actor instead.
droscoe
Posts: 37
Joined: Fri Mar 13, 2015 9:03 pm

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by droscoe »

Right, but again, the problem is that it won't play my sound when you pick it up. As someone mentioned above, it could be due to the fact that the chaingun sprite doesn't exist anymore, and there is no place to play the sound.

I could go the map-spot route, but then it becomes directional sound.

Using a script to deactivate each line after one of them is crossed is probably the best method. THank you!
User avatar
arookas
Posts: 265
Joined: Mon Jan 24, 2011 6:04 pm
Contact:

Re: SoundSequence Issue - Linedef Script vs Weapon Pickup Sc

Post by arookas »

droscoe wrote:I could go the map-spot route, but then it becomes directional sound.
You can always use [wiki]LocalAmbientSound[/wiki], or use [wiki]PlaySound[/wiki] on the script activator (player, in this case). The linedef method doesn't really change that problem.

EDIT: Wait, aren't sound sequences always directional (unless specified in SNDSEQ)? unless you want a pickup sound and sound sequence?
Locked

Return to “Editing (Archive)”