#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 what do you mean which m1?
wait, why are you using userinputservice inside an AI?
there is no user
@tired oracle
yeah it didnt but i deleted anyway
what does the explorer of the NPC look like?
explorer?
wdym explorer
** You are now Level 4! **
@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
so what can i do to fix it?
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
are u going to or nah
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
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
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
Once it has a target to follow it attacks
so when it follows a target it starts doing the m1s
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
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?
stepping? wdym
and yeah i tried printing
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
how far did it get?
Only to the first one
where did it stop?
It didnt get to order 2
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
how would i make it fire again
basically just change it or call the function
(you do have to rewrite 2 lines before you can call it of course)
script.Parent.Follow.Changed:Connect(function()
This function?
yes
@ruby iron you think you can help me with something else?
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
yeah but hes not damaging
Does it connect correctly to the hum?
** You are now Level 5! **
Which in the enemy’s case is the enemy right?
do both of them index correctly?
print them both right on the beginning of this anonymous function
I tried putting a print command right after the function in the damage script and it didnt print
but when i put a print command before the function it did print
then the RE doesn't fire
remote event
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?
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)
Yeah so bindable event
then why is it called remote?
😆 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
is everything edited to house the BE?
remember that BEs' events differ from REs' events
well that's the problem
there is no client side scripts used in an AI
which client houses the AI?
so dont use remote events?
well no
should i just use a bindable events then?
yes
also don't use local scripts for the ai
as there is no client for the ai
it's all server related
OnServerEvent is not a valid member of BindableEvent "ReplicatedStorage.CombatEventsNpc.M1RemoteNpc"
What do i replace with onserverevent
@ruby iron
.Fire = Fire and .Event = fires on event
What about for this
This is the damage script
What do i replace onserverevent for @ruby iron
.Event
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
right now I'm tired but I would just loop
How would i do that
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
Alright thanks man
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