Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > NPC Server
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-10-2001, 07:34 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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)
  #2  
Old 05-10-2001, 07:40 AM
Nai Nai is offline
Back!
Join Date: Mar 2001
Location: USA
Posts: 1,489
Nai is on a distinguished road
Send a message via AIM to Nai
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.
__________________
  #3  
Old 05-10-2001, 07:42 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Yes the recording thing needs to be updated...
  #4  
Old 05-10-2001, 07:47 AM
Nai Nai is offline
Back!
Join Date: Mar 2001
Location: USA
Posts: 1,489
Nai is on a distinguished road
Send a message via AIM to Nai
That would be great!
__________________
  #5  
Old 05-10-2001, 07:49 AM
Hawk Hawk is offline
??
Hawk's Avatar
Join Date: Mar 2001
Location: Canada B.C
Posts: 1,374
Hawk will become famous soon enough
Send a message via ICQ to Hawk Send a message via AIM to Hawk Send a message via Yahoo to Hawk
I think you should make me an Administrator now Stefan
__________________
email--hawk at graal.net
AIM--Hawx0rz

waiting upon graal2001 //
  #6  
Old 05-10-2001, 08:30 AM
Psyker Psyker is offline
Tired Sloth
Join Date: Mar 2001
Posts: 6,217
Psyker will become famous soon enough
Send a message via AIM to Psyker Send a message via Yahoo to Psyker
Stefan, that sounds great.

I haven't been having any problems using the recording... :o
__________________
  #7  
Old 05-10-2001, 08:55 AM
Nai Nai is offline
Back!
Join Date: Mar 2001
Location: USA
Posts: 1,489
Nai is on a distinguished road
Send a message via AIM to Nai
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.
__________________
  #8  
Old 05-10-2001, 09:41 AM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Cool 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.
__________________
Thanks,
-KJL
  #9  
Old 05-10-2001, 09:43 AM
Nai Nai is offline
Back!
Join Date: Mar 2001
Location: USA
Posts: 1,489
Nai is on a distinguished road
Send a message via AIM to Nai
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...
__________________
  #10  
Old 05-10-2001, 11:22 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Godspeed only database npcs can walk
into other levels
  #11  
Old 05-11-2001, 02:26 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
There is already a check for -50/50 now

database npcs: npcs visible in the
npc list of a npccontrol
  #12  
Old 05-11-2001, 01:33 PM
Hawk Hawk is offline
??
Hawk's Avatar
Join Date: Mar 2001
Location: Canada B.C
Posts: 1,374
Hawk will become famous soon enough
Send a message via ICQ to Hawk Send a message via AIM to Hawk Send a message via Yahoo to Hawk
yes there is.
__________________
email--hawk at graal.net
AIM--Hawx0rz

waiting upon graal2001 //
  #13  
Old 05-11-2001, 08:28 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
?
You will need the npccontrol
  #14  
Old 11-05-2001, 08:43 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
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)
  #15  
Old 11-05-2001, 08:46 AM
JinZero JinZero is offline
something vague
Join Date: Mar 2001
Location: pokemon
Posts: 1,384
JinZero is on a distinguished road
Send a message via AIM to JinZero
I guess that command would be good could if I knew how to script
__________________
there's. no. retreat.
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:58 PM.


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