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-17-2003, 12:24 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Moving Class

I want to help out the Graal community so I will be posting things for playerworld to use.

This class can be used for NPCs to move around:
NPC Code:

/*****************************
* name: people *
* type: class *
* by: Trevor (Scripter) *
*****************************/
canwarp;
if(timeout){

if(this.step>=arraylen(this.moveVecX)){
this.step=0;
dir=this.moveDirC[0];
this.distWent=0;
x=this.baseX;
y=this.baseY;
}

if(dir==1||dir==3){
if(this.distWent>=abs(this.moveVecX[this.step])){
this.distWent=0;
this.step++;
dir=this.moveDirC[this.step];
}
}else if(dir==0||dir==2){
if(this.distWent>=abs(this.moveVecY[this.step])){
this.distWent=0;
this.step++;
dir=this.moveDirC[this.step];
}
}

this.nX=x+vecx(dir)*(this.speed/2);
this.nY=y+vecy(dir)*(this.speed/2);

this.testP=testplayer(this.nX+1.5+vecx(dir),this.n Y+2+vecy(dir));
if(this.testP>=0){
setcharani idle,;
this.messageOn=true;
this.message=1;
doMessage();
if(this.hold==false){
this.hold=true;
}
}else{this.hold=false; message;}

if(this.hold==false){
setcharani walk,;
move this.nX-x,this.nY-y,.1,2+16;
this.distWent+=(this.speed/2);
}
timeout=.1;
}

function doMessage()
{
if(this.messageOn==true){
if(this.message==1){
message #R(#s(this.message));
this.message=-1;
}
sleep4;
this.messageOn=false;
}
}



Here is an example DBNPC for the class:
NPC Code:

join people;
if (initialized) {
showcharacter;
setcharprop #C0,orange;
setcharprop #C1,darkblue;
setcharprop #C2,blue;
setcharprop #C3,black;
setcharprop #C4,black;
setcharprop #n,*Debbie (Police);
setcharprop #2,shield3.gif;
setcharprop #3,head21.png;
setcharprop #8,body4.png;
setcharprop #P1,hat92.png;
setcharprop #1,zeroriotstick-sword.png;
shieldpower=1;
this.speed=1;
ap=100;
this.moveVecX={ 4, 0, -4, 0}
this.moveVecY={ 0, 4, 0, -4}
this.moveDirC={ 3, 2, 1, 0}
dir=this.moveDirC[0];
this.step=0;
this.baseX=x; // You may want to change this var to the start x
this.baseY=y; // ""-x + y
timeout=.1;
setstring this.message,Welcome to Graal2001!,Enjoy your stay :),Hope you have fun here at Graal2001;
}



You can use both of these freely as long as you keep the credits in the script.
__________________
new account: Trevor
Reply With Quote
  #2  
Old 03-17-2003, 04:46 AM
ShadowDarkstar ShadowDarkstar is offline
Registered User
ShadowDarkstar's Avatar
Join Date: Feb 2003
Location: Montreal
Posts: 42
ShadowDarkstar is on a distinguished road
err...
what is '#R'?
=X
Reply With Quote
  #3  
Old 03-17-2003, 06:03 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Quote:
Originally posted by ShadowDarkstar
err...
what is '#R'?
=X
I think it's required for the DBNPC to read it. I'm not sure, I've never seen it before either.
Reply With Quote
  #4  
Old 03-17-2003, 06:44 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by Kaimetsu
'#R(string)' is equivalent to '#I(string,int(random(0,sarraylen(string)))'
Ding ding ding! It is one of those things unless you talk to people on debug (Jagen in particularly) you would never know about it. Becasue, Stefan documents nothing.
__________________
new account: Trevor
Reply With Quote
  #5  
Old 03-17-2003, 08:43 AM
PastAustin PastAustin is offline
Registered User
Join Date: Mar 2003
Location: Littleton, Colorado, US
Posts: 91
PastAustin is on a distinguished road
Send a message via ICQ to PastAustin Send a message via AIM to PastAustin
Quote:
Originally posted by tlf288


