So a specific new sound event is proposed: event #161, called AITrain, that can be used in discrete triggers within the .sms file. It is triggered only for the first car of the AITrain, in case it is a locomotive (that is it has an .eng file)
A stream like this, to be inserted in the loco external .sms file causes the AI loco to play the horn (only once) when passing near the camera:
Stream ( Skip (**** ORTS AI: horn at train meet ***************************************) Priority ( 7 ) Triggers ( 4 Initial_Trigger ( DisableTrigger ( 3 ) ) Discrete_Trigger ( 161 EnableTrigger ( 3 ) ) Variable_Trigger ( Distance_Dec_Past 70.0 PlayOneShot ( 1 File ( "x_trcentro_loud_long.wav" -1 ) SelectionMethod ( RandomSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 35.0 DisableTrigger ( 3 )) ) VolumeCurve( SpeedControlled CurvePoints ( 5 -100.0 1.0 -2.0 1.0 0 0.0 2.0 1.0 100.0 1.0 ) Granularity ( 0.1 ) ) )
A stream like this causes the AI loco playing the horn at start
Stream ( Skip (**** ORTS AI: horn at train start ***************************************) Priority ( 7 ) Triggers ( 3 Initial_Trigger ( DisableTrigger ( 3 ) ) Discrete_Trigger ( 161 EnableTrigger ( 3 ) ) Variable_Trigger ( Speed_Inc_Past 0.15 PlayOneShot ( 1 File ( "x_trcentro_loud.wav" -1 ) SelectionMethod ( RandomSelection ) ) ) ) )
Remember to increase the stream number (Streams(..))when adding streams in an .sms file.
Here are the .exe and .dll files to be replaced within release x.3794
AITrainSound.zip (1020.9K)
Number of downloads: 805
Blueprint registered https://blueprints.l...s-for-ai-trains .