• Getting the name of a NavMesh place?
    3 replies, posted
Hello Facepunch, So recently I've been doing bot coding and would like to add a nice feature. I want to help my bots discover patterns that players have, based on sections of a map they go to. For example, in cs_office, these are the named sections. [IMG]http://i.imgur.com/qbCWsgl.png[/IMG] I have looked through the global NavMesh class, and can't find anything for returning the named navareas, or finding a navarea based on name. Can someone help me get the "friendly" name of a CNavArea, and vice versa. Thanks!
No, no and no. You wouldn't be able to get "a navarea based on name", since multiple navareas can have the same place name. You can't get the "friendly" name of a CNavArea, GMod does not have bindings for NavArea Places because they must be predefined ( i.e. You can't dynamically add new ones ) and they are "not dynamic across games", meaning every source game has its own set of navarea place names and combining them into a huge list will not work because in the .nav files they are stored by their ID in a definition file, not by the name, thus you can only have CS:S nav places, or only DOD:S nav places on all of your maps with existing original .nav files. [editline]7th June 2016[/editline] For your purpose you can use GetID() of each nav area.
[QUOTE=Robotboy655;50467990]No, no and no. You wouldn't be able to get "a navarea based on name", since multiple navareas can have the same place name. You can't get the "friendly" name of a CNavArea, GMod does not have bindings for NavArea Places because they must be predefined ( i.e. You can't dynamically add new ones ) and they are "not dynamic across games", meaning every source game has its own set of navarea place names and combining them into a huge list will not work because in the .nav files they are stored by their ID in a definition file, not by the name, thus you can only have CS:S nav places, or only DOD:S nav places on all of your maps with existing original .nav files. [editline]7th June 2016[/editline] For your purpose you can use GetID() of each nav area.[/QUOTE] Thanks. That'll work. Also, since you work on GMOD updates or something like that. Can you please please [U][B]please[/B][/U] implement the much needed direct access to the NavMesh, PathFollower, and other Nextbot related items so that non-Nextbots can use them. For example, my Murder bots are using a hacky fix which involves an invisible nextbot and reading the data from it. It is messy and occasionally breaks. It would be awesome to have [url]http://wiki.garrysmod.com/page/player/CreateNextBot[/url] actually implement NextBot functions and the like, instead of having to use StartCommand. Thanks. -Tom
[QUOTE=BlueMustache;50468240]Thanks. That'll work. Also, since you work on GMOD updates or something like that. Can you please please [U][B]please[/B][/U] implement the much needed direct access to the NavMesh, PathFollower, and other Nextbot related items so that non-Nextbots can use them. For example, my Murder bots are using a hacky fix which involves an invisible nextbot and reading the data from it. It is messy and occasionally breaks. It would be awesome to have [url]http://wiki.garrysmod.com/page/player/CreateNextBot[/url] actually implement NextBot functions and the like, instead of having to use StartCommand. Thanks. -Tom[/QUOTE] I second this! Using a similar hacky workaround to get the goal path of the pathfinder by having a single global nextbot entity used to generate them. Also there should be a way to limit how close to the edges of a mesh area the bot will get to (no adjacent meshes on that side), and ways to outright ignore certain mesh areas by ID.
Sorry, you need to Log In to post a reply to this thread.