Page 1 of 1
Activating a tape-recorder (with animation)
Posted: Sun May 23, 2021 12:50 pm
by Hidden Hands
This is a strange one, but in my game there is an audio-log that can be played on a reel-to-reel tape-recorder. The taperecorder is not animated at first. Here's what I want to happen. Clicking on it (I would assume by running an ACS script to activate the front linedef of the recorder) playes the audio file (which I can do with AmbientSound) but how would I make the tape start spinning on the texture too? I want it to only spin as long as the audio plays then return to being static again.
Thanks in advance for any tips you can share.
Re: Activating a tape-recorder (with animation)
Posted: Sun May 23, 2021 1:16 pm
by Jarewill
You could make your tape recorder inherit from
SwitchableDecoration which will switch to an Active state with an animation.
For example:
Code: Select all
Actor TapeRecorder : SwitchableDecoration
{
Activation THINGSPEC_Activate //Activate the decoration
+USESPECIAL //When it's used
States
{
Spawn:
TAPE A 10
Loop
Active:
TAPE A 0 A_StartSound("tape/entry1") //Play the tape when activated
TAPE BCBCBCBCBC 18 //Set it to the duration of the tape
Goto Spawn
}
}
For more info check
this wiki page.
Re: Activating a tape-recorder (with animation)
Posted: Mon May 24, 2021 7:07 am
by Hidden Hands
Would this work with a sector object too ? So let's just say I build a sector and texture it to look like a tape recorder, can I do this to make the texture animate and play the sound too?
Re: Activating a tape-recorder (with animation)
Posted: Mon May 24, 2021 7:11 am
by Jarewill
No, a switchable decoration can only be an actor.
If you want to change a line's texture, you will have to use
SetLineTexture in your script.
Re: Activating a tape-recorder (with animation)
Posted: Mon May 24, 2021 11:14 am
by Hidden Hands
Jarewill wrote:No, a switchable decoration can only be an actor.
If you want to change a line's texture, you will have to use
SetLineTexture in your script.
Ah okay, thanks for clearing it up.
Okay so this is my code, heavily based for the most part on your example, and it works great.
Code: Select all
Actor Dictophone : SwitchableDecoration 8423
{
//$Category Interactive
//$Title Dictophone
//$Sprite DICKA0
Scale 0.3
Activation THINGSPEC_Activate //Activate the decoration
+USESPECIAL //When it's used
States
{
Spawn:
DICK A 10
Loop
Active:
DICK A 0 A_PlaySound("JackKessler/Audio") //Play the tape when activated
DICK BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC 18 //Set it to the duration of the tape
Goto Spawn
}
}
But I do have one last quesstion. How can I make it a repeatable action? After it plays the audio log, it becomes completely inactive. Is there a good way to make it repeatable? So when its completed, you can activate it again?
Thanks in advance.
Re: Activating a tape-recorder (with animation)
Posted: Mon May 24, 2021 11:39 am
by Jarewill
Changing the activation property to THINGSPEC_Switch and adding an Inactive state should do the job:
Code: Select all
Activation THINGSPEC_Switch //Activate the decoration
+USESPECIAL //When it's used
States
{
Inactive: //Make the Inactive state the same as the Spawn state
Spawn:
DICK A 10 A_StopSound(CHAN_BODY) //Optional: Also make the sound stop
Loop
However this will let the player stop the recording halfway, so adding the StopSound might be useful.
Re: Activating a tape-recorder (with animation)
Posted: Mon May 24, 2021 12:37 pm
by Hidden Hands
This is perfect, thank you again Jarewill for your constant help.