function PlayDialogueFromSpeakerTypeEx takes force toForce, player fromPlayer, integer speakerType, location loc, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean
call TryInitCinematicBehaviorBJ()
// Ensure that the time value is non-negative.
set timeVal = RMaxBJ(timeVal, 0)
set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal)
set bj_lastPlayedSound = soundHandle
if (IsPlayerInForce(GetLocalPlayer(), toForce)) then
call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(fromPlayer), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration)
if(speakerType != 0) then
call PingMinimap(GetLocationX(loc), GetLocationY(loc), bj_TRANSMISSION_PING_TIME)
endif
endif
if wait and (bj_lastTransmissionDuration > 0) then
// call TriggerSleepAction(bj_lastTransmissionDuration)
call WaitTransmissionDuration(soundHandle, timeType, timeVal)
endif
return true
endfunction