Ensuring a sound will play during PowerTimeFreezer

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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.

Ensuring a sound will play during PowerTimeFreezer

Postby Chaosvolt » Fri May 21, 2021 6:06 am

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.
User avatar
Chaosvolt
 
Joined: 19 Apr 2021

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Jarewill » Fri May 21, 2021 8:59 am

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.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Chaosvolt » Fri May 21, 2021 7:41 pm

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.


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.

EDIT: Just tested and that does the job just perfectly. Thanks!

EDIT 2: One oddity however, pausing the game breaks that entirely.
User avatar
Chaosvolt
 
Joined: 19 Apr 2021

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Wally0222 » Sat May 22, 2021 9:21 am

Chaosvolt wrote:EDIT 2: One oddity however, pausing the game breaks that entirely.
I think something has been omitted, so I simply copy the code from gzdoom.pk3 like this.
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.
User avatar
Wally0222
 
Joined: 28 Apr 2021
Location: Pantai Remis, Perak, Malaysia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Chaosvolt » Sat May 22, 2021 11:09 am

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.
User avatar
Chaosvolt
 
Joined: 19 Apr 2021

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Logan MTM » Sat May 29, 2021 8:10 am

Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
User avatar
Logan MTM
I can see you...
 
Joined: 16 Jan 2006
Location: Rio de Janeiro - Brazil

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Wally0222 » Sat May 29, 2021 9:58 am

Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
The +NOTIMEFREEZE flag won't play ALL sounds during "PowerTimeFreezer", as I tested in the latest GZDoom 4.6.0.
Only creating a new TimeFreezer powerup in ZScript and using/editing S_ResumeSound/S_PauseSound can play all sounds.
Code: Select allExpand view
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.
   }
}
User avatar
Wally0222
 
Joined: 28 Apr 2021
Location: Pantai Remis, Perak, Malaysia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Chaosvolt » Sat May 29, 2021 10:18 am

Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound


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.
User avatar
Chaosvolt
 
Joined: 19 Apr 2021

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Logan MTM » Sat May 29, 2021 6:15 pm

Wally0222 wrote:
Logan MTM wrote:Just make a New actor with +Notimefreeze flag and use It to play ALL your sound
The +NOTIMEFREEZE flag won't play ALL sounds during "PowerTimeFreezer", as I tested in the latest GZDoom 4.6.0.

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! :D

Code: Select allExpand view
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
 }
}
User avatar
Logan MTM
I can see you...
 
Joined: 16 Jan 2006
Location: Rio de Janeiro - Brazil

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Wally0222 » Sat May 29, 2021 9:46 pm

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! :D

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...

Edit: Check the ACS named "ShellsBelt" first.
User avatar
Wally0222
 
Joined: 28 Apr 2021
Location: Pantai Remis, Perak, Malaysia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Logan MTM » Sun May 30, 2021 4:29 pm

That actor needs to play the pickupsound. The ACS Just make some hud events.
User avatar
Logan MTM
I can see you...
 
Joined: 16 Jan 2006
Location: Rio de Janeiro - Brazil

Re: Ensuring a sound will play during PowerTimeFreezer

Postby Wally0222 » Sun May 30, 2021 9:09 pm

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.
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.


And Chaosvolt already tried the NOTIMEFREEZE flag.
User avatar
Wally0222
 
Joined: 28 Apr 2021
Location: Pantai Remis, Perak, Malaysia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests