YouDoNotKnowMyName Posted October 19, 2020 Posted October 19, 2020 Good afternoon everybody! I know that you can select certain triangles in the navmesh and make them "preferred pathing", so that NPCs will use those instead of just a "striaght line" to where they want to go. But is it possible to have conditions for that "preferred pathing"? Like for example have only certain NPCs access an area and others not.Or if a certain quest stage is reached, have a different "group" of triangles in the navmesh getting set as the "preferred pathing" ... I mean every navmesh triangle has its own "ID" so maybe a script could "interact with them" in the described way ... ? Because as far as I understand it, Navmesh gets used to tell NPCs "this is a 'walkable surface'".So everything that NPCs should be able to walk on should get navmesh'ed.But how would you make a "non-enclosed area" (so not an interior cell) only be acessible to certain NPCs?
niston Posted October 19, 2020 Posted October 19, 2020 Navmesh is not accessible by script.You could perhaps make a triggerbox and teleport "unallowed" NPCs somewhere else (to the Settlement Spawn or Center marker).
DieFeM Posted October 19, 2020 Posted October 19, 2020 (edited) The only tool I know for "disabling" a certain part of the navmesh is a navcut. A navcut is a trigger or a collision cube (maybe others) in which L_NAVCUT is set as collision layer in its properties (primitive tab). PS: Note that you can enable/disable triggers and collision boxes with scripts. Edited October 19, 2020 by DieFeM
YouDoNotKnowMyName Posted October 19, 2020 Author Posted October 19, 2020 Ok, so, I could make a triggerbox that, on entry, checks if an NPC is "allowed to go further" (by checking for a keyword, faction or whatever) and if the NPC "shall not pass", enables a NavCut-thing that will "block the way". Right? (This could get messy when two or more NPCs walk into the triggerbox at the same time ...)
niston Posted October 19, 2020 Posted October 19, 2020 Navcuts only work when planning movement.In other words, if the NPC is already walking when you enable the navcut, it will plow straight through the navcut.
DieFeM Posted October 19, 2020 Posted October 19, 2020 It would get messy pretty soon certainly, I think that a proper set of packages would be a better solution. You could use as many refCollectionAlias as paths, and setup a package for each collection, so you can use the trigger to add the npcs to the desired collection so they use the package that leads them one way or the other.
YouDoNotKnowMyName Posted October 19, 2020 Author Posted October 19, 2020 Ok, but another problem that I have with the NavMesh thing: The "preferred pathing" should be used to mark roads, paths, basically any "proper way".An NPC will always go the "shortest route" from A to B, using the preferred pathing if possible.Alright: But what if I had a small dirt path that would be the "shorter way" from A to B, but I want the NPCs to use the actual "road" (which is a longer way)?How would I set that up? Because all the roads and small dirt paths HAVE TO BE preferred pathing, otherwise the NPCs start walking across the countryside ...Is there something like "preferred preferred pathing"?Like a "priority system" for the different "preferred paths"?
niston Posted October 19, 2020 Posted October 19, 2020 The system is limited... Like, you can't have provisioners go different routes than regular NPCs either... Solution is to not make the dirt path preferred, so they will hopefully take the longer (preferred) route.
SKKmods Posted October 19, 2020 Posted October 19, 2020 And not forgetting that pathing only happens when Actors are "onscreen" in the active uGrids with rendered (if you will) navmesh. Once the actors/navmesh are offscreen outside of the active ugrids, they revert to straight line XYZ coordinate pathing from present position to destination. Sort of. ps If your gonna do per actor packages the most elegant solution is to apply an actor value to the actor and make that actor value value a package condition to manage a single stack.
YouDoNotKnowMyName Posted October 20, 2020 Author Posted October 20, 2020 Ok, so for example:Package A:Has a condition that if that ActorValue is 1, this package gets used. Package B:Has a condition that if that ActorValue is 2, this package gets used. And so on ... Right?
Recommended Posts