Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-15-2005, 05:01 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
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

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.

Last edited by JkWhoSaysNi; 03-15-2005 at 05:14 PM..
Reply With Quote
  #2  
Old 03-15-2005, 06:04 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
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.
Reply With Quote
  #3  
Old 03-15-2005, 06:19 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Thanks. But which is the server side move command?
Reply With Quote
  #4  
Old 03-15-2005, 08:44 PM
Gman4pwnu Gman4pwnu is offline
Banned
Join Date: Jan 2004
Posts: 434
Gman4pwnu is on a distinguished road
Send a message via AIM to Gman4pwnu
the command is called move.
Reply With Quote
  #5  
Old 03-16-2005, 02:14 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
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:

move 20,0,3,;
timeout = 3;
if (timeout) move 0,20,3,;




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.
Reply With Quote
  #6  
Old 03-16-2005, 02:46 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by JkWhoSaysNi
Can anyone explain what i'm doing wrong here?
You're not following KSI-GS.
__________________
Reply With Quote
  #7  
Old 03-16-2005, 03:01 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Ok... thanks.

I've changed it to this:

NPC Code:
if (created) {
move 20,0,3,;
timeout = 3;
if (timeout) move 0,20,3,;
}



Now it halts after the first move command.
Reply With Quote
  #8  
Old 03-16-2005, 03:04 AM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
if (timeout) is an event...
if (created) is also an event...

The two can not and should not be stacked inside each other.
__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote
  #9  
Old 03-16-2005, 03:06 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
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:

if (created) {
move 20,0,3,;
sleep 3;
move 0,20,3,;
}
//#CLIENTSIDE
//some stuff controlling how the npc looks



With this, the NPC is never even shown. It might be being moved, but i cant see it.

Last edited by JkWhoSaysNi; 03-16-2005 at 03:22 AM..
Reply With Quote
  #10  
Old 03-16-2005, 03:21 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by JkWhoSaysNi
Ok.... So how can i make it wait three seconds before executing the next move statement?
Read move's documention in the relevant newfeatures.txt.
__________________
Reply With Quote
  #11  
Old 03-16-2005, 03:54 AM
BlueDevil BlueDevil is offline
Registered User
Join Date: Feb 2005
Posts: 10
BlueDevil is on a distinguished road
don't you put + or - signs in front of the numbers to tell it which way to go?
Reply With Quote
  #12  
Old 03-16-2005, 04:10 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
Quote:
Originally Posted by BlueDevil
don't you put + or - signs in front of the numbers to tell it which way to go?
a number without a + or - sign is considered to be positive
__________________

Reply With Quote
  #13  
Old 03-16-2005, 03:51 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Ok, I read up on the move command and newfeatures.txt says this should work:

NPC Code:
if (created) {

move 20,0,3,;

sleep 3;

move 0,20,3,;

}

//#CLIENTSIDE

//some stuff controlling how the npc look



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.
Reply With Quote
  #14  
Old 03-16-2005, 06:02 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by JkWhoSaysNi
it doesnt even show the NPC
showcharacter.
__________________
Reply With Quote
  #15  
Old 03-16-2005, 06:13 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
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 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.
Reply With Quote
Reply


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 10:42 PM.


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