Help with making a boss battle!

Hello everyone! This is my first topic ever and I am a fairly new scripter.

I’m trying to make a custom boss with custom moves for a “defend the statue” type game.
I’ve made custom moves for a boss’ attacks using TweenService and CFrame.
I made it where it fires an event on key. Instead of making it on key, I want to know how I can implement the moves onto an npc/boss so they use it when they see a player.

https://gyazo.com/070b6801b8b1f77f0cd57ea92d073d01
These are the current moves that I want to implement onto the npc/boss.

Is there any way to implement it to an npc?
All I want to know is how can an npc use an attack.

Thanks!

Ask me if you want me to show any scripts if you’re willing to help!

5 Likes

It seems like what you are asking for is an artificial intelligence that is able to execute the moves you’ve already created.

I remember there being a book for creating AI, The Nature of Code,

The goal of this book is simple. We want to take a look at something that naturally occurs in our physical world, then determine how we can write code to simulate that occurrence.

The essence of building an AI is recognizing how the NPC wants to act given a situation.

  • What is its goal? Killing the player, obviously.

    • This can optionally include attempting to avoid dying.
  • How can the NPC achieve this goal? Whatever attacks you programmed for him, evidently. And probably movement.

  • When should these tools be used? Optimally, whenever it helps the NPC get closer to achieving his goal. So if the player is within range for an attack, the NPC should start attacking. If the NPC wants to get closer, help him move closer.

As soon as you can answer these questions, you should be prepared to write a script for it.

The only way I have ever written an fighting AI is with a few tuning variables and an infinite while loop. This can be impractical in most situations, however. For me, coding a swordfighting AI with rather complex movement using a while loop took me around 3 weeks’ worth of work and fine-tuning. That may be normal though, I truly don’t know.

There are plenty of other much more practical ways to create AIs, like neural networks or behavior trees:

I am the furthest from an expert on this topic, I just know I will have to make AIs some time in the future, which makes this a valuable research topic.

2 Likes

uhhhhhhh not sure if that answered my question, kinda did?

1 Like

any other ideas does anyone have? that seems a little too complicated for a boss fight…

math.random() and a module to hold all the attacks/values if you’re overkill.

3 Likes