Garry's Mod

Garry's Mod

Nightmare Terminus Nextbot V2
Spoon  [developer] 10 Sep, 2024 @ 2:07pm
Make Your Own Nextbot
Want to know how to make your own bot? Here is your guide.

This guide is for Windows computers.

This guide will show you how to create your own nextbot with new sounds and images using another nextbot as a base. This will not show you how to alter the code, as that requires a more advanced discussion.

Note that this will only work on smart nextbots, not Sanic clones or DrGBase. A smart nextbot is any nextbot that uses Gargitron as a base, which is basically all smart nextbots on the workshop with a few exceptions.




Toolkit

These are the applications I would suggest you download for nextbot creation.

Notepad++ - The superior version of Notepad. Not to say that coding on Notepad is impossible, but Notepad++ is much easier to use and much more advanced. This will allow you to change the code of the nextbot.

Paint.net - If you want to make a really nice new image for your bot, you can use this. Of course, you can just get an image of the internet, but keep in mind it has to be 512x512 pixels to look normal in game. You can also use MS Paint for simpler changes.

Audacity - This will allow you to change the sounds of the nextbot. You can edit sounds or make your own. When downloading sounds from online, always be sure it is safe, and make sure the sample rate is 44100 Hz.

Of course, it all depends on how far you plan on going with your changes. You could do it with MS Paint and Notepad if you're doing a simple reskin. But please, don't contribute to the endless amounts of low effort nextbots.




Part 1 - Getting a copy of your nextbot

Step 1: Find the bot you would like to use as a base on the workshop and subscribe to it. While viewing the addon page, look in the top right corner of your window to find the URL of the addon. Copy the last numbers in the URL. (In this case, the numbers would be 3298715317. If you searched for the nextbot, you may see something like &searchtext=whateveryousearchedfor. Ignore it and just copy the numbers.)


Step 2: Open your files application. Navigate to the drive that you've installed Steam on (For this example, we'll use the C: drive). Then go to the directory C:\Program Files (x86)\Steam\steamapps\workshop\content\4000. (This means that you must click on the C: folder first, then click on the Program Files (x86) folder, and so on until you reach 4000.)


Step 3: Inside the 4000 folder, paste the numbers you copied in Step 1 into the search bar. This should bring up the addon folder of your desired nextbot. If you get nothing, this most likely means you are not subscribed to the nextbot you are trying to find. Open the folder to find the gma file.


Step 4: In another file application window, go to the directory C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\bin and locate gmad.exe. Drag and drop the gma file from Step 3 onto gmad.exe. This will make a copy as a folder next to the gma. I would suggest moving the folder out of the one it was created in to a separate folder in something like your downloads folder. Now, you're ready to begin tweaking it.

Part 2 - Preparing your nextbot

Step 5: Now that you have your nextbot, you need to give it a name. Enter the folder you created in Step 4. There should be at least 4 folders. Lua, materials, models, and sound. You don't have to worry about models at all. Materials is where the images for the nextbots lie, lua is where the code is, and sounds is pretty self explanatory.


Step 6: Unless you plan on replacing the nextbot whose code you are using, and instead would like to make your own that doesn't override it, follow this step. You must enter the lua folder. Inside you will find the entities folder. In more advanced scenarios, you might find other folders, but we won't touch on that now. Inside the entities folder should be the nextbot. (In this case, it would be npc_terminusnm.) Now, rename the file to your chosen name. Although not required, I recommend keeping the prefix "npc_" and just adding your own name after. (If I wanted to make a nextbot called Big Bob, it would be "npc_big_bob". Do not use spaces in your name.) Open this file using your chosen application. If you haven't downloaded any of the toolkit apps above, just use Notepad.

Part 3 - Customization

Step 7: First things first, give your nextbot a new name. Scroll down to the very bottom of the code, at that is most likely where you will find something that looks like this.

list.Set("NPC", "npc_big_bob", {
Name = "Big Bob",
Class = "npc_big_bob",
Category = "Bob Nextbots"
})

