Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Stop move()? (https://forums.graalonline.com/forums/showthread.php?t=134267081)

Starfire2001 09-07-2012 07:25 PM

Stop move()?
 
Is there an easy way to stop a move() before it finishes? Like for instance, a block will move to the right until the player chats something, at which point it will just stop moving entirely and it's x value will be the x value that it stopped at.

Emera 09-07-2012 07:27 PM

Not an expert, and I've not used move() a lot, but would calling it again cancel the previous one?

Starfire2001 09-07-2012 07:41 PM

Quote:

Originally Posted by Emera (Post 1703290)
Not an expert, and I've not used move() a lot, but would calling it again cancel the previous one?

Nah, depending on what integer you put for the 4th parameter it will do one of a few things when you call move again, none of which seem to be what I want.

TServerNPC.move(float, float, float, int) - moves the npc smoothly, parameters are delta x, delta y, time and options: cache type (0, 1-cache, 2-append) + blockcheck(4) + eventwhendone(8) + applydir(16)

DustyPorViva 09-07-2012 07:57 PM

Have you tried:

move(this.x,this.y,0,0+8);

Since 0 does not cache or append movement it may just overwrite already existing movement caches and stop it.

Cubical 09-07-2012 08:01 PM

You could always use a timeout and move the x of the object until the player chats. II don't know exactly what you're trying to accomplish so its hard to tell the best way to go about it.

Starfire2001 09-07-2012 08:11 PM

Quote:

Originally Posted by DustyPorViva (Post 1703293)
Have you tried:

move(this.x,this.y,0,0+8);

Since 0 does not cache or append movement it may just overwrite already existing movement caches and stop it.

Nope, it just instantly finishes the current movement and starts the next one from there. :(

Quote:

Originally Posted by Cubical (Post 1703294)
You could always use a timeout and move the x of the object until the player chats. II don't know exactly what you're trying to accomplish so its hard to tell the best way to go about it.

Yeah, there are other ways I can go about what I'm doing. Just would have been simplest to do it this way.

Guessing there probably just isn't a way. Thanks everyone.

ffcmike 09-07-2012 08:13 PM

Doesn't manually editting X/Y automatically stop move();?

this.x = this.x;

Starfire2001 09-07-2012 08:14 PM

Quote:

Originally Posted by ffcmike (Post 1703297)
Doesn't manually editting X/Y automatically stop move();?

this.x = this.x;

Wow it totally does. Thanks a bunch.

Must spread rep around :(

cbk1994 09-08-2012 03:21 AM

Quote:

Originally Posted by Cubical (Post 1703294)
You could always use a timeout and move the x of the object until the player chats. II don't know exactly what you're trying to accomplish so its hard to tell the best way to go about it.

move is generally preferable to a timeout because it synchronizes the movement between serverside and clientside for smooth movement even if you have high latency.

Tricxta 09-08-2012 04:07 AM

Quote:

Originally Posted by cbk1994 (Post 1703325)
move is generally preferable to a timeout because it synchronizes the movement between serverside and clientside for smooth movement even if you have high latency.

That's pretty cool. Someone needs to put together a guide highlighting the advantages of using certain methods for certain applications(not all applications, but the most general, movement/search/etc...).

Felix_Xenophobe 09-08-2012 06:17 PM

have you tried hammer time


All times are GMT +2. The time now is 03:00 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.