Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a custom animated enemy npc?

I have asked this question before but got no useful answers, I am wondering if anyone knows how you can make a custom enemy npc, as in an npc without the standard R6 or R15 body so a custom enemy kind of like the ones in swordburst 2,or a monster that could have like 20 joints I would think that the best way to do it would be to use DaMrNelsons custom character creator to set up a custom character rig and then animate it and script it like a regular enemy npc with pathfinding I'm just not 100 percent sure how you would script the animations..

If anyone knows how I could do this, or has any links that would be greatly appreciated thanks.

2 comments

0

Scripting an actual NPC is quite the task, nbody here could have the time to write this and post it, I will try to help you though, I don't know any resources, yet there is something you can take a look at and try to write on your own, you can take the Zombie NPC from the top losted model, don't even have to type anything, open em' up and start reading

0

Good luck!

1 answer

✓ Accepted answer

I will do what I can to explain the process of what you desire, but I cannot offer the actual code because doing so would not help teach you but only spoon feed you answers. Please read the following text and attempt using other resources such as the Roblox wiki or free models. This text may not be perfect and is a quick rundown!


First of all, you'll need to build the actual NPC, this is simple enough. Keep in mind that creating a custom NPC that can use animations and other built-in Roblox API requires dealing with well... requirements. You must have parts with the names of Head, HumanoidRootPart, and Torso (Torso may not be needed but may as well do so anyway). Be sure to put a Humanoid or AnimationController into your build, because this is an NPC, you should be using the AnimationController where animations will be loaded/played. The entire build must be within a model!


Creating the 'skeleton' which allows the soon to be rig to be animated will require welds and Motor6D's. The parts that are welded will not bend while those who have a Motor6D will bend. Example being joints as Motor6D and the building of an arm being the welds. To create the Motor6D, I heavily suggest using the plugin you previously discussed! This will easily allow you to properly orientate and position the 'joints' of your new rig, remember to start at the torso going out when using the plugin. Don't attach anything to HumanoidRootPart besides Torso.


After the rig is complete, you'll need to use the Roblox animator plugin (or if you're fancy, export the rig to a 3rd party software). I can't really explain how to animate...you pretty much rotate and position until you have your animation.


To code the animations, you'll have to load your animations into the animationcontroller (if you use Humanoid, you could model the script after the Roblox animation script) then play them at key points such as attacks, movement, idle, and so on. Keep in mind to label your animations properly as Core, Action, Idle, etc so they properly overtake each other when played.


At this point, you have your NPC and may want to use the Pathfinding service to allow certain movements. Resources you'll want to look into for this project are somewhat as follow:

  • Animation(Search a lot here to find plugin info and rig info)

  • Welds/Motor6D

  • Pathfinding

Hopefully this helps

This discussion is preserved as it was. New answers, comments, and votes are closed.