X0 i0 position

 Warning: This function has a known bug and may not work as expected in some situations. See Known Bugs for details.

x0_i0_position

Library file for functions that can be used to determine locations and positions.

Constants

Name Value Brief Description
DISTANCE_HUGE 20.0 Distance used for determining positions.
DISTANCE_LARGE 10.0 Distance used for determining positions.
DISTANCE_MEDIUM 5.0 Distance used for determining positions.
DISTANCE_SHORT 3.0 Distance used for determining positions.
DISTANCE_TINY 1.0 Distance used for determining positions.

Functions

Name Brief Description
GenerateNewLocation Internal function. Used to get the new location.
Internal function. Creates a new location from a given location.
GetAheadLeftLocation Returns location to the forward left and facing the target. This is useful for one of two people facing off against the target.
This function returns a location directly in front of the target.
GetAheadRightLocation Returns location to the forward right and facing the target. This is useful for one of two people facing off against the target.
Returns a float representing the angle between Location One and Location Two.
Returns location directly behind the target and facing same direction as the target.
GetCenterPointOfArea Internal function. Get the (roughly) center point of an area.

This works by going through all the objects in an area and getting their positions, so it is resource-intensive.
Convenience function that returns a vector that is fDistance away in fAngle direction.
Convenience function to calculate the change in the X axis.
Convinence function to calculate the change in the Y axis.
This function returns a normalized number that is the sum of the current facing and the angle to target.
This returns a float that is a normalized remainder of fDirection - fAngle.
This function returns a normalized number that is +135 from the current facing.
Returns a normalized number that is -135 from the current facing.
Returns a location on the left flank of the target.
Returns a location that is the right flank (to the right and slightly behind) the Target.
Returns location to the forward left flank of the target.
Returns location to the forward right flank of the target.
This function returns a number that is +45 degrees from the current facing.
Returns a normalized value that is -45 from fDirection.
This function returns a float representing a direction +90 degrees.
Internal function. This function returns a float that is constrained from 0 - 360.
Returns a normalized direction that is -180 from fDirection.
Returns a location that is directly behind the target.
Returns a normalized float that is -90 from the facing passed in.
GetStepLeftLocation Returns location just a step to the left.
GetStepRightLocation Returns location just a step to the right.
GetRandomLocation
location GetRandomLocation(object oArea, object oSource=OBJECT_INVALID, float fDist=0.0);

Get a random location in a given area based on a given object, the specified distance away.

If no object is given, will use a random object in the area.

If that is not available, will use the roughly-center point of the area.

If distance is set to 0.0, a random distance will be used.

Turn a location into a string.
Tells the object to move to a new location.
Internal function. Prints a location to the logfile.
Internal function. Make the caller of the function speak a string representation of its current location.
Turns the target object to face another object.
Turn a vector into a string.

Known Bugs

`GetRandomLocation` returns a location that is 0 to 179 degrees `Random(140) + 40` from point instead of a full 360.

author: Charles Feduke, editor: Mistress