Graal Forums

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

Petey84 09-09-2001 03:12 AM

?????
 
Ok, I need to get my NPC to shoot out a leap.. but , i dont want to use sleep commands, as in, I want to only put 1 putleap command and have it shoot out.

I have tried this, but it wont do it right..

putleap 3,playerx,playery+=.5; that wont do it..

and i do know how to script, i just cant get this part, its for a weapon im making. I have the rest done, its just this one little part. Someone please post the answer. Thanx

entravial 09-09-2001 03:33 AM

~AlphaFlame~The Fool~

Hrm... well, since I'm guessing you want it to fly out from the player...

if (playertouchsme){
toweapons Leap Line;
}
if (weaponfired){
this.x=playerx;
this.y=playery;
this.dir=playerdir;
timeout=.05;
}
if (timeout && this.x in |0,64| && this.y in |0,64|){
this.x+=vecx(this.dir)/2;
this.y+=vecy(this.dir)/2;
putleaps 3,this.x,this.y;
timeout=.05;
}

It should work, but I'm only scripting this here without testing, so if it doesn't... blame AOL :megaeek:

Petey84 09-09-2001 03:41 AM

Ok...
 
That did work.. but it all goes in one motion.. can you make it so it will put 1 of the leaps in each x and y.. but yet keeping going.. that one makes the leaps all in the same x and y.

entravial 09-09-2001 03:53 AM

Like this?
if (playertouchsme){
toweapons Leap Line2;
}
if (weaponfired){
this.x1=playerx;
this.y1=playery;
this.dir=playerdir;
this.out=0;
timeout=.05;
}
if (timeout && this.out<64){
this.out++;
setarray this.x,this.out;
setarray this.y,this.out;
this.x1+=vecx(this.dir)/2;
this.y1+=vecy(this.dir)/2;
this.x[this.out-1]=this.x1;
this.y[this.out-1]=this.y1;
for (i=0;i<this.out;i++){
putleaps 3,this.x[i],this.y[i];
}
timeout=.05;
}

Petey84 09-09-2001 04:17 AM

ok..
 
Thats better, but still 1 more thing.. =P


make it so that once the leap has been there.. it dont repeat.. it would only be there once.. and continue on to the direction

entravial 09-09-2001 05:29 AM

*sighs* You... ugh... that would be the FIRST script!!

if (playertouchsme){
toweapons Leap Line;
}
if (weaponfired){
this.x=playerx;
this.y=playery;
this.dir=playerdir;
timeout=.05;
}
if (timeout && this.x in |0,64| && this.y in |0,64|){
this.x+=vecx(this.dir)/2;
this.y+=vecy(this.dir)/2;
putleaps 3,this.x,this.y;
timeout=.05;
}


And it doesn't all stay at the same x/y... :grrr:

Petey84 09-09-2001 06:26 AM

Uhh..
 
No it wouldnt be.. =) Like the last one.. but i dont want them to stay there ... like.. I want it so they shoot out like an arrow would.. but to not stay in the same position.. it has to proceed outwards.. just like when you shoot an arrow.. got meh?

entravial 09-09-2001 07:21 AM

Grah that is like an arrow script =/

Ok, let's say player is facing -> that way... X marking the player, this is the way the leaps "y" would go...

Xyyyyyyyyyyyyyyyyyyyyyyyyyyy


Ok? And that's the same as an arrow.

Petey84 09-09-2001 07:55 AM

Ok..
 
Same thing you said.. well.. same index.. like this..

Step 1... //The fire!

X Y

Step 2...

X Y

Step 3..

X y

and so on.. like..

X y
just keeps going..
but i dont want it like this..

Xyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

just 1 at a time.. but fast.. like 1 motion.. like an arrow..

Vinvect 09-10-2001 04:21 AM

if (playerenters) {
drawunderplayer;
timeout=0;
}

if (playertouchsme) {
hide;
toweapons Rock Stream;
}

if (weaponfired) {
if (playerdir==0) {
this.oldx=playerx+0.5;
this.oldy=playery-3;
this.way=1;
this.expo=0;
putleaps 2,playerx+0.5,playery-3;
}
if (playerdir==1) {
this.oldx=playerx-3;
this.oldy=playery+0.75;
this.way=2;
this.expo=0;
putleaps 2,playerx-3,playery+0.75;
}
if (playerdir==2) {
this.oldx=playerx+0.5;
this.oldy=playery+4.5;
this.way=3;
this.expo=0;
putleaps 2,playerx+0.5,playery+4.5;
}
if (playerdir==3) {
this.oldx=playerx+4;
this.oldy=playery+0.75;
this.way=4;
this.expo=0;
putleaps 2,playerx+4,playery+0.75;
}
freezeplayer 0.65;
playersprite=33;
timeout=.05;
playermp-=10
}

