Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   hat Dragon! (https://forums.graalonline.com/forums/showthread.php?t=16126)

Darkman2001 11-04-2001 05:58 AM

hat Dragon!
 
I found this old dragon script of mine. Unfortunantly i lost the graphics for it. So used graphics that come with Graal to make a HAT DRAGON!

NPC Code:

// NPC made by Ðarkman (NBK)
if (created) {timeout=.05;
this.angle=1;
this.count=100;
this.speed=.60;
this.length=200;
this.blength=20;
setarray this.breathx, this.blength;
setarray this.breathy, this.blength;
setarray this.trailx, this.length+1;
setarray this.traily, this.length+1;
this.turn=.1;
hearts=20;
this.rand=.1;}

if(timeout) {
this.count++;
this.tmx=x+cos(this.angle-1)*this.speed;
this.tmy=y+sin(this.angle-1)*this.speed;
this.tpx=x+cos(this.angle+1)*this.speed;
this.tpy=y+sin(this.angle+1)*this.speed;
this.disp=(((abs(this.tpx-(playerx+.5))^2)+(abs(this.tpy-(playery+.5))^2))^.05);
this.dism=(((abs(this.tmx-(playerx+.5))^2)+(abs(this.tmy-(playery+.5))^2))^.05);
if(this.disp>this.dism) {this.angle=this.angle-this.turn};
if(this.disp<this.dism) {this.angle=this.angle+this.turn};
this.angle=this.angle+random((-2*this.rand),(2*this.rand));
this.ox=x;
this.oy=y;
x=x+cos(this.angle)*this.speed;
y=y+sin(this.angle)*this.speed;
if(abs(this.ox-x)>abs(this.oy-y)&&this.ox-x>0) {setgifpart head16.gif, 0, 31, 31, 31};
if(abs(this.ox-x)>abs(this.oy-y)&&this.ox-x<0) {setgifpart head16.gif, 0, 93, 31, 31};
if(abs(this.ox-x)<abs(this.oy-y)&&this.oy-y<0) {setgifpart head16.gif, 0, 62, 31, 31};
if(abs(this.ox-x)<abs(this.oy-y)&&this.oy-y>0) {setgifpart head16.gif, 0, 0, 31, 31};

for(a=1;a<this.length;a++) {
this.trailx[a]=this.trailx[a+1];
this.traily[a]=this.traily[a+1];
};

this.trailx[this.length]=this.ox;
this.traily[this.length]=this.oy;

for(a=1;a<this.length;a=a+2) {
showimg a, haticon.png, this.trailx[a], this.traily[a];
if(playerx+.5>this.trailx[a]-1&&playerx+.5<this.trailx[a]+2&&playery+.5>this.traily[a]-1&&playery+.5<this.traily[a]+2) {hurt 2};
};
this.chance=int(random(0,50));
if(this.chance=1&&abs(this.disp-this.dism)<.002) {breath()};
if(this.count<this.blength) {putexplosion2 3, 1, this.breathx[this.count], this.breathy[this.count];};


timeout=.05;
}

if(washit) {
if(playerdir=0) {this.angle=4.71};
if(playerdir=1) {this.angle=3.14};
if(playerdir=2) {this.angle=1.57};
if(playerdir=3) {this.angle=0};
hearts=hearts-(playerswordpower/2);
if(hearts<=0) {death()};
}

function breath() {
for(a=0;a<this.blength;a++) {
this.breathx[a]=x+cos(this.angle)*(2*a);
this.breathy[a]=y+sin(this.angle)*(2*a);
};
this.count=0;
}
function death() {
sleep .5;
for(a=1;a<this.length;a=a+3) {
putexplosion2 3, 3, this.trailx[a], this.traily[a];
};
destroy;
}



Python523 11-04-2001 06:38 AM

Pretty nice, more like a snake then a dragon though

Thak2 11-04-2001 08:04 AM

Wow, very good.

Took me quite a few trys untill I beat it too :).

Xaviar 11-04-2001 09:58 AM

Thats pretty cool, kinda reminds me of Kai's dragon thingys...I didn't much like the hit detection though..

Vinvect 11-04-2001 10:44 AM

Quote:

Originally posted by Xaviar
Thats pretty cool, kinda reminds me of Kai's dragon thingys...I didn't much like the hit detection though..
Darkman2001/ur grandmama scripts bettah than u!
:p
(lol jk about ur grandmama)
(but im tru on Darkman2001)

LilNiglet 11-05-2001 07:18 AM

Quote:

Originally posted by Vinvect

Darkman2001/ur grandmama scripts bettah than u!
:p
(lol jk about ur grandmama)
(but im tru on Darkman2001)

SHORTEN SIG PLS.


All times are GMT +2. The time now is 09:13 AM.

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