Ensuring a sound will play during PowerTimeFreezer
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 74
- Joined: Mon Apr 19, 2021 12:58 pm
Ensuring a sound will play during PowerTimeFreezer
I was trying to figure out if there's any way to rig it so that projectiles and other actors with the NOTIMEFREEZE flag can play sounds during the effect of timefreezing powerups. DeathSound for example doesn't seem to add any special behavior, and fairly certain none of the flags in A_StartSound seem like they'd affect that.
This seems like a general behavior question than a Scripting one specifically, but posted here for lack of a new topic button in the main Editing forum.
This seems like a general behavior question than a Scripting one specifically, but posted here for lack of a new topic button in the main Editing forum.
-
-
- Posts: 1853
- Joined: Sun Jul 21, 2019 8:54 am
Re: Ensuring a sound will play during PowerTimeFreezer
Not as far as I'm aware.
TimeFreezer freezes all sounds and music and there's no way to enable specific sounds, at least no way that I know of.
You can however make all sounds still happen by creating a new powerup in ZScript and using S_ResumeSound/S_PauseSound:
Also, since PowerTimeFreezer is something that is coded, I would say that the scripting subforum is the place for this topic.
TimeFreezer freezes all sounds and music and there's no way to enable specific sounds, at least no way that I know of.
You can however make all sounds still happen by creating a new powerup in ZScript and using S_ResumeSound/S_PauseSound:
Spoiler:This will not cause monsters to make noises, since they are frozen and can't access their A_Pain function.
Also, since PowerTimeFreezer is something that is coded, I would say that the scripting subforum is the place for this topic.
-
- Posts: 74
- Joined: Mon Apr 19, 2021 12:58 pm
Re: Ensuring a sound will play during PowerTimeFreezer
Seems like that'd be a good workaround to be honest. Plenty enough for the original use case that came to mind, specifically a weapon that grants time freeze as a side effect, I found in testing that the freezing cut off the sound I'd mixed up for it.Jarewill wrote:Not as far as I'm aware.
TimeFreezer freezes all sounds and music and there's no way to enable specific sounds, at least no way that I know of.
You can however make all sounds still happen by creating a new powerup in ZScript and using S_ResumeSound/S_PauseSound:Spoiler:This will not cause monsters to make noises, since they are frozen and can't access their A_Pain function.
Also, since PowerTimeFreezer is something that is coded, I would say that the scripting subforum is the place for this topic.
EDIT: Just tested and that does the job just perfectly. Thanks!
EDIT 2: One oddity however, pausing the game breaks that entirely.
-
- Posts: 22
- Joined: Wed Apr 28, 2021 1:18 am
- Location: Pantai Remis, Perak, Malaysia
Re: Ensuring a sound will play during PowerTimeFreezer
I think something has been omitted, so I simply copy the code from gzdoom.pk3 like this.Chaosvolt wrote:EDIT 2: One oddity however, pausing the game breaks that entirely.
Spoiler:I just tested once and it's works perfectly for me, hope it helps.
Note: Erase or disable "S_PauseSound(false, true)" to keep playing music and sounds during PowerTimeFreezer.
-
- Posts: 74
- Joined: Mon Apr 19, 2021 12:58 pm
Re: Ensuring a sound will play during PowerTimeFreezer
Ah, will test that later on.
That said, the "pausing breaks the sounds" thing doesn't seem to prevent the next altfire from still playing its sound (since I have it set so the player can't use the altifre again while under the powerup's duration), so so the problem is a very minor one.
That said, the "pausing breaks the sounds" thing doesn't seem to prevent the next altfire from still playing its sound (since I have it set so the player can't use the altifre again while under the powerup's duration), so so the problem is a very minor one.
-
- Posts: 678
- Joined: Mon Jan 16, 2006 8:53 pm
- Location: Rio de Janeiro - Brazil
Re: Ensuring a sound will play during PowerTimeFreezer
Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
-
- Posts: 22
- Joined: Wed Apr 28, 2021 1:18 am
- Location: Pantai Remis, Perak, Malaysia
Re: Ensuring a sound will play during PowerTimeFreezer
The +NOTIMEFREEZE flag won't play ALL sounds during "PowerTimeFreezer", as I tested in the latest GZDoom 4.6.0.Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
Only creating a new TimeFreezer powerup in ZScript and using/editing S_ResumeSound/S_PauseSound can play all sounds.
Code: Select all
class PowerFreezeMusic : PowerTimeFreezer
{
Default
{
Powerup.Duration -12; // 12 seconds
}
override void DoEffect()
{ // Overriding InitEffect doesn't work here.
Super.DoEffect();
S_ResumeSound(false);
S_PauseSound(false, true); // This will freeze music, but not sound effects.
}
}
-
- Posts: 74
- Joined: Mon Apr 19, 2021 12:58 pm
Re: Ensuring a sound will play during PowerTimeFreezer
Basically the first thing I'd tested was to see if the notimefreeze would at least allow specific actors to still play their sounds, sadly that didn't work. The overriding of timefreeze powerup seems to work fine though.Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
-
- Posts: 678
- Joined: Mon Jan 16, 2006 8:53 pm
- Location: Rio de Janeiro - Brazil
Re: Ensuring a sound will play during PowerTimeFreezer
Are you sure? This is exactly what i'm doing here and works fine for me. Well, i use 4.5 anyway. Lets see 4.6!Wally0222 wrote:The +NOTIMEFREEZE flag won't play ALL sounds during "PowerTimeFreezer", as I tested in the latest GZDoom 4.6.0.Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
Yeah! It does!