list.Set is the most important one. Do not change NPC. Change the npc_big_bob to whatever you named the lua file in Step 6. It must be identical.
Name is the name that will appear in your spawnmenu. You can include spaces in this name.
Class must also match the exact name of the lua file, just like list.Set.
Category is the category under which your nextbot can be found. You can make a new one or assign it to a pre-existing one.
Make sure that your don't name your nextbot the same thing as another addon you already have downloaded! This will cause the two addons to conflict!


Step 8: If you want to give the nextbot a new image, go to the materials folder (see step 5). Inside will be an entities folder and another folder, most likely the name of the nextbot.
Inside the entities folder, you can place your new image. Make sure it has the same exact filename as your lua file. This is the image that shows up in the spawnmenu.
Inside the other folder, (in this example, we will call it the bigbob folder) the images for the nextbot's in game appearance will be there. These files do not have to perfectly match the name of your lua, but they have to match the names of the files you assign inside the lua file.
Find this group of code in your lua file. It is often near the bottom.

ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
local bigbobMaterial = Material("bigbob/npc_big_bob_normal.png", "smooth mips")
local bigbobRageMaterial = Material("bigbob/npc_big_bob_enraged.png", "smooth mips")
local draw_offset = Vector(0, 0, 64)

In this scenario, I would have two files inside my bigbob folder, npc_big_bob_normal.png and npc_big_bob_enraged.png.
You can add as many as you like. However, you only need one, and if you want to make the ability for the nextbot to switch between images, you will have to code that in, which we can talk about another day. Images must be 512x512 pixels or they will look wrong!


Step 9: Give your nextbot some new sounds! At the beginning of the code, you will find an array that looks something like this.

self.loaded_amb_sounds = {}
self.loaded_amb_sounds[1] = CreateSound(game.GetWorld(), "sound1.wav")
self.loaded_amb_sounds[2] = CreateSound(game.GetWorld(), "sound2.mp3")

There may be multiple of these. If you want to change the sounds, you cannot just replace the files with different sounds of the same name! This means you are overriding the original sounds, and any other nextbots that use them will be affected. Give your sounds original names. Example:

self.loaded_amb_sounds = {}
self.loaded_amb_sounds[1] = CreateSound(game.GetWorld(), "bob_stalking.wav")
self.loaded_amb_sounds[2] = CreateSound(game.GetWorld(), "bob_chasing.mp3")

In the sounds folder, you will have to put your sound files of the same name inside, and of course the file type must match. (My bob_stalking file must be a wav file and my bob_chasing file must be an mp3 in this scenario.) They also need to be 44100 Hz. (You can find out how to change the sample rate via a YouTube tutorial.)




There you have it! Be sure to always credit the creator of the nextbot you are tweaking! If you are having any trouble or have any questions, just post them down below. I can't wait to see what you guys can make! Happy creating!

Guide requested by dav frum algbrla crass.
Last edited by Spoon; 1 Jul @ 7:31am
< >
Showing 1-14 of 14 comments
hi im first (i say this if there is no comments)
can you give an easier way to inport the image?
Spoon  [developer] 13 Sep, 2024 @ 5:06pm 
Originally posted by isaac.mccollow:
can you give an easier way to inport the image?
Which part are you having trouble with? I can't really help you with getting the image itself, as that would be for you to grab from online or create yourself. I'm not quite sure what you mean by importing the image. All you need to do is put your 512x512 image inside the subfolders within the materials folder.
Originally posted by Spoon:
Originally posted by isaac.mccollow:
can you give an easier way to inport the image?
Which part are you having trouble with? I can't really help you with getting the image itself, as that would be for you to grab from online or create yourself. I'm not quite sure what you mean by importing the image. All you need to do is put your 512x512 image inside the subfolders within the materials folder.

i have ms paint. i pressed copy and i cant paste it to the "materials" folder. can you help me? i tried e v e r y s i n g l e w a y and i cant do it.
Spoon  [developer] 15 Sep, 2024 @ 9:18am 
Originally posted by isaac.mccollow:
Originally posted by Spoon:
Which part are you having trouble with? I can't really help you with getting the image itself, as that would be for you to grab from online or create yourself. I'm not quite sure what you mean by importing the image. All you need to do is put your 512x512 image inside the subfolders within the materials folder.

