Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating node documentation #762

Merged
merged 16 commits into from
Aug 15, 2024
Merged
19 changes: 10 additions & 9 deletions PATHFIND/GetClosestRoad.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ns: PATHFIND

```c
// 0x132F52BBA570FE92 0x567B0E11
Any GET_CLOSEST_ROAD(float x, float y, float z, float p3, int p4, Vector3* p5, Vector3* p6, Any* p7, Any* p8, float* p9, BOOL p10);
int GET_CLOSEST_ROAD(float x, float y, float z, float p3, int n, Vector3* srcNode, Vector3* destNode, int* forwardLanes, int* backwardLanes, float* width, BOOL onlyMajorRoads);
lfshr marked this conversation as resolved.
Show resolved Hide resolved
```

```
Expand All @@ -16,13 +16,14 @@ p1 seems to be always 1.0f in the scripts
* **x**:
* **y**:
* **z**:
* **p3**:
* **p4**:
* **p5**:
* **p6**:
* **p7**:
* **p8**:
* **p9**:
* **p10**:
* **p3**: Some sort of filter. 0x20 returns closest shortcut link. Needs more research.
* **n**: n edge. A bit broken as it returns a random edge after `n` has gone above edge count, but method still returns 1. Always 1 in Rockstar scripts.
* **srcNode**: Position of the edge source
* **destNode**: Position of the edge target
* **forwardLanes**: Lane count forward
* **backwardLanes**: Lane count backwards
* **width**: Width of gap in middle of road between forward and backward directions
* **onlyMajorRoads**: Return major nodes only

## Return value
Usually always 1 even on failure.
16 changes: 12 additions & 4 deletions PATHFIND/GetNthClosestVehicleNodeWithHeading.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ ns: PATHFIND

```c
// 0x80CA6A8B6C094CC4 0x7349C856
BOOL GET_NTH_CLOSEST_VEHICLE_NODE_WITH_HEADING(float x, float y, float z, int nthClosest, Vector3* outPosition, float* heading, Any* unknown1, int unknown2, float unknown3, float unknown4);
BOOL GET_NTH_CLOSEST_VEHICLE_NODE_WITH_HEADING(float x, float y, float z, int nthClosest, Vector3* outPosition, float* heading, int* totalLanes, int nodeType, float unknown3, float unknown4);
```

```
Get the nth closest vehicle node and its heading. (unknown2 = 9, unknown3 = 3.0, unknown4 = 2.5)
Get the nth closest vehicle node with its heading and total lane count. (unknown3 = 3.0, unknown4 = 2.5)

Known node types: simple path/asphalt road, only asphalt road, water, under the map at always the same coords.
The node types follows a pattern. For example, every fourth node is of the type water i.e. 3, 7, 11, 15, 19, 23, 27, 31, 35, 39... 239. Could not see any difference between nodes within certain types.
lfshr marked this conversation as resolved.
Show resolved Hide resolved
Starting at 2, every fourth node is under the map, always same coords.
Same with only asphalt road (0, 4, 8, etc) and simple path/asphalt road (1, 5, 9, etc).
gtaforums.com/topic/843561-pathfind-node-types
lfshr marked this conversation as resolved.
Show resolved Hide resolved

If you need specific foward and backward lane counts use `GET_CLOSEST_ROAD`
lfshr marked this conversation as resolved.
Show resolved Hide resolved
```

## Parameters
Expand All @@ -19,8 +27,8 @@ Get the nth closest vehicle node and its heading. (unknown2 = 9, unknown3 = 3.0,
* **nthClosest**:
* **outPosition**:
* **heading**:
* **unknown1**:
* **unknown2**:
* **totalLanes**:
* **nodeType**:
* **unknown3**:
* **unknown4**:

Expand Down
17 changes: 16 additions & 1 deletion PATHFIND/GetVehicleNodeProperties.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,22 @@ BOOL GET_VEHICLE_NODE_PROPERTIES(float x, float y, float z, int* density, int* f
```
Gets the density and flags of the closest node to the specified position.
Density is a value between 0 and 15, indicating how busy the road is.
AvarianKnight marked this conversation as resolved.
Show resolved Hide resolved
Flags is a bit field.

Flags is a bit field:
public enum PathNodeFlags
{
Offroad = 0x1,
WanderTarget = 0x2,
NoBigVehicles = 0x4,
Disabled = 0x8,
Tunnel = 0x10,
lfshr marked this conversation as resolved.
Show resolved Hide resolved
DisabledUnk = 0x20,
Highway = 0x40,
Junction = 0x80,
TrafficLightStop = 0x100,
Stop = 0x200,
Unk1 = 0x400
}
```

## Parameters
Expand Down