Difference between revisions of "Distance"

From FreeSpace Wiki
Jump to: navigation, search
(update and clarify)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
  Distance (Status operator)
 
  Distance (Status operator)
         Returns the distance between two objects.  These objects can be either a ship, a wing, or a waypoint.
+
         Returns the distance between two objects.  These can be ships, wings, or waypoints.  When a wing or team is given (for either argument), the result will be the closest distance.
 +
 +
NOTE: The standard retail SEXP measures between the center of one ship and the bounding box of another.  It is recommended to use center-distance or bbox-distance.
 +
 
  Returns a numeric value.  Takes 2 arguments...
 
  Returns a numeric value.  Takes 2 arguments...
 
         1:    The name of one of the objects.
 
         1:    The name of one of the objects.
Line 6: Line 9:
  
 
==Comments==
 
==Comments==
Commonly used to determine if a ship is close enough to a node to warp out.
+
Commonly used to determine if a ship is close enough to a node to warp out, but it should also be widely used in the departure cue of ships that are supposed to jump at the end of a waypoint path. Using [[are-waypoints-done-delay]] may not work because ships oftentimes miss the waypoint and turn around it in a futile attempt to catch it. Using a distance check would not only prevent this, but would also give a more realistic warpout effect because the ship will not slow down to 0 before departing.
 +
 
 +
In FreeSpace Open, this SEXP is no longer displayed in FRED, as it has been replaced with [[distance-to-center]] and [[distance-to-bbox]]. However, missions with the classic distance SEXP will continue to work as before.
 +
 
 
[[Category:Retail SEXPs]]
 
[[Category:Retail SEXPs]]

Latest revision as of 02:00, 21 March 2021

Distance (Status operator)
        Returns the distance between two objects.  These can be ships, wings, or waypoints.  When a wing or team is given (for either argument), the result will be the closest distance.

NOTE: The standard retail SEXP measures between the center of one ship and the bounding box of another.  It is recommended to use center-distance or bbox-distance.

Returns a numeric value.  Takes 2 arguments...
        1:     The name of one of the objects.
        2:     The name of the other object.

Comments

Commonly used to determine if a ship is close enough to a node to warp out, but it should also be widely used in the departure cue of ships that are supposed to jump at the end of a waypoint path. Using are-waypoints-done-delay may not work because ships oftentimes miss the waypoint and turn around it in a futile attempt to catch it. Using a distance check would not only prevent this, but would also give a more realistic warpout effect because the ship will not slow down to 0 before departing.

In FreeSpace Open, this SEXP is no longer displayed in FRED, as it has been replaced with distance-to-center and distance-to-bbox. However, missions with the classic distance SEXP will continue to work as before.