![]() |
Converting old scripts to NPCs sripts?
I'm trying to convert the default walk in a rectangle NPC script to work on an NPC server but i dont know where to begin :p
What do I need to change to get it to work on an NPCs? Are there any tutorials on this anywhere? I found out i can add clientside at the top to make it clientside, but doesnt this mean every client could potentially see different things? I'm implementing random in the script so that it isnt always a the same sized rectangle. Will random calculate differently on each client? If so, how can i make it run server side so all the clients see the same? Thanks. |
You'll probably want to make the NPC serverside if you want all players seeing the same thing, and for making the NPC move you'll want to use the serverside move command.
|
Thanks. But which is the server side move command? ;)
|
the command is called move.
|
Thankyou. I saw that but it looked more complicated than what i had and diddnt want to spend all the time converting the script only to find out it diddnt work server side.
I'm having some problems with it though. Specifically, chaining two together. After figuring out that it was acting like vectors rather than taking the co-ords as map positions i tried this: NPC Code: I expected this to move the npc across 20 over a duration of 3 seconds, then down 20 over a duration of three seconds. However, what it does is move the npc across 20 over 3 seconds, then jump it another 20 (approx) without any time in between, then move down 20 over 3 seconds. Can anyone explain what i'm doing wrong here? I'm using timeout to count down the three seconds that the npc is moving for because i couldnt see a better way. Is there a way of waiting until the last command is finished before executing the next one? Also, is there any way to give functions arguements? I tried the c++ way (function myFunction(myarg) {}) but it gave me a syntax error. |
Quote:
|
Ok... thanks.
I've changed it to this: NPC Code: Now it halts after the first move command. |
if (timeout) is an event...
if (created) is also an event... The two can not and should not be stacked inside each other. |
Ok.... So how can i make it wait three seconds before executing the next move statement?
Edit: I just found the sleep command :P It still doesnt work though. This is my script: NPC Code: With this, the NPC is never even shown. It might be being moved, but i cant see it. :frown: |
Quote:
|
don't you put + or - signs in front of the numbers to tell it which way to go?
|
Quote:
|
Ok, I read up on the move command and newfeatures.txt says this should work:
NPC Code: Except it doesnt even show the NPC when the sleep command is in there. What's wrong with this? It's the same as the example. |
Quote:
|
Thanks. I had that in the clientside section. Surely all the visuals should be handled by the client though? I assumed the actions would be serverside and the way it looked would be handled clientside. However, its starting to make sense to me now :D If the npc is server side, the server controls whether the npc is visible and how it looks.
Thanks. Now i think i understand gscript a bit better. |
| All times are GMT +2. The time now is 01:33 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.