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 05-20-2001, 03:01 AM
Guest
Posts: n/a
Thumbs up

Well, I made all that I can of that script, I tryed to do the bouncing part but it didn't work out so good.


NPC Code:

// NPC made by Ice Pick
canbecarried;

//left wall action
if(onwall(x,y) && !onwall(x+4,y))
{
x+=1.5;
y+=.25;
sleep .05;
x+=1.4;
y+=.25;
sleep .05;
x+=1.3;
y+=.25;
sleep .05;
x+=1.2;
y+=.25;
sleep .05;
x+=1.06;
y+=.25;
sleep .05;
x+=.9;
y+=.25;
sleep .05;
x+=.7;
y+=.25;
sleep .05;
x+=.5;
y+=.25;
sleep .05;
//bounce again...
x+=.3;
y-=.5;
sleep .05;
x+=.3;
y-=.35;
sleep .05;
x+=.3;
y-=.15;
sleep .05;
x+=.3;
y-=.05;
sleep .05;
x+=.3;
y+=.05;
sleep .05;
x+=.3;
y+=.15;
sleep .05;
x+=.3;
y+=.35;
sleep .05;
x+=.3;
y+=.5;
sleep .05;

}


//right wall action
if(onwall(x+2,y) && !onwall(x-2,y))
{
x-=1.5;
y+=.25;
sleep .05;
x-=1.4;
y+=.25;
sleep .05;
x-=1.3;
y+=.25;
sleep .05;
x-=1.2;
y+=.25;
sleep .05;
x-=1.06;
y+=.25;
sleep .05;
x-=.9;
y+=.25;
sleep .05;
x-=.7;
y+=.25;
sleep .05;
x-=.5;
y+=.25;
sleep .05;
//bounce again...
x-=.3;
y-=.5;
sleep .05;
x-=.3;
y-=.35;
sleep .05;
x-=.3;
y-=.15;
sleep .05;
x-=.3;
y-=.05;
sleep .05;
x-=.3;
y+=.05;
sleep .05;
x-=.3;
y+=.15;
sleep .05;
x-=.3;
y+=.35;
sleep .05;
x-=.3;
y+=.5;
sleep .05;

}



//top wall action
if(onwall(x,y+1.5) && !onwall(x,y+5))

{
y+=1.5;
sleep .05;
y+=1.4;
sleep .05;
y+=1.3;
sleep .05;
y+=1.2;
sleep .05;
y+=1.06;
sleep .05;
y+=.9;
sleep .05;
y+=.7;
sleep .05;
y+=.5;
sleep .05;
//bounce again...
y+=.05;
sleep .05;
y+=.1;
sleep .05;
y+=.15;
sleep .05;
y+=.2;
sleep .05;
y+=.25;
sleep .05;
y+=.3;
sleep .05;
y+=.35;
sleep .05;
y+=.4;
sleep .05;

}

//bottom wall action
if(onwall(x,y+4) && !onwall(x,y))

{
y-=1.5;
sleep .05;
y-=1.4;
sleep .05;
y-=1.3;
sleep .05;
y-=1.2;
sleep .05;
y-=1.06;
sleep .05;
y-=.9;
sleep .05;
y-=.7;
sleep .05;
y-=.5;
sleep .05;
//bounce again...
y-=.05;
sleep .05;
y-=.1;
sleep .05;
y-=.15;
sleep .05;
y-=.2;
sleep .05;
y-=.25;
sleep .05;
y-=.3;
sleep .05;
y-=.35;
sleep .05;
y-=.4;
sleep .05;

}
//TEST FOR END OF MAP!
//left wall action
if(x < 2)
{
x+=1.5;
y+=.25;
sleep .05;
x+=1.4;
y+=.25;
sleep .05;
x+=1.3;
y+=.25;
sleep .05;
x+=1.2;
y+=.25;
sleep .05;
x+=1.06;
y+=.25;
sleep .05;
x+=.9;
y+=.25;
sleep .05;
x+=.7;
y+=.25;
sleep .05;
x+=.5;
y+=.25;
sleep .05;
//bounce again...
x+=.3;
y-=.5;
sleep .05;
x+=.3;
y-=.35;
sleep .05;
x+=.3;
y-=.15;
sleep .05;
x+=.3;
y-=.05;
sleep .05;
x+=.3;
y+=.05;
sleep .05;
x+=.3;
y+=.15;
sleep .05;
x+=.3;
y+=.35;
sleep .05;
x+=.3;
y+=.5;
sleep .05;

}


