Ez NPC | MMO NPC System Handler

Ez NPC

GitHub | Model


Introduction

Hey everyone! I’ve decided to take some time out of my life to re-write this NPC module for better speed, better flexibility, and just generally, better setup. I’ll be writing a more detailed and informative post below.

What is Ez NPC? Ez NPC is a open-source module created by Mystifine that provides an easy to set up NPC system within minutes! The module was created to handle large quantities of npc’s spreaded across large maps. This module provides a wide variety of options almost suitable for any situation at all! So let’s go over the features that it provides:

Feel free to leave and suggestions on improvements, suggestion on features and etc. Happy grinding!

Developer Note:
There are much much more things that are small but extremely helpful that I haven’t listed. The main purpose of this module is used for dumb NPC’s that need to achieve simple things such as combat. It’s possible to create intelligent NPC’s with more interesting features, however, it’s not recommended on the module.

Here’s an example if you’re stuck:
Ez NPC Example.rbxl (255.6 KB)


Resources And Media

Example of setting up “spawners”.


Example of npc’s in action, currently they are passive aggressive so I reduced it’s health. You can choose to change it to aggressive by default.


Creating easy to access data values within npc’s (tables are provided if you prefer those).
image


Other Resources

79 Likes

Version 0.01 Update

  • Fixed a bug regarding NPC’s not respawning
  • Fixed a bug where NPC’s “Float” off (DO NOT EVER PARENT NPC’S TO SERVER STORAGE, THIS HAS CAUSED ME SO MUCH PROBLEMS)
  • Fixed animations not loading.
  • You no longer have to put both MaxHealth and Health property in humanoid properties. All you need is MaxHealth

I’d like to say if you do ever use this in your game and you want me to list this under “Notable Games”, feel free to leave a reply.

2 Likes

I will most definitely give this a try in my future MMO game, i’ll give you some feedback. Thanks for this amazing work!

1 Like

Nice this works a lot better than the one I quickly threw together will definitely be using this, thanks!

1 Like

No problem,

one more thing to everyone, you can have pre existing NPC’s to manually override their spawn points if you don’t like how the AI randomly spawns near their spawner. The script will find the nearest spawner and assign that npc to that spawner.

Version 0.02 Update

  • Fixed a bug that made the NPC visually lag when rotating towards you, (method is to pre create a BodyGyro to rotate the NPC while enabling to move)
  • Added a NPC_CAN_JUMP property to Properties, this will allow npcs to jump if there is a obstacle in the way. (Method is to cast a small ray)
  • Other Minor Changes

Note
Feel free to reply with feature requests or bugs and I will look into it when I have the time. The GitHub has also been updated to the most recent Version.

1 Like

Could you possibly make a short demo with a opened source game? This would help devs like me very much with trying to figure out how to make it work!

2 Likes

Pretty cool stuff. Definetly could come in handy for a future project.

1 Like

What? How does the link help I cannot find anything

1 Like

I like it but i think you need to add pictures and and maybe a tutorial maybe would be nice i like it! it really easy to use but i still think there should be a tutorial.

3 Likes

Version 0.03 Update
Hey everyone. I’ve completed rewritten the module and the post all together for a better module. There are potential new bugs that exist, please let me know if you encounter any. If you need assistance, please take a look at the reference file I’ve provided in the original post, if you still need help or have questions / suggestions, feel free to leave a reply.


Version 0.04 Update

  • Updated NPC movement behavior, before the npc moved to the exact point on the target, now they move AttackRange away.
2 Likes

Hello. Very cool module you’ve got here. I have two bugs though.

  1. Whenever a few of my NPCs die, or fling away, their model will remain inside the Entities folder, and it will cause the script to give this error
    Skärmbild 2020-12-05 012830
    I also others that relate to the actual contents of the Model being empty due to deaths, flings etc.

  2. Whenever the NPCs are moving and colliding a lot, they sometimes may go “inactive” and not move for a couple of minutes, to then all of a sudden start moving at random intervals.

In your example build, which I copied the module and code from, if you test play it you’ll eventually find these glitches.
Thanks for reading!

Hello! Thank you for addressing these issues. I’ve went back to the module and made some adjustments. I’m somewhat confident that the first bug has been patched, not so sure about the second one. If the issue still persists please provide visual representation of the bug. It’s recommended to remove collision between NPC in config file. I’ve updated the reference place as well as the model (To ensure you have the latest version, make sure to restart your studio session to re-insert the model).

Version 0.04 Update:

  • Improved performance (previously there was a mistake in the code order)
  • Fixed a bug that caused NPC to not respond after death
  • Patched Most potential errors in the main thread

Let me know if there are any new bugs that occur.

1 Like

After some testing in my own game, I’ve noticed that NPC’s do not respawn after the first respawn. This is due to me forgetting to re-connect death events. I’ve fixed this in the new update. The place file in the original post has also been updated. Please update your modules, you’re MobData and Config files are portable. The only thing that was changed was in the Mob module.

Version 0.05 Update:

  • Fixed respawn bug with NPC’s
1 Like

before using does it spawn actually of where it actually spawns e.g: Mob got Killed returned back to it’s position of where it spawned

When an NPC dies, it respawns where it was originally spawned. For example, if the NPC followed you and you kill it 50 studs away from the original spawn point, when the NPC dies, it’ll spawn back at the original spawn point (it won’t spawn where you killed it).

1 Like

so I don’t have to do anything or code to where it spawns and btw is there an option to set the mob’s spawn point or spawn part position?

1 Like

Unfortunately, at the moment there isn’t built in way to specifically set a individual npc’s location, however, you can use parts and place them around areas where they will spawn. With that being said, there is a way to work with this (kinda hacky but with the feature to set individual part spawn quantities it’s not that bad), if you were to set the NPC spawn quantity to 1 and made a very small part, it’ll spawn at that small part. So technically, yes there is a specify a mob’s spawn point.


In terms of coding, there are additional customizations that can be done, but an individual should be able to easily follow along and setup the system from the reference file provided.

1 Like

so basically drag the NPC of where I want it to spawn?

1 Like

You’d drag the part (the spawner). I’ve provided a place file in the original post as an example. Consider taking a look in there (on how it’s setup). Feel free to ask me more questions.


Update 0.06

  • Fixed a bug that made the NPC’s not go to nearest enemy.
3 Likes