GetTransmitterDistance - ObjectReference

From Creation Kit
Jump to: navigation, search

Member of: ObjectReference Script

Returns the distance between this radio transmitter and the player (Pipboy radio).


float Function GetTransmitterDistance() native



Return Value

  • The distance between this radio transmitter and the player.
  • FLT_MAX (an extremely large value) if the ref is not a transmitter, is disabled, is not currently filling a Quest Alias, is out-of-range, or is using a frequency not detectable by the Pipboy radio.
  • 0.0 if the ref is an active, unlimited-range transmitter.


; Find out how far away the player is from the transmitter ref.
Debug.Trace("Player is " + MyTransmitterRef.GetTransmitterDistance() + " units away from MyTransmitterRef.")


  • When called on a repeater, you get the distance to that specific repeater.
  • When called on a source transmitter with active repeaters, you get the range to the closest of those refs.

Some key differences between this function and GetDistance:

  • This function is only valid when run on active, limited-range radio transmitters on frequencies detectable by the Pipboy. Transmitter refs become active when they are both Enabled and filling a Quest Alias.
  • This function only returns a valid distance if the player is within the transmitter's outer radius (Max Weak Distance). OnPipboyRadioDetection can be used to determine when this is the case.
  • This function will 'go through teleport doors', returning the cumulative straight-line distance from the ref to the player based on a pathfinding search.
  • Distance to active transmitters is updated twice a second if no pathfinding search is required (ref & player in the same space), and once every 5 seconds otherwise.

See Also