Not very helpful when it comes to debugging each script is it?
Unless using module scripts of course…
Using 1 script to manage all AI is the best way in my opinion and by using that method, you can use CollectionService
I know but one script for every NPCs can take his time.
And there’s no difference between one for every or one for all.
Metatables can be used to access data between scripts, among other options such as _G.
What really makes the difference is one’s work flow. One script might be easier, but Modulescripts and Attributes also work and are easier for others to edit and use.
Using 1 script to manage all AI is a much better approach since it gives you a lot more control and ease of use. As far as resources go, the difference won’t be as noticeable. There will be a lot of duplicated code, though, due to the 1 script per AI. If you want to communicate them, manage them, etc. without the need for unnecessary values then 1 script as a manger is the best.
One script is messy and hard for others to edit. That’s the purpose of ModuleScripts. Duplicate code is also irrelevant if done via cloning instead of manually. Attributes can be used to set states and properties. There’s a lot you can do with AI where splitting things up can make things a whole lot easier. One script is perfectly fine, but you’ll be creating new coroutines anyway.
Ok so, the answer is:
- In each NPC:
- This one is easy and you will save your time.
- For every NPC:
- This one can be difficult than and will take more than the previous.
Of course it’s your decision.
It should be specified to use ModuleScripts so that important aspects only need to be managed in one place like variables. NPCs should only need to reference that data. The attribute part is a clean way for both developers and other scripts to see the status of said NPC.
There’s no difference between in each or for every…
The difference is editing all of the scripts vs one. It’s important to specify exactly what you mean to avoid misinterpretation.
What I’m suggesting is an entire system focused on NPC implementation with ease of access Vs everything crammed into one main script. The difference is not in performance, but in development.
You aren’t understanding, one can take more time and is hard, other can take less time and is easy, but it’s his choise, but as a RPG developer i can say one script to manage every NPCs can be accurate, because of the errors i had.
Not to be offensive, but it seems that you haven’t read or at least not understood my previous replies in this thread. Perhaps I have not explained myself well enough. What I’m talking about is the difference between throwing something together and creating a properly implemented system. I’m not sure if I can truly explain it properly without showing a working version of what I’m suggesting.
I recommend a properly implemented system when working with a team as it will be far more beneficial for everyone involved. A single script is fine if you’re working by yourself. It might be faster to write, but it will make future development harder.
Putting entire scripts in each ai is absolutely excess and as a scripter you want to make your code as short and compact as possible.
Well, script excess or short code, styles of scripters can change with the time.
Writing code isn’t a matter of “style” what’s the point writing lines of pointless code…
You think so? I just can say no one can see your code, and if you feel comfortable with it, there’s no problem, else you can try upgrading yourself.
And do you think your style is “comfortable” to everybody? No.
What about team projects what about people helping you?