![]() |
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: - 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: 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. |
cool...
|
lol......that means i have to go back and fix all the npcs i will be using.....oh well......
|
i have a question, when doing a setshape, if you touch it, will it automatically work or do you still need to push a key to make sure you're touching it?
like in those gravity rooms, lets say an npc will lay a pack of darts, with playertouchsme, dropping on the npc doesnt do a thing, will setshape remove that sort of a glitch? i hope this example was clear enough, i dont really know how to describe it |
? what do you mean?
|
erm.. from what i can see the playertouchsme command doesnt check for x and y it checks to see if the player is going on the npc with the arrow keys, so if you move the player with an npc it wont do the playertouchsme unless you try to move with the arrows. I was wondering if setshape checks to see if part of the 3x3 tiles of the player is on the npc or if we still need to walk on that npc with the arrows. i know its hard to understand but its also hard to explain
|
Normally the server checks for playertouchsme
each time the player moves; but the player must touch the npc with his front (depending on the direction) |
hmm so ill still have to use
e.g: if(int(playery)<=y+10) to check if the player is actually touching the npc without moving |
Lmao you do confuse
I think i know what you mean saying that if (playersx<x+2.5&&playersx>x-.5&&playery<y+3.5&&playery>y-.5) { using this to detect if the npcs actualy is touching an area where the player is located correct? }
|
Well if thats what ur askin noperz the setshape will not detect that it will only detect if the player is moving and facing most of the time so sometimes its better to make ur own detection script heheh this one here will work in a timeout loop if its client side if u want to use it that is if i did it correctly not sure it will pick up i think around a 32*48 object i wasnt paying attention to what i was typing
|
Bah, the only reason im confusing is because i can't think right in english, i wouldnt be confusing if i would be typing in french but then almost no one would understand ; )
anyways, i solved my problem |
stefan, lets say you have the script (this is a simplified version to show a point)
timeout = 0.1; if (timeout) { timeout = 0.1; setstring server.blah,#v(this.x); } //#CLIENSIDE timeout = 0.05; if (timeout) { timeout = 0.05; if (keydown(6)) { this.x = 5; } } in a nutshell, i need server.blah to = this.x.... but for some reason it doesnt work..also keydown doesnt work server side, so i must make it client side.... |
Soul Blade, I'd like to be able to do the same thing...but it isn't possible. Use the save[index] variables...there's 10 of them, and they work (at least I'm sure you can set them server-side and send to client-side)
|
thnx kyle...i was having a hard time figuring that out, i guess i can stop now....ive never heard of save[index] stuff...can you please explain?
|
Wowow
Ok save[i] vars are variables used in npc of course but they can be easily called and checked by other npcs as well as they are called by npcs[i].save[i] to check values its what is used in the blue rocks on faheria D/l the beachside4 where i added the new compatible ones and look at the script it will help better than it can be explained =P
|
Yes save[0..9] are variables good especially on
client-side where you don't have with() Those variables are also sent to the client, I have used them in the railtracks npcs to tell the player what kind of railroad track the npc is. When changed on client-side its not sent back to the npcserver though (because the npc is protected against modifications by the clients) |
| All times are GMT +2. The time now is 05:51 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.