Ding ding ding! It is one of those things unless you talk to people on debug (Jagen in particularly) you would never know about it. Becasue, Stefan documents nothing.
I am sure Stefan resents that.
*cough* Though it is true. *cough*
__________________
"...I'm going to burn this place down..."
-Milton
Reply With Quote
  #6  
Old 03-17-2003, 06:30 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by PastAustin


I am sure Stefan resents that.
*cough* Though it is true. *cough*

Possibly, although it's still at least partially true.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #7  
Old 03-17-2003, 06:33 PM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by adam



Possibly, although it's still at least partially true.
Partially? He doesn't document ANYTHING now'a'days.
__________________
new account: Trevor
Reply With Quote
  #8  
Old 03-20-2003, 08:32 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
He should keep a log somewhere, maybe like a journal... people would know what he did with his time or he could at least say "-added #R today"
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #9  
Old 03-20-2003, 10:18 AM
PastAustin PastAustin is offline
Registered User
Join Date: Mar 2003
Location: Littleton, Colorado, US
Posts: 91
PastAustin is on a distinguished road
Send a message via ICQ to PastAustin Send a message via AIM to PastAustin
Quote:
Originally posted by HoudiniMan
He should keep a log somewhere, maybe like a journal... people would know what he did with his time or he could at least say "-added #R today"
lol that sounds almost comical, I can see it now, "Stefan's Adventure Log: The Lost Tales of Nice but Unknown Scripting Commands". Sure that would work out well. I think that he should get a documentor who would document for him.
__________________
"...I'm going to burn this place down..."
-Milton
Reply With Quote
  #10  
Old 03-20-2003, 11:15 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by PastAustin

I think that he should get a documentor who would document for him.
Documentor (secretary) requires money. Of which Stefan has no extra.
__________________
new account: Trevor
Reply With Quote
  #11  
Old 03-20-2003, 11:23 AM
PastAustin PastAustin is offline
Registered User
Join Date: Mar 2003
Location: Littleton, Colorado, US
Posts: 91
PastAustin is on a distinguished road
Send a message via ICQ to PastAustin Send a message via AIM to PastAustin
Quote:
Originally posted by tlf288


Documentor (secretary) requires money. Of which Stefan has no extra.
He doesn't pay anyone else, like PWAs / Global Admins, why would he pay this person?
__________________
"...I'm going to burn this place down..."
-Milton
Reply With Quote
  #12  
Old 03-20-2003, 06:17 PM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by PastAustin


He doesn't pay anyone else, like PWAs / Global Admins, why would he pay this person?
For this person to document stuff they would have to be in his office. This would be a real life job.
__________________
new account: Trevor
Reply With Quote
  #13  
Old 03-20-2003, 06:27 PM
PastAustin PastAustin is offline
Registered User
Join Date: Mar 2003
Location: Littleton, Colorado, US
Posts: 91
PastAustin is on a distinguished road
Send a message via ICQ to PastAustin Send a message via AIM to PastAustin
Quote:
Originally posted by tlf288


For this person to document stuff they would have to be in his office. This would be a real life job.
Not true. Jagen is on debug and he knows a lot of this stuff. I'd love to do something like that, just go though scripts and try to find new things...
__________________
"...I'm going to burn this place down..."
-Milton
Reply With Quote
  #14  
Old 03-20-2003, 09:59 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by Kaimetsu
'#R(string)' is equivalent to '#I(string,int(random(0,sarraylen(string)))'
XD! I suggested that a long time ago, never even knew it was added
__________________

Reply With Quote
  #15  
Old 03-21-2003, 04:46 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Quote:
Originally posted by PastAustin


lol that sounds almost comical, I can see it now, "Stefan's Adventure Log: The Lost Tales of Nice but Unknown Scripting Commands". Sure that would work out well. I think that he should get a documentor who would document for him.
If he couldn't keep a log, why would he tell somebody on graal that he hired?
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

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 09:36 AM.


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