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.
Activating a tape-recorder (with animation)
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!)
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Activating a tape-recorder (with animation)
You could make your tape recorder inherit from SwitchableDecoration which will switch to an Active state with an animation.
For example:
For more info check this wiki page.
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
}
}
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Activating a tape-recorder (with animation)
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)
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.
If you want to change a line's texture, you will have to use SetLineTexture in your script.
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Activating a tape-recorder (with animation)
Ah okay, thanks for clearing it up.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.
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
}
}
Thanks in advance.
Re: Activating a tape-recorder (with animation)
Changing the activation property to THINGSPEC_Switch and adding an Inactive state should do the job:
However this will let the player stop the recording halfway, so adding the StopSound might be useful.
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
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Activating a tape-recorder (with animation)
This is perfect, thank you again Jarewill for your constant help.