if (timeout) {
if (playerx<this.oldx&& !onwall(this.oldx+2,this.oldy+1)&&
this.way==4) {
this.oldx+=1;
}
if (playery<this.oldy&& !onwall(this.oldx+1,this.oldy+2)&&
this.way==3) {
this.oldy+=1;
}
if (playerx>this.oldx&& !onwall(this.oldx,this.oldy+1)&&
this.way==2) {
this.oldx-=1;
}
if (playery>this.oldy&& !onwall(this.oldx+1,this.oldy)&&
this.way==1) {
this.oldy-=1;
}
this.expo+=1;
timeout=.05;
}

if (this.oldx>64 ||
this.oldx<0 ||
this.oldy>64 ||
this.oldy<0 ||
onwall(this.oldx,this.oldy) ||
onwall(this.oldx+2,this.oldy) ||
onwall(this.oldx,this.oldy+2) ||
onwall(this.oldx+2,this.oldy+2) ||
onwall(this.oldx+2,this.oldy+1) ||
onwall(this.oldx+1,this.oldy+2) ||
onwall(this.oldx,this.oldy+1) ||
onwall(this.oldx+1,this.oldy)) {
timeout=0;
this.expo=0;
}

if (this.expo==2) {
putleaps 2,this.oldx,this.oldy;
this.expo-=2;
}

entravial 09-10-2001 10:14 AM

~AlphaFlame~

Vinvect... much too long, mon ami. My first one could do the same thing as your LONG LONG one, with the insert of && !onwall(this.x+vecx(this.dir),this.y+vecy(this.dir )) for the onwall

And, by the by... what do you have timeout=0; for? Drawunderplayer seems a bit pointless as well since it will get hiden anyway when the player touchs it...

joseyisleet 09-10-2001 12:16 PM

ok..
 
// NPC made by Josey Hunt
if (playerenters){toweapons Leaps test;}
if(weaponfired){
if(playerdir=3){
this.x1=playerx+.5;
this.x2=playerx+.5;
this.y1=playery-5;
this.y2=playery+7;
this.originalx=playerx;
this.originaly=playery;
this.dirx1=3;
this.dirx2=3;
this.diry1=2;
this.diry2=0;
this.firedir=3;
}
if(playerdir=2){
this.x1=playerx+7;
this.x2=playerx-6;
this.y1=playery+.5;
this.y2=playery+.5;
this.originalx=playerx;
this.originaly=playery;
this.dirx1=1;
this.dirx2=3;
this.diry1=2;
this.diry2=2;
this.firedir=2;
}
if(playerdir=1){
this.x1=playerx+.5;
this.x2=playerx+.5;
this.y1=playery-5;
this.y2=playery+7;
this.originalx=playerx;
this.originaly=playery;
this.dirx1=1;
this.dirx2=1;
this.diry1=2;
this.diry2=0;
this.firedir=1;
}
if(playerdir=0){
this.x1=playerx+7;
this.x2=playerx-6;
this.y1=playery+.5;
this.y2=playery+.5;
this.originalx=playerx;
this.originaly=playery;
this.dirx1=1;
this.dirx2=3;
this.diry1=0;
this.diry2=0;
this.firedir=0;
}
timeout=.1;
playersprite=24;
this.firing=1;
}
if(timeout&&this.firing==1){
putleaps 3,this.x1,this.y1;
putleaps 3,this.x2,this.y2;
if(this.dirx1==1){this.x1--}
if(this.dirx2==1){this.x2--}
if(this.dirx1==3){this.x1++}
if(this.dirx2==3){this.x2++}
if(this.diry1==0){this.y1--}
if(this.diry2==0){this.y2--}
if(this.diry1==2){this.y1++}
if(this.diry2==2){this.y2++}
if(this.firedir==3||this.firedir==1){
if(this.diry1=0&&this.y1<=this.originaly-5){this.diry1=2}
if(this.diry1=2&&this.y1>=this.originaly+7){this.d iry1=0}
if(this.diry2=0&&this.y2<=this.originaly-5){this.diry2=2}
if(this.diry2=2&&this.y2>=this.originaly+7){this.d iry2=0}
}
if(this.firedir==0||this.firedir==2){
if(this.dirx1=1&&this.x1<=this.originalx-6){this.dirx1=3}
if(this.dirx1=3&&this.x1>=this.originalx+7){this.d irx1=1}
if(this.dirx2=1&&this.x2<=this.originalx-6){this.dirx2=3}
if(this.dirx2=3&&this.x2>=this.originalx+7){this.d irx2=1}
}
timeout=.1;
}
if(this.x1>=64||this.x1<=0){this.firing=0}
if(this.x2>=64||this.x2<=0){this.firing=0}
if(this.y1>=64||this.y1<=0){this.firing=0}
if(this.y2>=64||this.y2<=0){this.firing=0}

but you'll still have to put in the hurt compu and hurtplayer commands in this. it isnt a straight line, but it can be easily modified. =P

entravial 09-11-2001 12:41 PM

~AlphaFlame~

Ok, let me give you people a little pointer...


MAKE YOUR SCRIPTS SHORTER!

Honestly, the same thing can be accomplished that your scripts do in about 3/4 less lines. I'd hate to have 20 of those in my weapons, the loading lag would be a pain in the neck.


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

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