function TransmissionFromUnitTypeWithNameBJ takes force toForce, player fromPlayer, integer unitId, string unitName, location loc, sound soundHandle, string message, integer timeType, real timeVal, boolean wait returns nothing
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
// Use only local code (no net traffic) within this block to avoid desyncs.
call DoTransmissionBasicsXYBJ(unitId, GetPlayerColor(fromPlayer), GetLocationX(loc), GetLocationY(loc), soundHandle, unitName, message, bj_lastTransmissionDuration)
endif
if wait and (bj_lastTransmissionDuration > 0) then
// call TriggerSleepAction(bj_lastTransmissionDuration)
call WaitTransmissionDuration(soundHandle, timeType, timeVal)
endif
endfunction