NPCs Restart when clicked

Hey everyone. On my server, I am currently having a problem. This happens on Offline Level Editor, as well as on the server. When I am in level editor, or on my server, and I click on an NPC, it then resets and starts over doing what I scripted it to do. Can anyone help me resolve this problem?

You have playerenters in the script.

But how does this interfere with clicking an NPC?

Probably because Graal sucks. lol

Show us the script?

maybe is a npc that has autodestroy

MAYBE HE SHOULD SHOW US HIS SCRIPT BECAUSE NO ONE ELSE HAS HAD THIS PROBLEM.

maybe youre right

Fuck this thread, I can’t be fucked helping now.

Tric gets mad too much now

I already said the problem.

Yea im sorry about that, I was away for a few days and couldn’t respond. Here are the scripts:

sleep 1;
message Howdy there! We thought you died!;
sleep 5;
message;
dir = 2;
sleep 1;
message Honey, he’s awake!;
sleep 4;
message;
dir = 1;
setcharani walk,; for (i=0;i<8;i++){x-=.5;sleep0.1;}
setcharani idle,;
sleep .5;
dir = 3;
sleep 50;
message Sure! I’ll go right now.;
sleep 5;
message;
dir = 2;
setcharani walk,; for (i=0;i<23;i++){y+=.5;sleep0.1;}
dir = 1;
setcharani walk,; for (i=0;i<9.5;i++){x-=.5;sleep0.1;}
dir = 2;
setcharani walk,; for (i=0;i<13;i++){y+=.5;sleep0.1;}
hide;

and this one:

if (playerenters)
disabledefmovement;

}
setcharani sit,;
sleep 9;
dir = 0;
setcharani walk,; for (i=0;i<16;i++){y-=.5;sleep0.1;}
dir = 1;
setcharani walk,; for (i=0;i<5.5;i++){x-=.5;sleep0.1;}
dir = 0;
setcharani walk,; for (i=0;i<15;i++){y-=.5;sleep0.1;}
setcharani idle,;
dir = 3;
sleep 1;
message Hi there sweety, are you alright?;
sleep 4;
message;
sleep 9;
message And what is it?;
sleep 3;
message;
sleep 5.3;
message Well, we found you unconsious on the ground.;
sleep 5;
message So, we brought you home to take care of.;
sleep 6;
message But I guess you’re better now…;
sleep 5;
message Oh wait! I forgot something!;
sleep 5;
message;
dir = 1;
sleep 1;
message Dear, can you pick up my package for me?;
sleep 5;
message;
sleep 7;
dir = 2;
sleep 5;
dir = 3;
sleep 1;
message So, are you feeling fine now?;
sleep 4;
message;
sleep 6;
message Of course!;
sleep 3;
message;
dir = 1;
setcharani walk,; for (i=0;i<7.5;i++){x-=.5;sleep0.1;}
setcharani idle,;
dir = 3;

enabledefmovement;
sleep 2;
message Before you leave,;
sleep 4;
message make sure to vist Mr. Dovajun,;
sleep 5;
message he lives next door in the blue house!;
sleep 4;

whyyyyyyyyy is everything outside of a bracket…?

I don’t know, lemme try it with brackets[COLOR=“Silver”]

---------- Post added at 04:04 PM ---------- Previous post was at 04:00 PM ----------

[/COLOR]I tried it with brackets, didn’t fix it though

What events trigger this? Without conditions it defaults to something or maybe everything. Put it in if playerenters so it wont get confused.

Code outside a conditional statement will be called anytime that npc’s looked at either using callnpc or another event. This would be why your npc appears to be resetting.

way to spoil your servers plot omg now im not playing

In Graal, when something happens to an NPC that changes a condition or a flag, the entire script is ran through from top to bottom.

When you click on it, it runs the script over from top to bottom. You should be wrapping your code in conditional statements that prevents code from executing if the desired action is not occuring.

In your specific case, when you click on the NPC, there’s a flag that’s telling the NPC that it’s being clicked being set and unset when the frame ends.

You should be wrapping your code in a conditional statement that would only cause it to occur when the desired action has happened. In your case, it would seem like you want that to happen when the player enters, so wrap your code in if (playerenters) {…}

Well everyone I fixed it yesterday, with the help of Tricxta, thanks tricxta