Code: Select all
ACTOR ShellsBelt : CustomInventory 3401
{
Inventory.PickupMessage "$NADA"
Inventory.PickupSound "GotAmmoItems"
FloatBobStrength 0.25
+FLOATBOB
+COUNTITEM
+NOTIMEFREEZE
States
{
Spawn:
NULL B 1 Bright
NULL B 70
Loop
Pickup:
NULL A 0 ACS_NamedExecute("ShellsBelt",0)
Stop
}
}
-
- Posts: 22
- Joined: Wed Apr 28, 2021 1:18 am
- Location: Pantai Remis, Perak, Malaysia
Re: Ensuring a sound will play during PowerTimeFreezer
It works fine for you? I am curiously if you played with any mods that replaces/related to PowerTimeFreezer, or you have modified gzdoom.pk3...Logan MTM wrote:Are you sure? This is exactly what i'm doing here and works fine for me. Well, i use 4.5 anyway. Lets see 4.6!
Yeah! It does!
Edit: Check the ACS named "ShellsBelt" first.
-
- Posts: 678
- Joined: Mon Jan 16, 2006 8:53 pm
- Location: Rio de Janeiro - Brazil
Re: Ensuring a sound will play during PowerTimeFreezer
That actor needs to play the pickupsound. The ACS Just make some hud events.
-
- Posts: 22
- Joined: Wed Apr 28, 2021 1:18 am
- Location: Pantai Remis, Perak, Malaysia
Re: Ensuring a sound will play during PowerTimeFreezer
I think the pickup sound can play normally during PowerTimeFreezer (both with and without NOTIMEFREEZE flag), but other sounds such as gunfire and monster attack sound still frozen.
Chaosvolt wrote:I was trying to figure out if there's any way to rig it so that projectiles and other actors with the NOTIMEFREEZE flag can play sounds during the effect of timefreezing powerups. DeathSound for example doesn't seem to add any special behavior, and fairly certain none of the flags in A_StartSound seem like they'd affect that.
And Chaosvolt already tried the NOTIMEFREEZE flag.Chaosvolt wrote:Basically the first thing I'd tested was to see if the notimefreeze would at least allow specific actors to still play their sounds, sadly that didn't work. The overriding of timefreeze powerup seems to work fine though.
-
- Posts: 386
- Joined: Thu Jun 11, 2015 8:38 am
Re: Ensuring a sound will play during PowerTimeFreezer
If I set S_PauseSound(true, true) in order to not pause music - I get a 1 tick pause of the music before it continues - a tiny stutter each time I freeze - can this be solved? is there an error in the code?Wally0222 wrote: ↑Sat May 29, 2021 9:58 amThe +NOTIMEFREEZE flag won't play ALL sounds during "PowerTimeFreezer", as I tested in the latest GZDoom 4.6.0.Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
Only creating a new TimeFreezer powerup in ZScript and using/editing S_ResumeSound/S_PauseSound can play all sounds.Code: Select all
class PowerFreezeMusic : PowerTimeFreezer { Default { Powerup.Duration -12; // 12 seconds } override void DoEffect() { // Overriding InitEffect doesn't work here. Super.DoEffect(); S_ResumeSound(false); S_PauseSound(false, true); // This will freeze music, but not sound effects. } }