Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Server (https://forums.graalonline.com/forums/forumdisplay.php?f=14)
-   -   Move (https://forums.graalonline.com/forums/showthread.php?t=2518)

Admins 05-10-2001 07:34 AM

Hehe trueheat no need for deleting your own
messages :-)

With the new Graal version there is the
command 'move', which is very powerful
when you want to make smoothly moving npcs.
Of course you can still move npcs by
updating the x and y position, but in most
cases you can use 'move' to get better results:

- less lag

Only the movement delta x, delta y and time
the movement takes need to be sent to the
player

- smoother movement

The npc is automatically moved on the
client side which the maximum possible
'smoothness':
all 0.05 seconds, high resolution
instead of the 0.5 tiles resolution when npc
positions are send by the npcserver, and
at constant speed

- faster server

The server still moves the npc on server-side
(so that playertouchsme etc. work correctly),
but the script itself doesn't need to be called,
and the positions doesn't need to be sent to
the players, so less work

The move command should have a maximum
compability, e.g. when a player enters the
room in the middle of a move then the server
sends the half movement so that it is correct,
and with each new move the starting position
is sent again so that the npc cannot move
to a wrong position (when there are sliglthy
differences in the resolution of the movement)

Here a nice example for a randomly walking
npc (when it hits a wall or after some time it
changes the direction):

NPC Code:

if (created) {
showcharacter;
setcharani walk,;
}
if (created || movementfinished) {
i = int(random(0,4));
len = random(2,10);
move vecx(i)*len,
vecy(i)*len,
len/8,
4+8+16;
}



You see that the command move is called
with random values for delta x and delta y,
a movement time based on the distance
of the way (8 tiles = 1 second),
and the options for stopping when hitting
a wall and calling the script again when stopped
walking (option 8 -> calls the script with
flag 'movementfinished' set). The option '16'
is for setting the direction automatically
on client-side so that the npc changes the
direction in the same moment when the new
move starts. This is not really important in this
case because it doesn't use caching, but when
you use the option '1' for caching then it
is better to let the direction automatically be
set. For random walking (+option 8) it is better
to not use caching since the the npc should
change the movement as soon as the
server sends a new movement (to anothe direction)
and not finish the current movement.

Godspeed already suggested to add a new
option: +32 for automatically animation change
(to idle,walkslow, walk, swim, depending on
if the npc moves or swims or so)

Nai 05-10-2001 07:40 AM

Hmmm, I have been having problems by the "Recording" command you can use and then copy the script from the Levels TXT file it comes in. Anyway, when I copy the script into the Scripting Area the character floats, doesnt walk, and if I make him like pull on something while I record, when I open the level for testing it, he just like goes to the rock or wall.

Admins 05-10-2001 07:42 AM

Yes the recording thing needs to be updated...

Nai 05-10-2001 07:47 AM

That would be great!

Hawk 05-10-2001 07:49 AM

I think you should make me an Administrator now Stefan :D

Psyker 05-10-2001 08:30 AM

Stefan, that sounds great.

I haven't been having any problems using the recording... :o

Nai 05-10-2001 08:55 AM

I will have to try it. It was about version 2.00 I tried it out. Now, If you don't mind, I am going to go work on my castle for my server.

KJS 05-10-2001 09:41 AM

I dont like
 
I dont like the record thingy...
it just creates a hug file that the users will have to download and makes the levels bigger and lagy. So I always use x-- or y-- (or ++) I mean it might not be as smooth but I dont really care
;-)

Well the move command seems like it will help out a lot.

Nai 05-10-2001 09:43 AM

Re: I dont like
 
Quote:

Originally posted by KJS
I dont like the record thingy...
it just creates a hug file that the users will have to download and makes the levels bigger and lagy. So I always use x-- or y-- (or ++) I mean it might not be as smooth but I dont really care
;-)

Well the move command seems like it will help out a lot.

But, that is too boring...

Admins 05-10-2001 11:22 AM

Godspeed only database npcs can walk
into other levels

Admins 05-11-2001 02:26 AM

There is already a check for -50/50 now

database npcs: npcs visible in the
npc list of a npccontrol

Hawk 05-11-2001 01:33 PM

yes there is.

Admins 05-11-2001 08:28 PM

?
You will need the npccontrol

Saga2001 11-05-2001 08:43 AM

I better start using move...

----------------------------------------------------
)happy bring back super old posts day(
if you hate me and you know it clap your hands
--- rogue shadow -tt- *c* (tcn)

JinZero 11-05-2001 08:46 AM

I guess that command would be good could if I knew how to script :D

Poogle 11-06-2001 07:41 AM

Ever notice whatever forum Stefan goes in to and talks it ends up with like 50 spam messages and 2 real meaages for the starter and Stefan!


All times are GMT +2. The time now is 11:39 AM.

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