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.