Graal Forums  

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

 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 01-29-2002, 06:46 AM
Cyber-X Cyber-X is offline
Registered User
Join Date: Nov 2001
Location: Brazil
Posts: 117
Cyber-X is on a distinguished road
Send a message via ICQ to Cyber-X Send a message via AIM to Cyber-X
Question Scripting with NPC Server offline!

How can I script a NPC to a p2p server that is not up yet??? What are the basic commands??? Like this... I want to script these NPCs to work in a p2p server... How can I do???

// NPC Made by CyberX
if(playerenters){
this.power=0;
}
if (actionlumbing) {
message #v(this.power)% done;
lumbpower = strtofloat(#p(0));
this.power +=lumbpower;
sleep 0.05;
putleaps 3,x+2,y;
}
if (this.power=100) {
message 100% done.;
putleaps 3,x,y;
putleaps 3,x+1,y;
putleaps 3,x+2,y;
putleaps 3,x+3,y;
putleaps 3,x+4,y;
sleep 0.05;
this.plus=1+strtofloat(#s(client.lumber));
setstring client.lumber,#v(this.plus);
say2 Total of wood: #s(client.lumber);
destroy;
}




and




// NPC made by CyberX
if (strtofloat(#s(client.lumber))>19) {
set wood1;
}
if (playertouchsme&&!wood1) {
say2 Not enough wood!;
}
if (playertouchsme&&wood1&&money1) {
say2 You've already gotten a
#bwoodpack!
}
if (playertouchsme&&w1) {
say2 You've already gotten a
#bwoodpack!
}
if (playertouchsme&&wood1&&!w1&&!w2&&!money1&&!money2 ) {
timeout = 1;
putleaps 3,x+2,y;
this.less=strtofloat(#s(client.lumber))-20;
setstring client.lumber,#v(this.less);
set w1;
freezeplayer 3;
}
if (timeout) {
putleaps 3,x+2,y;
}
__________________
  #2  
Old 01-29-2002, 06:57 AM
Faheria_GP2 Faheria_GP2 is offline
Banned
Faheria_GP2's Avatar
Join Date: Oct 2001
Posts: 1,177
Faheria_GP2 is on a distinguished road
Re: Scripting with NPC Server offline!

NPC Code:

// NPC Made by CyberX
if(playerenters){
this.power=0;
}
if (actionlumbing) {
message #v(this.power)% done;
lumbpower = strtofloat(#p(0)); //See line below
this.power +=lumbpower; //These two lines could be compacted into one
sleep 0.05; //Minimuim sleep/timeout is 0.1
putleaps 3,x+2,y;
}
if (this.power=100) { //this should be inside an event
message 100% done.;
putleaps 3,x,y;
putleaps 3,x+1,y;
putleaps 3,x+2,y;
putleaps 3,x+3,y;
putleaps 3,x+4,y;
sleep 0.05; //Minimum sleep/timeout is 0.1
this.plus=1+strtofloat(#s(client.lumber)); //This
setstring client.lumber,#v(this.plus); //and this could be compacted into one line
say2 Total of wood: #s(client.lumber);
destroy;
}


NPC Code:

// NPC made by CyberX
if (strtofloat(#s(client.lumber))>19) { //Should be inside an event
set wood1;
}
if (playertouchsme&&!wood1) {
say2 Not enough wood!;
}
if (playertouchsme&&wood1&&money1) {
say2 You've already gotten a
#bwoodpack!
}
if (playertouchsme&&w1) {
say2 You've already gotten a
#bwoodpack!
}
if (playertouchsme&&wood1&&!w1&&!w2&&!money1&&!money2 ) {
timeout = 1;
putleaps 3,x+2,y;
this.less=strtofloat(#s(client.lumber))-20; //See below
setstring client.lumber,#v(this.less); //These two could be compacted into one line
set w1;
freezeplayer 3;
}
if (timeout) {
putleaps 3,x+2,y;
}



there, I have added comments where corrections are necessary, fix that up, and it should work inside NPC-Server
  #3  
Old 01-29-2002, 07:25 AM
Cyber-X Cyber-X is offline
Registered User
Join Date: Nov 2001
Location: Brazil
Posts: 117
Cyber-X is on a distinguished road
Send a message via ICQ to Cyber-X Send a message via AIM to Cyber-X
what do you mean with "should be inside an event"???
__________________
  #4  
Old 01-29-2002, 07:51 AM
Faheria_GP2 Faheria_GP2 is offline
Banned
Faheria_GP2's Avatar
Join Date: Oct 2001
Posts: 1,177
Faheria_GP2 is on a distinguished road
events are things like

if (playerenters)
if (playertouchsme)

events are not things like

if (issparringzone)
if (keydown(i))
  #5  
Old 02-08-2002, 01:08 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Quote:
Originally posted by Faheria_GP2
events are things like

if (playerenters)
if (playertouchsme)

events are not things like

if (issparringzone)
if (keydown(i))
actually keydown(i) is an event.
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
  #6  
Old 02-08-2002, 02:03 AM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
-=Josey=-
Keydown is a function. It's called locally by the client's Graal.exe. An event is called by the NPC or a server. Correct me if I'm wrong here anyone.
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
  #7  
Old 02-08-2002, 03:08 AM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
-=Josey=-
Heh, I wasn't looking for a "better word", I was looking for a correct answer.
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
  #8  
Old 02-08-2002, 11:13 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
i wish stefan would make keydown a event, instead of a function
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
  #9  
Old 02-08-2002, 12:13 PM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
The problem most people don't understand is that NPCs don't run CONSTANTLY. They run only when they need to. So if you got a NPC with this code:
NPC Code:

if (created) showcharacter;
if (keydown(0)) say2 Blah;


The
if(keydown(0))
will ONLY work if the NPC is activated while the player is hold down the UP key. People put keydown() in loops because the script is ACTIVE and it will pick up the keydown. I hope somebody can help me on this. Wanna give it a try Kaimetsu?
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
  #10  
Old 02-09-2002, 12:19 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Actually also you can do this i remember:
NPC Code:

if (created||playerenters) {
timeout=.05;
}
if (timeout) timeout=.05;
if (keydown(0)) message hi;


because it was activated and than it was continuing...right?

sorry about the keydown(i) i was kinda tired, now i realixe cause you can't call it alone.
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
  #11  
Old 02-09-2002, 07:02 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
Quote:
Originally posted by Kaimetsu
Pretty much what Boco said, but reworded
Yes, thanks. I was having trouble wording it. XD
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
 


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 01:29 PM.


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