View Single Post
  #1  
Old 01-11-2002, 10:30 AM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
array manuvering bow scirpt help, help please!

Hi there, this NPC i have been working for a customizale board
does not quite qork right. Instead of all of the arrows showing up,
i would like it so that one arrow shows up on its own x and y each time it is fired. any tips, knowledge and help would be great. For each time you fire another arrow starts on its own and any y and the other arrows keep going til they hit a wall, that is the goal.

NPC Code:

// NPC made by Prozac
// may not be used on any playerworld wihtout permission
// to ask, email: [email protected]
// customizable bow

if (playerenters) {show;}
if (playertouchsme)
{
toweapons Custom Bow; //or your weapon name
if (isweapon)
{
this.ammo=10; // number of times to shoot at once
this.power=2; // how many half hearts to hit
setarray this.shotx,this.ammo;
setarray this.shoty,this.ammo; //vars for x and y of each arrow;
setarray this.inuse,this.ammo; //1=arrow being shot, 0=not being shot
this.fired=0; // how many times been fired
}
}

if (weaponfired)
{
this.ammo=10; // number of times to shoot at once
this.power=1; // how many half hearts to hit
setarray this.shotx,this.ammo;
setarray this.shoty,this.ammo; //vars for x and y of each arrow;
setarray this.inuse,this.ammo; //1=arrow being shot, 0=not being shot

if (this.fired<this.ammo)
{this.fired++; this.inuse[this.fired]=1;}else{this.fired=0;}

this.dir=playerdir;
this.shotx[this.fired]=playerx+vecx(this.dir)*2;
this.shoty[this.fired]=playery+.5+vecy(this.dir)*2;
freezeplayer .2; playersprite=14;

test();

}

function test()
{
while(this.fired>0)
{
for (this.i=0; this.i<this.ammo; this.i++)
{
if (this.inuse[this.i]==1)
{
if (!onwall(this.shotx[this.fired]+.5,this.shoty[this.fired]+.5))
{
this.shotx[this.fired]+=vecx(this.dir);
this.shoty[this.fired]+=vecy(this.dir);
showimg this.i,arrow.gif,this.shotx[this.fired]+.5,this.shoty[this.fired]+.5;
hitobjects this.power,this.shotx[this.fired]+.5,this.shoty[this.fired]+.5;
sleep .05;
}
else
{
this.inuse[this.i]=0; this.fired--; hideimg this.i;
}
}
}
}
return;
}

__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote