SteveOhByte 17 Posted January 26, 2023 Share Posted January 26, 2023 In GTA5 RagePluginHook we could use World.GetRandomPositionOnStreet(), and I was wondering if anyone new of a way to do this in RDR2. I thought about using native methods, such as the "GET_CLOSEST_ROAD" native, to cobble-together a solution, but I was met with a rage crash and the log file telling me that it attempts to read or write protected memory, and therefore throws an access violation. I'm trying to create a basic script to spawn someone in a carriage some distance away, and have them drive to the player. Currently I have them, the carriage, and the horses spawning correctly, they all hitch up and get in the driver's seat, but they continuously get spawned into a tree or rock or some such and are unable to follow through on the driver's task to "DriveToPosition" Has anyone tried to do something similar to this that could offer some insight? Quote Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain. Link to comment Share on other sites More sharing options...
LMS 673 Posted January 26, 2023 Share Posted January 26, 2023 Admittedly it has been a long time since I messed with RDR2 pathfinding natives, but from what I recall they were extremely limited in finding positions that were even just a little bit farther away from the player. Perhaps all nodes are streamed. That being said, the natives themselves do work: Vector3 outPos = Vector3.Zero; if (Game.CallNative<bool>("GET_CLOSEST_VEHICLE_NODE", position.X, position.Y, position.Z, &outPos, nodeType, 300f, 200f)) { foundPosition = outPos; return true; } Vector3 outPos = Vector3.Zero; int node = 0; if (Game.CallNative<bool>("GET_RANDOM_VEHICLE_NODE", position.X, position.Y, position.Z, radius, false, false, false, &outPos, &node)) { foundPosition = outPos; nodeId = node; return true; } Quote Link to comment Share on other sites More sharing options...
SteveOhByte 17 Posted January 27, 2023 Author Share Posted January 27, 2023 9 hours ago, LMS said: Admittedly it has been a long time since I messed with RDR2 pathfinding natives, but from what I recall they were extremely limited in finding positions that were even just a little bit farther away from the player. Perhaps all nodes are streamed. That being said, the natives themselves do work: Vector3 outPos = Vector3.Zero; if (Game.CallNative<bool>("GET_CLOSEST_VEHICLE_NODE", position.X, position.Y, position.Z, &outPos, nodeType, 300f, 200f)) { foundPosition = outPos; return true; } Vector3 outPos = Vector3.Zero; int node = 0; if (Game.CallNative<bool>("GET_RANDOM_VEHICLE_NODE", position.X, position.Y, position.Z, radius, false, false, false, &outPos, &node)) { foundPosition = outPos; nodeId = node; return true; } Thanks for the help, yeah the more I play around with these and other natives the more I realise how much work is going to be involved in creating a system to get a proper point, especially since there are mountain paths that are sometimes considered nodes to look out for. Thanks again though. Quote Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.