Garry's Mod

Garry's Mod

3,101 arvostelua
Patrol Routes STool
2
2
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Content Type: Addon
Addon Type: Tool
Addon Tags: Realism
Tiedostokoko
Julkaistu
Päivitetty
12.064 KB
14.2.2016 klo 19.17
9.3.2018 klo 16.37
15 muutosilmoitusta ( näytä )

Tilaa ladataksesi
Patrol Routes STool

Kuvaus
This tool allows you to create complex patrol routes for your NPCs. I made it mainly as a complement to my Stealth Mod. You can find it here: https://steamoss.com/sharedfiles/filedetails/?id=608796788 . This is my second project in LUA, I still have much to learn, so there may be bugs. Feel free to post them here and I'll try to fix them as soon as possible.

IT WON'T WORK IF THE MAP DOESN'T HAVE AI NODES
You can still use this tool in those maps, but you'll have to place patrol points really close to each other (less than 150 points of distance to be exact).

You can save and load your current patrol route to a file. Every map has its own list of saved patrol routes. These files are stored inside Garrysmod/data/patrolroutes.

This tool is compatible with the GMod Save system. However, as everyone knows, that system sucks and its bugged as hell. Always rememer to disable AI and move up your NPCs a bit, so they don't get stuck underground when you load.

Tool Settings:
Show Points: To show or hide the patrol points and links.
Show Chances: To show or hide the chances of links.
Autolink: If enabled, any patrol point you place will be automatically linked to the last.
Walk: If enabled, the NPC will walk through the patrol route.
Strict: If enabled, the NPC won't stop following a route to attack an enemy.
Back and Forth: If enabld, the NPC will start moving in the opposite direction if he finds a dead end.
Undirected Links: If enabld, the NPC will take any route, regardless of it's direction.
Wait Time: The time in seconds an NPC will wait at a specific patrol point.
Chance: The relative chance that an NPC will use a specific link.
Starting Node: The node where the NPC will start the patrol route.
Autoassigner Range: Maximum range for the Autoassigner.
Autoassigner Filter: Class filter for the Autoassigner.


Controls:
Mouse1: Add/Remove node.

(E+Mouse1): Select node.
--> Mouse1 on node: Add/Remove link.
--> Mouse1 on selected: Remove all links.
--> Release E: Deselect node.

Mouse2 on NPC: Assign route to NPC / Create assigner / Update assigner route and settings

(E + Mouse2): Recover route from NPC or assigner.

Reload: Clear nodes.


How to make different patrol routes:
- Create one route and assign it to an NPC with Right Click.

- Press RELOAD to clear your current nodes.

- Make another route, and assign it to another NPC.

NPCs will keep their last assigned patrol route even if you make a new one. Clearing or modifying your current route won't affect already assigned ones. You don't need to have all your routes active at the same time!!!


Single NPC mode:
This is the default mode. Make a route and press Mouse2 on an NPC to assign your current route to him. Press E+Mouse2 to recover the route assigned to that NPC.


Autoassigner mode:
In this mode, Right Click on the world to create an autoassigner. This entity will assign any NPC spawned inside a configurable radius to your current patrol route. You can use this to automatically assign NPCs spawned by other tools, like "NPC Spawn Platforms". Press Mouse2 on an existing autoassigner to update its stored route and settings, or E+Mouse2 to recover the route.

You can also filter which NPCs are assigned. Just write their class names separated by commas without spaces in the tool textbox.


Wire Assigner mode:
In this mode, Right Click on the world to create a Wire Assigner. This entity can be controlled with Wiremod tools. You can use this to assign its stored route to specific NPC's, or all NPCs in a certain radius. The radius and filter settings in the toolmenu are ignored, you need to specify them using Wiremod inputs. Press Mouse2 on an existing Wire Assigner to update its stored route and settings, or E+Mouse2 to recover the route.

Wire Inputs:
AssignNPC: When this is not "0", it will assign its stored route to a single NPC.
AssignInRange: When this is not "0", it will assign its stored route to any NPC inside its configured range.
NPC: The NPC you want to assign the route to with "AssignNPC".
Range: The maximum range for "AssignInRange".
Filter: The NPC filter for "AssignInRange". It has to be a list of class names separated by commas, without spaces.


Known Issues:
- I tried to optimize it as much as I could. Still, there can be FPS drops if you have too many patroling NPCs.


Credits:
Big thanks to Silverlan and his NPC Tools. I used part of his NPC Spawner code as a base to make this tool.

Also thanks to thelastpenguin for his pON (Penguin's Object Notation).
Suositut keskustelut Näytä kaikki (18)
6
20.11.2020 klo 10.57
NPCs won't return
Imagine sisyphus.
4
13.10.2020 klo 9.37
flying npc's/striders/rollermines/Combine APC.
Snuffleupagu5
1
24.9.2021 klo 18.51
error ?
SHREDDER(V)o¥o(V)
959 kommenttia
SpookyBain I COG 27.12.2024 klo 2.32 
hey man i have a tiny list of questions and i need some assistance, if you dont mind taking my friend request that would be realy cool!
Kamil gaming with Friends 21.12.2024 klo 11.07 
There were no obstacles, I was just trying to make 1 guard patrol 1 corridor, from corner to corner, but turns out the place was too big and game save decided to delete the set patrol route by itself the next day.
Max Shadow  [tekijä] 21.12.2024 klo 9.47 
That's probably because the map you're playing on doesn't have a nodegraph. NPCs use AI nodes to navigate, if there are no AI nodes, they can only move a short distance, and are unable to pathfind around obstacles.
Kamil gaming with Friends 20.12.2024 klo 11.12 
And now the NPC doesn't to go through the route, unless the nodes are covering only half of the "500" range.
Kamil gaming with Friends 20.12.2024 klo 10.50 
Nevermind, turns out the route was too big for autoassigner with range set to 500 even.
Kamil gaming with Friends 20.12.2024 klo 8.17 
Okay, idk what's going on, but my NPC stops at the 2nd node everytime and then I have to rickclick on him again, but he walks back to the 1st node, instead of walking to the 3rd one. I wanted to make a real route, with like 6 nodes at least, but my NPC does this all the time instead and nothing works.
baernay 26.11.2024 klo 9.19 
does this work for hammer?
not doge 17.11.2024 klo 21.05 
the npc patrol mod is giving me a error\
elcartucho5566 24.8.2024 klo 10.13 
the npc will get out of the patrol route and attack a threat?
Bobbymansツ 20.8.2024 klo 2.27 
Hi I was wondering why only the first NPC follows the path but when I want to assign a 2nd NPC, the 2nd NPC goes back and forth once but then just stands still.