Jump to content

How to play an audio/translator file once only?


Recommended Posts

Hopefully a simple question here.

 

How do I disable an audio file (through Command Sound/Translator Animation Operator) once it's been played out to the player and NOT have it active again throughout the mission?

Basically I've set my audio file up as per picture, using a simple Trigger Check Zone with all plane and vehicle coalitions set to 'F' and having the C/Z object-linked to the Player so as not to repeat any time another allied aircraft or vehicle triggers the C/Z area. This works well but once played, I don't want it being replayed if the Player enters that C/Z again. (The example I've used is on the runway on Take Off and as it stands, it plays again obviously when the player lands).

 

The same question is applied to Translator Subtitles. I have a C/Z that spawns 2 enemy aircraft with an audio file being played at the same time an Translator Subtitle is telling the player of 'BRA' (bearing, range, altitude etc). Again the audio and subtitle files are set up as per picture attached. With the fight taking place, the subtitle shows again if the player leaves and re enters the zone even though the enemy planes have been vanquished.

 

I thought it that was the role of the 'Trigger Deactivate' MCU' but I can't get any joy as I've set a timer from the C/Z which is the length of the audio file being played and then linked to a Deactivate MCU but this is obviously not the right method as the file will replay (and subtitle show) if the player re enters the C/Z at a later time.

 

Hopefully it's a more simple answer than my attempt at explaining my question 🤣  

audio_example.jpg

Link to post
Share on other sites

There's no need for the sound timer. You can use the OnSoundStopped event message from the animation operator to trigger the deactivate trigger. Then, object link the deactivate trigger back to the animation operator.

 

CZ  ----> Play ----> Animation Operator -----> <------ Deactivate Trigger

                                                                    ML      OL

  • Like 1
Link to post
Share on other sites
34 minutes ago, JimTM said:

CZ  ----> Play ----> Animation Operator -----> <------ Deactivate Trigger

                                                                    ML      OL

 

trigger-animate.gif.5d026ce8991129890cce77850f0df171.gif

 

This is a visual of what @JimTM was saying. (Plus I'm having fun with these gifs.)

  • Thanks 1
Link to post
Share on other sites

Unfortunately on testing the mission this evening, the takeoff audio on the runway) is indeed playing once again when the player returns back over the same spot for landing. I set up the trigger deactivation o/linked to the animator and m/linked the animation operator to the deactivation trigger.

 

Maybe I'm not understanding the logic of a trigger deactivation properly. My hopes were that, once activated, it deactivates the animation operator and therefore the sound file would not be played again even when the player flies through the check zone area at a later point in the mission.

 

Is there a way that I can disable media files after they are initially played, and keep them disabled even if the player flies through the original check zone?

 

 

 

 

 

Audio to Player Only.jpg

Edited by GSHWK_Houndstone_Hawk
Link to post
Share on other sites

It's firing a second time, because the Checkzone is seeing a plane enter it's sphere of influence. The Checkzone is constantly checking.... "Is there a plane? How about now? No? How about now? OOoohh, I found a plane!! Send a pulse to all the things I have target linked!" It doesn't care if it happened before or not; once the Checkzone sees a plane, then it sends a pulse to anything you have target linked. So how do we fix this? There are a few ways, but basically we want to disable something, so we'll need to use a Deactivate MCU.

You can stop the Checkzone MCU by deactivating it after the sound plays, the same way you're disabling the Translator Animation Operator, by adding a target link from your Deactivate MCU to the Checkzone. Deactivating a Checkzone can also help with performance because it's constantly active. It's not much performance gained, but when you have 30+ checkzones it adds up.

 

image.png.98429dea06e8f1af3d604ced1a423414.png

Add a target link from your deactivate to the checkzone.

 

Maybe you want to disable the Checkzone right away. In this case, maybe you have lots of logic (other than the sound playing) that you only want to happen once. If you connect a Deactivate MCU to the Checkzone, the Checkzone will allow all the logic to pulse and then immediately disable itself.

 

image.thumb.png.84ff1a905b2c0af7c99f35b5c868338a.png

Here I'm disabling the Checkzone as soon as the Checkzone pulses.

 

Maybe you want the Checkzone to keep checking for planes but you don't want the sound to fire anymore. Well you can put a Timer MCU in front of your logic, and disable that Timer. If the Timer is disabled, no pulses will pass the timer. You'll find that many of us mission designers use this method pretty exclusively.

 

image.thumb.png.58d9dd936dc4b3860a17b9d403d4054b.png

Here, the Checkzone will keep checking for planes and the other logic section will process. However, no MCU passed the Timer MCU will execute (after the sound plays the first time) because the Timer is disabled.

 

Finally, an real world example of disabling MCUs so that MCUs after it will not pulse. In the image below, I have a simple (at least in my eyes) OnDamaged random subtitle message system. The first Gate is where all the entities onDamaged comes into. If any of the entities gets damaged, this timer will immediately disable itself and after three minutes will be reenabled. The next gate, called "destroyed gate" will disable if enough of the objects are destroyed. So, even if an entity gets damaged, if this destroyed gate is disabled, the players won't get a "Hey we need help because we got damaged!" message. Finally, JimTM's randomizer. Once the pulse hits the 'In:0ms' timer, it also get immediately disabled. Once the randomizer makes a selection (from the four choices), the 'In:0ms' gets reenabled. In summary, in order for players to get notified that their objective is getting damaged, the OnDamaged pulsing has to go through three gates; a 'Have we heard the cry for help within 3 minutes?' gate, a 'Is this objective already destroyed?' gate, and a 'Have we chosen a random message yet?' gate. The gates (and what you're trying to accomplish) are just Boolean values that you're checking. In your case, it's 'Did the sound already play? Then never play it again!'

 

image.thumb.png.05d388d78121be1e9a75e5c881a8e59c.png

A real example of using timers as gates to allow or not allow pulsing of MCUs passed the gate.

 

 

Hopefully this wasn't to wordy and was helpful to you. Good luck!

  • Thanks 1
  • Upvote 1
Link to post
Share on other sites

This is brilliant. Thankyou. My CZ is set up with all plane & vehicle coalitions set to 'F' because I've object-linked the CZ to the player but yes of course the CZ is still actively searching isn't it. I maybe thought that it was ok if it was searching beyond the initial play because I'd 'deactivated' the media and so there was nothing it could play but not so the case. I'll study your informative reply tomorrow. Thank you so much again!

  • Upvote 1
Link to post
Share on other sites

Re. my suggestion, it appears that OnSoundStopped is not being generated when the audio track finishes. I'm not sure yet if this is a bug or if my original understanding of the behaviour was wrong.

Link to post
Share on other sites

Disregard.

 

 

I think it's working as intended (though I didn't test it). Now that I'm looking more closely at OP's image, he's missing the object link from the Deactivate to Animation Operator. This is what you originally recommended, and I thought he had that connection already. 

 

Edited by Sketch
Link to post
Share on other sites
8 minutes ago, Sketch said:

I think it's working as intended (though I didn't test it). Now that I'm looking more closely at OP's image, he's missing the object link from the Deactivate to Animation Operator. This is what you originally recommended, and I thought he had that connection already. 

