PDA

View Full Version : array help ...


prozac424242
08-02-2001, 08:46 AM
I want to make a shooting wepaon that
instead of
if (playerdir==0){y--;}
if (playerdir==2){y++;}
it is jsut one command thing.
here is what i got so far
except it goes diagonal.
How far off am i?

// NPC made by Prozac
if (playerenters) {show;}
if (playertouchsme) {toweapons throw thing;}
if (weaponfired)
{
this.distance=10; //how far to throw
setarray this.newx,4;
this.newx[0]=playerx; this.newx[1]=playerx-1;
this.newx[2]=playerx; this.newx[3]=playerx2;
setarray this.newy,4;
this.newy[0]=playery-2; this.newy[1]=playery+1;
this.newy[2]=playery+4; this.newy[3]=playery+1;

setplayerprop #c,#v(this.newx[playerdir]);

for (this.i=0; this.i<this.distance; this.i++)
{
putexplosion 0,this.newx[playerdir]+this.i,this.newy[playerdir]+this.i;
sleep .1;
}

}

LiquidIce00
08-02-2001, 09:05 AM
do you mean


// NPC made by Prozac if (playerenters) {show;}
if (playertouchsme) {toweapons throw thing;}
if (weaponfired) {
this.distance=10; //how far to throw
this.dir=playerdir;
this.x=playerx+vecx(this.dir)*2;
this.y=playery+.5+vecy(this.dir)*2;
for (this.i=0; this.i<this.distance; this.i++) {
this.x+=vecx(this.dir);
this.y+=vecy(this.dir);
putexplosion 0,this.x,this.y;
sleep .1;
}
}

Knightoffrost
08-02-2001, 09:07 AM
OH ok

LiquidIce00
08-02-2001, 09:10 AM
Originally posted by Knightoffrost
OH ok

lol knight is so mannered

Knightoffrost
08-02-2001, 09:12 AM
Originally posted by LiquidIce00


lol knight is so mannered

>.< Its Xerphier... stupid Knightoffrost.. errr..gerrrr.. that name should die! I dont know why i picked it gah! Xerphier ! YOU HEAR ME ITS XERPHIER! Actually i have a xerphier account its just not p2p.

Poogle
08-02-2001, 09:16 AM
huh?

Knightoffrost
08-02-2001, 09:17 AM
Originally posted by Poogle
huh?

Account name

Poogle
08-02-2001, 09:31 AM
Originally posted by Knightoffrost


Account name Wha?

prozac424242
08-02-2001, 09:51 AM
Thanks Ice - i been scripting since before vecx and vecy
then i looked them up in my Graal scripting search engine
http://www.figmentcode.com/cgi-bin/npc1.pl
and saw what you used - the arrays are already there.
thanks again!

LiquidIce00
08-02-2001, 01:19 PM
Originally posted by Knightoffrost


>.< Its Xerphier... stupid Knightoffrost.. errr..gerrrr.. that name should die! I dont know why i picked it gah! Xerphier ! YOU HEAR ME ITS XERPHIER! Actually i have a xerphier account its just not p2p.
PLZ DONT KILL ME KNIGHT
i mean xerphier