I don’t want to add individuals scripts for every enemy ai and I want it to be very efficient that minimizes the lag. Is it a good idea to have one script to control one type of enemy like for example: Archers would get their own main script and Melee enemies would also have their own script. Also, how can I use Actors to further break up the work. Any help will be appreciated : )
You cant, I’ve already tried this a while back, Just make the script as effiecient to reduce lag since its exponential.
Avoid loops and other things and maybe even use a module script if you know how.
Animations also vary so it also has to be a sepperate script.
I dont know anything about animations so i cant help with that.
–goodluck
it’s the system i use right now, doesn’t seem to lag my machine at all
though the fps seems to get hurt when there’s ~18 NPCs chasing you at the same time
but other than that it works pretty decent, though i do have a 3060 ti with an i5 12600KF, so your experience could be different
but for animating scripts i suggest just having 1 in each enemy, shouldn’t be hard on performance
Use collectionservice for this, so you don’t have to copy paste the same scripts over and over. Also try to optimize the script as much as you can
I normally do something like this
workspace.EnemyFolder.ChildAdded:Connect(function(Enemy)
--Enemy AI here
end
and if i have enemies already in the workspace i just add
for i,v in workspace.EnemeyFolder:GetChildren() do
v.Parent = workspace
v.Parent = workspace.EnemeyFolder
end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.