This can be used with a minimum of effort e.g. for:
- radio messages to train driver;
- on board train announcements in passenger view;
- off-board station announcements;
- etc.
The fact that simply a .wav file (which will be played once) has to be entered allows activity builders to use this feature without needing to know the .sms language neither to place fake cars on the route to play these files.
The syntax of the entry in the event block is
ORTSActSoundFile ( "filename.wav" "SoundType" )
The position where filename.wav is supposed to be is in the SOUND folder of the route. filename.wav can include also relative paths to such folder.
SoundType can be:
- Everywhere : sound is played at equal volume in all camera views and without fading effects
- Cab : sound is played only within cab
- Pass : sound is played only in the active passenger view
- Ground : sound is played externally from a fixed position, that is the one the loco has reached when the event is triggered; the sound is heard also internally in an attenuated way, and becomes attenuated also by moving away from the position.
It is advisable to use this feature together with the
ORTSContinue ( seconds )
feature, explained elsewhere in the forum.
If seconds is > 0 the event won't cause the game to stop and the associated message, if any, will be shown for that amount of seconds.
If seconds is = 0 the event won't cause the game to stop and there will be no message shown. This can be used if one wants to have only the sound played, with no message shown.
An example of an event block using this feature can be seen here
EventCategoryLocation ( EventTypeLocation ( ) ID ( 7 ) Activation_Level ( 1 ) Outcomes ( DisplayMessage ( "This message won't be shown, because ORTSContinue is = 0." ) ) Name ( Location6 ) Location ( -146 14084 -283.424 -694.733 10 ) TriggerOnStop ( 0 ) ORTSContinue ( 0 ) ORTSActSoundFile ( "x_Next_stop_MiClei.wav" "Pass" ) )
As with ORTSContinue(), MSTS won't suffer because of this added line. Such added lines will be cleared by the MSTS AE if the activity file is edited by it, so it is advised to add them at the end of activity development, or to keep a backup copy where the lines are present.
If one opens with the MSTS AE an activity file with such lines and packages it without modifying the file, the AE will include such lines in the packaged file.
Only one sound file per event is allowed.