Garry's Mod

Garry's Mod

PAYDAY 2: Nextbots
 This topic has been pinned, so it's probably important
Shadow Bonnie (RUS)  [developer] 6 Feb, 2021 @ 10:33am
New bots and classes (Developers)
If you want other classes of bots, that have other model or logic, you can create your own addon with code that adds new class of bot.

If you want use additional logic (like have Taser and Medic classes), you can ask here it is possible to create that logic or not.

If you want use other model, i highly recommend use model, that use PAYDAY 2 animations, because that model supports heavy damage animations and death animations.

First, you need create lua script. Put it in lua/autorun.

How to add new classes and groups
Use "SB_ANB_PAYDAY2_SetupBotClasses" hook to create new classes.

Example how you can create your own Taser with custom model:
hook.Add("SB_ANB_PAYDAY2_SetupBotClasses","MyOwnTaser",function(classes) classes["MyOwnTaser"] = { -- MyOwnTaser is internal name. Name = "My Own Taser", -- Name in spawn menu. Icon = "my_own_taser.png", -- Path to icon in spawn menu. Type = "Police", -- Type (or fraction) of bot. Addons = {"911552729","1769443410"}, -- Workshop IDs for required addons. Variants = { [1] = { -- First variant of bot. Model = Model("path/to/your/model.mdl"), -- Bot's Model. Skin = 0, -- Skin of model. Bodygroups = {2,4,6}, -- Bodygroups, this will set 1st group to 2, 2nd to 4, 3rd to 6. Weapon = "weapon_ar2", -- Default weapon class. HelmetBreak = {1,1,Model("path/to/your/helmet/model.mdl")}, -- Data of helmet to fly off. First 1 is index bodygroup to change, second 1 is number bodygroup change to, third is model of helmet that will fly off. }, }, Health = 300, -- Default health. HeadshotMultiplier = 2, -- Default headshot multiplier. RunSpeed = 300, -- Default run speed, in units per second. WalkSpeed = 200, -- Default movement speed. SlowWalkSpeed = 100, -- Default walk speed (like player with ALT). AimSpeed = 180, -- Default rotation speed, in degrees pre second. UseBleedout = false, -- Can bot fall into bleedout state on depleting health. CanCrouch = true, -- Can bot crouch or not. CanJump = true, -- Can bot jump or not. CanDoMeleeAttack = true, -- Can bot perform melee attack to enemies. ShouldDoHeavyDamage = true, -- Can bot play heavy damage animation. CanBeSuppressed = false, -- Can bot use suppressed state on low health. Tasks = {"taser"}, -- Unique tasks to use. Voices = {Death = "taser",OnSeeEnemy = "taser"}, -- Voice lines. You should see source code in ENT.Voices to understand what type you can use. You don't have to set this value if you don't want to bot play voice lines. } end)

Use "SB_ANB_PAYDAY2_SetupBotGroups" hook to create new groups.

Example how you can create your own Taser group:
hook.Add("SB_ANB_PAYDAY2_SetupBotGroups","MyOwnTaserGroup",function(groups) groups["MyOwnTaserGroup"] = { -- MyOwnTaserGroup is internal name. Name = "My Own Taser Group", -- Name of group in spawn menu. Icon = "path/to/icon.png", -- Path to icon in spawn menu. LeaderClass = "MyOwnTaser", -- Internal class name of bot that will be leader. MemberClass = "MyOwnTaser", -- Internal class name of bots that will be members. Min = 2, -- Minimum count of bots, including leader. Max = 2, -- Maximum count of bots, including leader. } end)

Creating new unique tasks
To create custom logic, you can use custom unique tasks. To know what is this, you should know how tasks works in base addon (SB Advanced Nextbots Base).
hook.Add("SB_ANB_PAYDAY2_SetupUniqueTasks","MyOwnUniqueTask",function(tasks) tasks["MyOwnTask"] = { -- Add callbacks here. You also can use "As" key, to use this task with other internal name (for example to rewrite exist task). Also you can add "DontStart = true" to make task don't start automatically when bot spawned. } -- This is how Criminal bots restores their health. In bot class, use Tasks = {"criminal"} to use this task tasks["criminal"] = { OnInjured = function(self, data, dmg) data.RegenerateTime = math.max(data.RegenerateTime or 0, CurTime() + 2) end, Think = function(self, data) if data.RegenerateTime and CurTime() >= data.RegenerateTime and self:GetBleedoutState() == 0 then data.RegenerateTime = nil self:SetHealth(self:GetMaxHealth()) end end, OnExitBleedout = function(self, data) data.RegenerateTime = math.max(data.RegenerateTime or 0, CurTime() + 10) end, } end)
Last edited by Shadow Bonnie (RUS); 6 Jul, 2024 @ 8:24am
< >
Showing 1-12 of 12 comments
ItsSonoItaliano 6 Feb, 2021 @ 3:39pm 
Can you make vehicles?
ItsSonoItaliano 6 Feb, 2021 @ 3:39pm 
And cameras?
Shadow Bonnie (RUS)  [developer] 6 Feb, 2021 @ 4:05pm 
This discussion is not about that.
avast windows 27 Apr, 2021 @ 9:11am 
Добавь аканов из хардкора
Add Akan from Hardcore
Shadow Bonnie (RUS)  [developer] 27 Apr, 2021 @ 10:02am 
Данное обсуждение не об этом
President N U T 21 May, 2021 @ 5:39pm 
So, I would start making other NPCs like dozers and snipers, but I don't have that much experience in developing addons, just server, aside from that I am too ♥♥♥♥♥♥♥ dumb to figure it out, so Imma leave it to you.
Wert 18 Jul, 2023 @ 10:17am 
А когда добавят маршалов?
GenSec 2 Apr, 2024 @ 8:56am 
Sadly there aren't enough models supporting these animations so there is no possibility to add more enemies.
Shadow Bonnie (RUS)  [developer] 29 Jun, 2024 @ 5:24am 
We can now use xdR pd2 animations addon to make ALL playermodels compatible with system. This should give more freedom for custom enemies.
isn't there like the payday 2 restoration mod enemies
becuase i noticed no one has made the enemies from that mod as next bots
Sokol 24 Oct, 2024 @ 2:29am 
can somebody make the US Marshals, it would be great if somebody actually spent their time doing this :steamhappy:
< >
Showing 1-12 of 12 comments
Per page: 1530 50