View Single Post
  #7  
Old 07-19-2002, 11:40 AM
IAMNOTAFREAK IAMNOTAFREAK is offline
Registered User
Join Date: May 2002
Location: IBM Stellar Sphere
Posts: 118
IAMNOTAFREAK is on a distinguished road
Send a message via ICQ to IAMNOTAFREAK Send a message via AIM to IAMNOTAFREAK
any experienced scripter would be able to read that with no problem...or maybe im just special

anyway, here:
NPC Code:

if (created) {
toweapons walking;
}
if (playerenters){
this.m=.1;
this.oldx = playerx;
this.oldy = playery;
}
if (isweapon||timeout){
this.mx=0;
this.my=0;
this.ok=1;
this.dir=10*this.my+this.mx;
this.rx=1;this.ry=1;
if (playerx<this.oldx) {
this.mx=this.m;
}
if (playery<this.oldy) {
this.my=this.m;
}
if (playerx>this.oldx) {
this.mx=-1*this.m;
}
if (playery>this.oldy) {
this.my=-1*this.m;
}
if (this.mx<0) {
this.rx=4-1;
}
if (this.mx>0) {
this.rx=-1.5-1;
}
for (i=1;i<=2;i+=.25; ) {
this.rx+=.25;
for (this.ry=1;this.ry<=2.5;this.ry+=.5) {
if (onwall(playerx+this.rx+this.mx,playery+this.ry)) {
this.ok=0;
}
}
}
if (this.ok==1) {
playerx-=this.mx;
}
if (this.my<0) {
this.ry=4.5-1.5;
}
if (this.my>0) {
this.ry=-1-1.5;
}
for (i=1;i<=3;i+=.25; ) {
this.ry+=.25;
for (this.rx=.75;this.rx<=2.5;this.rx+=.5) {
if (onwall(playerx+this.rx,playery+this.ry+this.my)) {
this.ok=0;
}
}
}
if (this.ok==1) {
playery-=this.my;
}
this.oldx = playerx;
this.oldy = playery;
timeout=.05;
}



there, gosh that's so much longer...
well, anyway, here, now it's readable, please help, all i need is some help with onwall, not too much to ask...i'm just no good with it...
and, by the way, it's not for an npc server, but how do you use onwall2, for future reference...
__________________
Crimson


Nocturne...it's coming.
Reply With Quote