SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Plugin Development (https://forum.sa-mp.com/forumdisplay.php?f=18)
-   -   [Plugin] NODES*.dat's path width and flags (https://forum.sa-mp.com/showthread.php?t=667689)

FR0DG3R 02/07/2019 11:31 PM

NODES*.dat's path width and flags
 
So, my work involves making cars follow paths made by NODES*.dat nodes. The community nodes documentation on the grandtheftwiki says that every node has a property called "Path Width" that is 0 by default (?) and can be changed, is it made for us to change manually change each node? Has someone ever done that?
I need a way of obtaining the width value for the nodes because I really want to adapt the code for working with many car models and street widths.

I also have a problem with some navi node flags I'd like to use (e. g. traffic light behavior, left/right lanes), they are always 0, but the wiki says it should really give a value. I don't think I'm reading it wrong because most data comes just as expected, I have proper coords and target nodes from the navi nodes, and the binary reading works on path nodes' flags.


This is the way I read a NaviNode (C++)

I declare the struct, according to the wiki:
Code:

struct NaviNode {
    short pos[2];
    unsigned short areaId, nodeId;
    char direction[2];
    unsigned flags;
};

And read it on the file:
Code:

NaviNode naviNode;

for(unsigned i = 0; i < header.naviNodes; i++) {
    fread(&naviNode, 14, 1, inputFile);// following the wiki it uses 14 bytes
  //store it
}

note: wiki page I mention is https://www.grandtheftwiki.com/Paths_(GTA_SA)

FR0DG3R 18/08/2019 08:10 PM

Re: NODES*.dat's path width and flags
 
In case someone ends up here looking for a way to get number of lanes on the streets:

Download Aschratts Path Editor and, after decompiling the NODES*.dat to a .dnf file, you can read this file just like plain text, it contains everything that the original game files has about the nodes.

I had a problem where the reading of navi node flags were always the same (maybe it was just a mistake by me and no one will ever have this problem, anyway), about the Paths Width, tough, I didn't find out if there's a way of getting it.

n0minal 21/08/2019 03:12 AM

Re: NODES*.dat's path width and flags
 
Why don't you use a simple pathfinder like Gamerz's one? It's easier (if you're not willing to create your own pathfinder though, if that's the case and it's for study, ignore this comment).


All times are GMT. The time now is 09:09 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.