Graal Forums  

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

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-19-2001, 05:03 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
Converting NPCs

A lot of servers have the npcserver now.
Some tips for converting scripts to work with
the npcserver:

- client-side scripts:

By default all code is running on the npcserver. But some stuff must be done client-side because the commands just don't exist on the npcserver, because they are just graphical or are playing sound effects. This means you need to change the scripts for lights, then it will look like this:

NPC Code:

if (created)
dontblock;

//#CLIENTSIDE

if (playerenters) {
setcoloreffect 1,0,0,0.99;
setzoomeffect 2;
drawaslight;
}



- playertouchsme:

The server doesn't load images or ganis to exactly detect if a player touchs an npc. To let the server know how big (in pixels) an npc is you can use the setshape command:

NPC Code:

if (created)
setshape 1,32,32;
if (playertouchsme)
playerrupees++;



This script would give the player one gralat when he touchs the npcs. 32x32 would be the size of a door (2x2 tiles since each tile is 16x16). The first parameter (1) is for specifying what kind of shape the npc has, currently only 1 (for tectangle) is supported.

- old commands:

Some people still use script commands that are not supported anymore. While Graal.exe still supports them (for compatibility), the npcserver ignores such commands. This is mainly 'playersays(text)', which can be replaced with 'playerchats && strequals(#c,text)'. Also 'setlevel' doesn't work, use the better command 'setlevel2' instead

- timeouts:

The minimum timeout for the npcserver is 0.1, while it is 0.05 secs in Graal.exe. The reason is that because of lag a more precise timeout wouldn't make sense, and it saves CPU time.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 06:44 PM.


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