Garry's Mod

Garry's Mod

3,130 ratings
Patrol Routes STool
2
2
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Realism
File Size
Posted
Updated
12.064 KB
14 Feb, 2016 @ 7:17pm
9 Mar, 2018 @ 4:37pm
15 Change Notes ( view )

Subscribe to download
Patrol Routes STool

Description
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://sp.zhabite.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).
Popular Discussions View All (18)
6
20 Nov, 2020 @ 10:57am
NPCs won't return
wow
1
4 Mar @ 4:02pm
The Wire Assigner is bugged with saves
penguino
4
13 Oct, 2020 @ 9:37am
flying npc's/striders/rollermines/Combine APC.
Snuffleupagu5
969 Comments
Iceprince08 24 May @ 1:53pm 
can you fix that?
Max Shadow  [author] 3 May @ 7:01pm 
@Iceprince08 make sure you have show chances enabled. If that doesn't work, a GMod update may have broken the mod. It's pretty old

@carterhollywood3 Hold E and shoot a node to select it, and without releasing E shoot another node to connect the selected node to it, in that order. You can do this to connect the last node with the first one and make a loop. Be aware that nodes have specific directions, unless undirected links is enabled
carterhollywood3 3 May @ 1:32pm 
how do i make in a loop?
Iceprince08 2 May @ 8:40am 
i can't see the Chances
Max Shadow  [author] 4 Mar @ 4:51pm 
Sounds like an update broke something. I don't get why they keep making breaking changes to a 10 year old game. Sadly, I stopped playing the game a very long time ago. It's unlikely I'll fix this anytime soon.
meierhans 4 Mar @ 4:01pm 
PS: This is on a dedicated server, I get this error message in console:

[Patrol Routes STool] lua/entities/ent_prwireassigner/cl_init.lua:5: bad argument #1 to 'SetMaterial' (string expected, got userdata)
1. SetMaterial - [C]:-1
2. unknown - lua/entities/ent_prwireassigner/cl_init.lua:5
meierhans 4 Mar @ 3:59pm 
I digged into it, and made it work with wiremod. It is great, I can use a wiremod trigger / button to assign in realtime any NPC I like in range to a route. It is so much more flexible than the default assigner, a new world of interactivity. Imagine f.e. you got to bring a keycard to a NPC to make it move further. Or routes depending on the state of the map. I was jumping on my chair.

But then.. I tried to save it with Advanced Duplicator 2. I can not choose the ent_prwireassigner, and if I choose another connected part, like the button, it will just save this. Not the assigner itself.

Also, while the AssignInRange and Range inputs of the assigner are shown in red in the wire tool. the wires themself do not show up. Things are indeed connected, as it works, but I just can not save it.

Is this a limitation of the way Patrol Routes works, aka saving the route on the client, and it can not be saved into the assigner itself? Or is this a bug?

Is there maybe a fixed version I missed.
R.K. suerte 20 Feb @ 9:18am 
Is there a way to make VJ base vehicle SNPCs follow the nodes?
meierhans 14 Feb @ 2:08pm 
Is there any way to save and auto load routes? I tried Permaprops and MMM, but both sadly fail. It would be so great if we could start a map and the NPC´s start moving without any clicky clacky.
Diddy Blud 4 Feb @ 10:31am 
Hey, I have a problem with this mod every time I load a save the auto-assigner orbs disappear and I have to redo them all over again which is very annoying. Even if they stayed after the save their range is now 0.