Should I use Module Scripts to script enemy AI?

Heya there.

The title says it all. Of course, just greeting you and simply saying “The title says it all” would be lackluster. So I’ll give you an in-depth question, I guess.
Anyway, I’m working on a PVE, tower defense game and starting to work on enemy AI. I’m wondering if I should use Module Scripts to script enemy AI, specifically two functions. One being to tell the enemy to either target whatever thing the players are protecting or target players if they’re near and the second one being to tell the enemy to attack. (I’m planning on having the function just fire an event to make the enemy attack).

1 Like

I would use a serverscript in the folder that would store all npcs that need logic as a controller.

Okay, I may get away for using a ServerScript to give targeting logic to enemies, but how about attacking? All enemies are going to attack in different ways like punching, firing, etc.

Also, what do you mean by “Folder”?

I literally mean just make a folder in your workspace, and put all you npc models inside it. And yes, you can use it to control ALL logic. You can make a folder called MeleeNPC, put all NPCs with the same logic, and use 1 server script to control pathfinding, attacking, ect

Ah, alright then. Thanks, I was a bit confused on what you mean by that but thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.