i have ms paint. i pressed copy and i cant paste it to the "materials" folder. can you help me? i tried e v e r y s i n g l e w a y and i cant do it.
I am still not quite sure what your problem is. Is the issue trying to paste the image itself into the materials folder? What happens when you try to paste it in? Does it simply not allow it, or does nothing happen? Try dragging and dropping the file you want in manually instead of copy-pasting it.
Originally posted by Spoon:
Originally posted by isaac.mccollow:

i have ms paint. i pressed copy and i cant paste it to the "materials" folder. can you help me? i tried e v e r y s i n g l e w a y and i cant do it.
I am still not quite sure what your problem is. Is the issue trying to paste the image itself into the materials folder? What happens when you try to paste it in? Does it simply not allow it, or does nothing happen? Try dragging and dropping the file you want in manually instead of copy-pasting it.


oh
how do you upload the nextbot? nvm
Last edited by dav frum algbrla crass; 15 Sep, 2024 @ 4:04pm
i got this Error -> [string "npc_friendlyfather.lua"]:65: unexpected symbol near '!' any help?
Last edited by dav frum algbrla crass; 15 Sep, 2024 @ 4:05pm
Spoon  [developer] 16 Sep, 2024 @ 5:17pm 
Originally posted by isaac.mccollow:
i got this Error -> [string "npc_friendlyfather.lua"]:65: unexpected symbol near '!' any help?
Sure! Go into your code and grab the 65th line and paste it here, and I'll compare it to the working one! There should not be any issues unless you accidentally tampered with the code. Even one accidental character could mess up the entire bot.
this is the code: elseif ( self:GetEnemy():IsPlayer() and !self:GetEnemy():Alive() ) then
Spoon  [developer] 19 Sep, 2024 @ 7:00pm 
Originally posted by isaac.mccollow:
this is the code: elseif ( self:GetEnemy():IsPlayer() and !self:GetEnemy():Alive() ) then
Hmm. The problem doesn't seem to be in that line. Here, this is the entire function that the error seems to be located in.

function ENT:HaveEnemy()
if ( self:GetEnemy() and IsValid(self:GetEnemy()) ) then
if ( self:GetRangeTo(self:GetEnemy():GetPos()) > self.LoseTargetDist ) then
return self:FindEnemy()
elseif ( self:GetEnemy():IsPlayer() and !self:GetEnemy():Alive() ) then
return self:FindEnemy()
end
return true
else
return self:FindEnemy()
end
end

Compare yours and mine. You can use the ctrl + f function to help you.
ok this is mine:



ENT:HaveEnemy()
if ( self:GetEnemy() and IsValid(self:GetEnemy()) ) then
if ( self:GetRangeTo(self:GetEnemy():GetPos()) > self.LoseTargetDist ) then
return self:FindEnemy()
elseif ( self:GetEnemy():IsPlayer() and !self:GetEnemy():Alive() ) then
return self:FindEnemy()
end
return true
else
return self:FindEnemy()
end
end")
Last edited by dav frum algbrla crass; 20 Sep, 2024 @ 12:30pm
Spoon  [developer] 20 Sep, 2024 @ 12:40pm 
Originally posted by isaac.mccollow:
ok this is mine:



ENT:HaveEnemy()
if ( self:GetEnemy() and IsValid(self:GetEnemy()) ) then
if ( self:GetRangeTo(self:GetEnemy():GetPos()) > self.LoseTargetDist ) then
return self:FindEnemy()
elseif ( self:GetEnemy():IsPlayer() and !self:GetEnemy():Alive() ) then
return self:FindEnemy()
end
return true
else
return self:FindEnemy()
end
end")

Well, that was an easy find. You have an extra ") after your last end. Just remove it and the problem should be fixed. The other parts of the code are identical.
i think i just have to press 'save'
Last edited by dav frum algbrla crass; 10 Oct, 2024 @ 6:14pm
< >
Showing 1-14 of 14 comments
Per page: 1530 50