...

Missing the object link from this deactivation MCU to the Animation Operator MCU.

 

He has the link. You can just barely make out the green arrow.

 

I tested OnSoundStopped using the setup in my suggestion (with a subtitle for debugging) and it is not generated.

Edited by JimTM
Link to post
Share on other sites
2 hours ago, GSHWK_Houndstone_Hawk said:

I've re-uploaded the mission file and as Sketch had pointed out, I needed to 'deactivate' the CZ as well and this seems to work. Thank you both so much for your invaluable help. 

 

Mission: https://www.dropbox.com/s/3tdud73fr45n3bo/Hurricanes_and_Skytrains.rar?dl=0

 

The Dropbox is empty. Did you get OnSoundStopped to trigger the deactivate MCU then?

Link to post
Share on other sites
10 hours ago, GSHWK_Houndstone_Hawk said:

Apologies JimTM. I reuploaded it. This link 'should' be working

 

https://www.dropbox.com/s/09eu91wdrz9jsvc/Hurricanes_%26_Skytrains.rar?dl=0

 

It seems to work now. I added a two-way target link between the CZ & Deactivate as well. 

 

 

I notice that you created a target link from the animation operator to the the deactivate trigger. In this case, I don't think the target link does anything (I tested the target link with a subtitle and got no response).

 

If you want to keep the CZ detecting for other reasons but still shut down the animation operator, here's some logic:

 

CZ  ----->  Timer: 0 seconds  ----->  Play  ----->  Animation Operator

                     |

                     |

                     ---------->  <---------  Deactivate

 

 

Edited by JimTM
  • Upvote 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...