//right wall action
if(x > 62)
{
x-=1.5;
y+=.25;
sleep .05;
x-=1.4;
y+=.25;
sleep .05;
x-=1.3;
y+=.25;
sleep .05;
x-=1.2;
y+=.25;
sleep .05;
x-=1.06;
y+=.25;
sleep .05;
x-=.9;
y+=.25;
sleep .05;
x-=.7;
y+=.25;
sleep .05;
x-=.5;
y+=.25;
sleep .05;
//bounce again...
x-=.3;
y-=.5;
sleep .05;
x-=.3;
y-=.35;
sleep .05;
x-=.3;
y-=.15;
sleep .05;
x-=.3;
y-=.05;
sleep .05;
x-=.3;
y+=.05;
sleep .05;
x-=.3;
y+=.15;
sleep .05;
x-=.3;
y+=.35;
sleep .05;
x-=.3;
y+=.5;
sleep .05;

}



//top wall action
if(y < 2)

{
y+=1.5;
sleep .05;
y+=1.4;
sleep .05;
y+=1.3;
sleep .05;
y+=1.2;
sleep .05;
y+=1.06;
sleep .05;
y+=.9;
sleep .05;
y+=.7;
sleep .05;
y+=.5;
sleep .05;
//bounce again...
y+=.05;
sleep .05;
y+=.1;
sleep .05;
y+=.15;
sleep .05;
y+=.2;
sleep .05;
y+=.25;
sleep .05;
y+=.3;
sleep .05;
y+=.35;
sleep .05;
y+=.4;
sleep .05;

}

//bottom wall action
if(y > 62)

{
y-=1.5;
sleep .05;
y-=1.4;
sleep .05;
y-=1.3;
sleep .05;
y-=1.2;
sleep .05;
y-=1.06;
sleep .05;
y-=.9;
sleep .05;
y-=.7;
sleep .05;
y-=.5;
sleep .05;
//bounce again...
y-=.05;
sleep .05;
y-=.1;
sleep .05;
y-=.15;
sleep .05;
y-=.2;
sleep .05;
y-=.25;
sleep .05;
y-=.3;
sleep .05;
y-=.35;
sleep .05;
y-=.4;
sleep .05;

}

if(playerchats)
{
if (strcontains(#c,recoverred))
{
if(playerdir==0)
{
x=playerx;
y=playery-4;
}
if(playerdir==1)
{
x=playerx-4;
y=playery;
}
if(playerdir==3)
{
x=playerx+4;
y=playery;
}
if(playerdir==2)
{
x=playerx;
y=playery+4;
}

}
}
if (playerenters) {
}
if (playertouchsme) {
set ballisheld;

if(onwater(x,y))
{
//vars for player so ball doesn't dynamically update player pos
myy=players[player].y;
myx=players[player].x;
y-=(myy-y)/5;
x-=(myx-x)/5;
sleep .05;
y-=(myy-y)/6;
x-=(myx-x)/6;
sleep .05;
y-=(myy-y)/7;
x-=(myx-x)/7;
sleep .05;
y-=(myy-y)/8;
x-=(myx-x)/8;
sleep .05;
y-=(myy-y)/9;
x-=(myx-x)/9;
sleep .05;
y-=(myy-y)/12;
x-=(myx-x)/12;
sleep .05;
y-=(myy-y)/16;
x-=(myx-x)/16;
sleep .05;
y-=(myy-y)/20;
x-=(myx-x)/20;
sleep .05;
y-=(myy-y)/25;
x-=(myx-x)/25;
sleep .05;
}
}


if (washit) {

//vars for player so ball doesn't dynamically update player pos
myy=players[player].y;
myx=players[player].x;
//If character is sort of below the NPC
y-=(myy-y)/5;
x-=(myx-x)/5;
sleep .05;
y-=(myy-y)/6;
x-=(myx-x)/6;
sleep .05;
y-=(myy-y)/7;
x-=(myx-x)/7;
sleep .05;
y-=(myy-y)/8;
x-=(myx-x)/8;
sleep .05;
y-=(myy-y)/9;
x-=(myx-x)/9;
sleep .05;
y-=(myy-y)/12;
x-=(myx-x)/12;
sleep .05;
y-=(myy-y)/16;
x-=(myx-x)/16;
sleep .05;
y-=(myy-y)/20;
x-=(myx-x)/20;
sleep .05;
y-=(myy-y)/25;
x-=(myx-x)/25;
sleep .05;


}

if(wasthrown)
{
sleep 1;
if(dir==0)
{
y-=.05;
sleep .05;
y-=.1;
sleep .05;
y-=.15;
sleep .05;
y-=.2;
sleep .05;
y-=.25;
sleep .05;
y-=.3;
sleep .05;
y-=.35;
sleep .05;
y-=.4;
sleep .05;
}
}

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:00 AM.


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