My game has buildings. When directed to the enemy’s (in this case, the AI’s) building, a noob will run to that building every 1 second and will take out one point per noob. Let’s just say the enemy building has 30 points; We need 30 noobs to attack, so it’d take 30 seconds.
I need to have the enemy (AI) be able to know when to attack back, and to know when to attack another building if it has less points (the lesser the points, the lesser amount of noobs it takes to destroy, hence, it is to conquer the building). The AI needs to be smart, and to react fast.
The issue is… I don’t know how to program, so I don’t know how to go about this.
I haven’t tried anything yet because I don’t know where to begin.
what does it need to do besides find the opposing building with the lowest points?
is this 1 npc sending 30 noobs to a building with 30 points? or is this 30 npcs working together to figure out if there are enough npcs already heading there or already working on it?
The basic movement using AI would be Humanoid:Move(Vector3.new()) or Humanoid:MoveTo(workspace.part). If you want it to respond quickly, you calculate distance from parts etc. But since you say you can’t program it is practically impossible to create an NPC with no programming knowledge whatsoever.
You need to know the following to be able to start off with scripting an NPC- Magnitude Parts in a character Calculating distance between a constantly moving part and another part. Animations Getting a player value with using the playerAdded function Handling damage and values Properties of humanoid Accessing character rigs/parts.
Those are some of the essential things you need to start making an NPC, I’d recommend you watch videos on it. It will help you a lot.
The first thing I would do is build my noob model. After that, I would make whatever the noob is going to come out of. To get the noob to spawn I would use :clone. Then I would use Roblox’s pathfinding service (Character Pathfinding) or SimplePath (SimplePath - Pathfinding Module) Then I would check if one of the noobs touched the AI building and remove 1 point of health. With this, though you might want to do a remote event so that way it syncs with the server overall just better if you are gonna use datastores or updating for all players.
you could loop through a table of all available buildings and get the building with the lowest points
you could google “examples of getting min or max in unordered array” for examples