Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Boomerang Script (https://forums.graalonline.com/forums/showthread.php?t=9802)

fuzie 08-17-2001 02:46 PM

Boomerang Script
 
if (playertouchsme) {
toweapons Boomerang;
set gotboomerang;
destroy;
}
if (weaponfired && this.flycounter<=0) {
hideimg 1;
hidesword 0.3;
this.distance = 13;
this.steplen = 1.5;

timeout = 0.05;
this.flycounter = 0;
this.oldx = playerx;
this.oldy = playery;
}
if (timeout) {
this.flycounter++;
if (this.flycounter<6) {
if (playerdir==0 || playerdir==2) playersprite = 13;
else playersprite = 6;
if (playerdir==0) showimg 1,wboom4.gif,playerx-0.7,playery+1.4;
if (playerdir==1) showimg 1,wboom3.gif,playerx+1.9,playery+1.5;
if (playerdir==2) showimg 1,wboom2.gif,playerx+2.3,playery+0.7;
if (playerdir==3) showimg 1,wboom2.gif,playerx-0.2,playery+1.5;
if (this.flycounter==2) freezeplayer 0.2;
timeout = 0.05;
} else if (this.flycounter==6) {
playersprite = 0;
this.mx = 0;
this.my = 0;
if (playerx>this.oldx) this.mx+=this.steplen;
if (playerx<this.oldx) this.mx-=this.steplen;
if (playery>this.oldy) this.my+=this.steplen;
if (playery<this.oldy) this.my-=this.steplen;
if (this.mx!=0 && this.my!=0) {
this.mx*=0.714;
this.my*=0.714;
}
if (this.mx==0 && this.my==0) {
if (playerdir==0) this.my-=this.steplen;
if (playerdir==1) this.mx-=this.steplen;
if (playerdir==2) this.my+=this.steplen;
if (playerdir==3) this.mx+=this.steplen;
}
this.flyx = playerx+0.5;
this.flyy = playery+1;
if (playerdir==0) this.flyx--;
if (playerdir==2) this.flyx++;
timeout = 0.05;
} else if (this.flycounter<6+this.distance) {
fac = cos(3.14/2*(this.flycounter-6)/this.distance);
this.flyx += this.mx*fac;
this.flyy += this.my*fac;
showimg 1,wboom.gif,this.flyx,this.flyy;
if (onwall(this.flyx+0.5,this.flyy+0.5)) {
putleaps 4,this.flyx,this.flyy;
this.flycounter = 6+this.distance;
} else
this.testhurt = 1;
timeout = 0.05;
} else {
distx = playerx+0.5-this.flyx;
disty = playery+1-this.flyy;
abs = (distx^2+disty^2)^0.5;
if (abs>=2) {
fac = arctan((this.flycounter-6-this.distance)/this.distance);
this.flyx += distx/abs*this.steplen*fac;
this.flyy += disty/abs*this.steplen*fac;
showimg 1,wboom.gif,this.flyx,this.flyy;
this.testhurt = 1;
timeout = 0.05;
} else {
hideimg 1;
this.flycounter = 0;
}
}
}
if (playerenters) {
hideimg 1;
this.flycounter = 0;
timeout = 0;
show;
}
if (this.testhurt == 1) {
for (i=0; i<compuscount; i++) {
if (abs(this.flyx-compus[i].x)<=1 &&
abs(this.flyy-(compus[i].y-0.5))<=1.5 &&
compus[i].mode!=3)
hitcompu i,0,this.flyx+0.5,this.flyy+0.5;
}
for (i=1; i<playerscount; i++) {
if (abs((this.flyx+0.7)-(players[i].x+1.5))<=1 &&
abs((this.flyy+0.5)-(players[i].y+1.5))<=1.5)
hitplayer i,0,this.flyx+0.5,this.flyy+0.5;
}
this.testhurt = 0;
}




Why won't this werk???????? It says this:Error: Expected format abs(val) PLZ HELP
---------L8---------
----Brian----------

fuzie 08-17-2001 03:45 PM

a friend made it up and i know he did b/c i know him in real life and i saw him doing it all day yesterday and he just suddnly had troubles with it!!!!!!!!

LiquidIce00 08-18-2001 05:07 AM

change abs variables to something else other then abs cuz abs is abs() a command (absolute value) which is used for finding distance of a number to 0 o.o (good for transfering negatives to positives)

SagaTCN 08-19-2001 01:26 AM

that is identical to the original boomerang script.

bleh it is so old it needs fixin.

And lot's of it.

LiquidIce00 08-19-2001 01:38 AM

Quote:

Originally posted by Kaimetsu
Fuzie: I don't believe for a second that he made up that script, and used most of the same variable names as in the original boomerang script.

Liquidice: That's pretty much what I just said, but abs isn't just "good for transfering negatives to positives," that's ALL it does. Well, it would be if you swapped "transfering" for any word that made sense here.

they should have absolute value but for pos>neg.
so i dont gotta do
this.x=this.x-(this.x*2);
;D

Xaviar 08-19-2001 04:10 AM

Quote:

Originally posted by LiquidIce00


they should have absolute value but for pos>neg.
so i dont gotta do
this.x=this.x-(this.x*2);
;D

why not just
this.x=this.x*-1;
?

kyle0654 08-19-2001 04:54 AM

Quote:

Originally posted by LiquidIce00


they should have absolute value but for pos>neg.
so i dont gotta do
this.x=this.x-(this.x*2);
;D

this.x = abs(this.x)*-1;

that'll always return the negative value.

LiquidIce00 08-19-2001 05:03 AM

Quote:

Originally posted by kyle0654

this.x = abs(this.x)*-1;

that'll always return the negative value.

that too o.o

Slaktmaster 08-19-2001 05:51 AM

yay leet boomerang script

Floppyman 08-19-2001 01:45 PM

Fazie
 
That is my boomerang scprit and i would be happy , if you or your friend didnt take credit for making it , Thank you

kyle0654 08-19-2001 11:24 PM

Re: Fazie
 
Quote:

Originally posted by Floppyman
That is my boomerang scprit and i would be happy , if you or your friend didnt take credit for making it , Thank you
Stefan made it
At least, I think it was him

fuzie 08-20-2001 12:52 AM

bahhh.,....i'll edit it a bit and just do
//Made by Stefan
//Edited my Brian

hows that?????????

--------Brian----------


All times are GMT +2. The time now is 02:13 PM.

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