#i put my combat system into an npc and hes only doing 1 m1 and not doing the rest, please help.

173 messages · Page 1 of 1 (latest)

tired oracle
ruby iron
#

@tired oracle what do you mean which m1?

tired oracle
#

The first one

#

Hes only doing the first m1

#

@ruby iron

ruby iron
#

wait, why are you using userinputservice inside an AI?

#

there is no user

#

@tired oracle

tired oracle
#

ur right lemme delete that part of the script

#

alr now what

#

@ruby iron

ruby iron
#

does it not come back in the code?

#

wait it actually doesn't

tired oracle
ruby iron
#

what does the explorer of the NPC look like?

tired oracle
#

explorer?

tired oracle
ruby iron
#

what does the npc look like from there

tired oracle
#

The combatscriptdummy script is for later its empty

#

@ruby iron

thorny pierBOT
#

studio** You are now Level 4! **studio

ruby iron
#

@tired oracle I may have found it

#

so your entire script uses these orders

#

but it only gives it order 1

#

I've went through the script and from order 1 it never gives any new orders

#

so I'm guessing after m1 (which is linked to order 1) is the only one that plays, and then it has nothing left to do because the rest of the if else statements wont be passed

tired oracle
ruby iron
#

well I didn't read the rest of the script yet so I'm not sure what each order does, all I understood is that each order is a reply to a different order

#

so what I would do is first grab a piece of paper

#

and work out what you want the npc to do when certain things happen

#

and work it down to a few orders

#

like the classic, "Roam, attack, search" pattern

#

where the ai defaults to roaming

#

then if it sees an enemy it will attack

#

if he doesn't see the enemy it will search for him

#

then if he can't find it he will return to his roaming

ruby iron
#

it would be easiest if you can quickly just explain what order 1, 2, 3 and 4 are

#

you made it after all, so that would be the easiest way

tired oracle
#

oky

#

order 1 does the first hit
order 2 does the second hit
order 3 does the third hit
then order 4 does the last hit

#

@ruby iron do u need me to explain a little bit more or is that good

ruby iron
#

so they're all just an attack?

#

does the npc have an actual AI?

#

or is it just ordered to attack once it loads in

tired oracle
#

so when it follows a target it starts doing the m1s

ruby iron
#

then why doesn't it ever change orders past order 1?

#

as there's no code that says order = (number other then 1) that the stack can reach

tired oracle
#

Oh that it can reach

#

Im guessing it cant reach these orders @ruby iron

ruby iron
#

wait, I misread one of them, so it should actually switch to order = 2

#

(I thought it was inside a function but it was just outside it)

#

well now to me it appears that everything should be reach able, did you try stepping yet?

#

or printing to see if the stack makes it so far?

tired oracle
#

and yeah i tried printing

ruby iron
#

stepping is basically having the script run the stack, but 1 line at a time basically

#

so you can see what it tries to do

ruby iron
tired oracle
#

Only to the first one

ruby iron
#

where did it stop?

tired oracle
#

It didnt get to order 2

ruby iron
#

well then there's only 1 reason and that is probably because it never goes back to the if elses, due to the function not firing again

tired oracle
#

how would i make it fire again

ruby iron
#

basically just change it or call the function

#

(you do have to rewrite 2 lines before you can call it of course)

tired oracle
#

which 2 lines

#

@ruby iron

ruby iron
#

the one which makes the function

#

and then one that's unused to call the function

tired oracle
#

This function?

ruby iron
#

yes

tired oracle
#

@ruby iron you think you can help me with something else?

ruby iron
#

I already read your new post

#

I’m still working on my own ai

#

Basically what you need to do is:

#

Add move events to the hum to move it

#

Then force it to attack once it reaches a certain distance away from the player

#

Then running your attack script should just work

tired oracle
#

yeah but hes not damaging

ruby iron
tired oracle
thorny pierBOT
#

studio** You are now Level 5! **studio

tired oracle
#

This is the function in both the scripts

#

This is one of the variables

ruby iron
#

Which in the enemy’s case is the enemy right?

tired oracle
#

player is the npc

#

eh is the enemy

ruby iron
#

do both of them index correctly?

tired oracle
#

How do i check if they do

#

@ruby iron

ruby iron
# tired oracle

print them both right on the beginning of this anonymous function

tired oracle
#

I tried putting a print command right after the function in the damage script and it didnt print

tired oracle
ruby iron
tired oracle
#

Whats the re

ruby iron
#

remote event

tired oracle
#

How do i make it fire

#

@ruby iron

ruby iron
#

check the script that wants to fire it

#

and check if there is any reason why it isn't firing

#

wait

#

is it a Remote event or a bindable event?

tired oracle
#

Bindable im pretty sure

#

Whats the difference between the 2 again? @ruby iron

ruby iron
#

RE is server to client (and vice versa) and BE is server to server

#

(and client to client when both scripts run on the same client)

tired oracle
#

Yeah so bindable event

ruby iron
#

then why is it called remote?

tired oracle
#

Oh wait im dumb

#

its a remote event

#

fuck mb @ruby iron

ruby iron
#

😆 I remember you using an RE for the client side version

#

and I also remembered you forgetting to remove the UIS, so I figured you may have also forgotten that part as well

tired oracle
#

yeah im ku rn

#

okay so now what @ruby iron

ruby iron
#

is everything edited to house the BE?

#

remember that BEs' events differ from REs' events

tired oracle
#

Nonono the scripts use remote events not bindable

#

@ruby iron

ruby iron
#

well that's the problem

#

there is no client side scripts used in an AI

#

which client houses the AI?

tired oracle
ruby iron
#

well no

tired oracle
ruby iron
#

yes

#

also don't use local scripts for the ai

#

as there is no client for the ai

#

it's all server related

tired oracle
#

OnServerEvent is not a valid member of BindableEvent "ReplicatedStorage.CombatEventsNpc.M1RemoteNpc"

#

What do i replace with onserverevent

#

@ruby iron

ruby iron
#

.Fire = Fire and .Event = fires on event

tired oracle
#

What about for this

#

This is the damage script

#

What do i replace onserverevent for @ruby iron

ruby iron
#

.Event

tired oracle
#

Alright

#

chaosxtyy is me

#

Wait nvm

#

I did it

#

He m1s AND damages

#

tysm

#

Wait @ruby iron one last question

#

well maybe one last question

#

Instead of this activating the whole m1 script stuff

#

How do i make it so hes always m1ing

#

So hes always attacking

ruby iron
#

not character

tired oracle
#

But how do i make it so hes always attacking

ruby iron
tired oracle
ruby iron
#

well first make a basic script to check how far away the nearest player is to make sure the npc should actually be fighting

#

and then just go in and have it loop the m1 part if the player is nearby enough

tired oracle
#

I may need help with making him block every like 10-15 seconds but ill let ya rest lol

#

Ill lyk when i need help with that though

#

Ill friend you