PDA

View Full Version : Quick Question (regarding setshootparams)


Omini
06-01-2006, 07:22 AM
Ok so if I put this into a weapon npc (ie. a gun)

setshootparams(shoot,this.gunpow);

Is it possible to put the

function onActionProjectile()
{
if (params[0] == "shoot") {
//Scripting Stuff
}
}

In another NPC or does it HAVE to be in the same weapon that the setshootparams was set in?

napo_p2p
06-01-2006, 07:47 AM
In another NPC or does it HAVE to be in the same weapon that the setshootparams was set in?

Can go in another NPC (better that way actually).

Omini
06-01-2006, 07:50 AM
Awesome. If that script is used "setshootparams(shoot,this.gunpow);", how would that be used in another NPC? Is this.gunpow; still able to be used or does that turn into a param?

Andy0687
06-01-2006, 07:56 AM
Awesome. If that script is used "setshootparams(shoot,this.gunpow);", how would that be used in another NPC? Is this.gunpow; still able to be used or does that turn into a param?


It will turn into a param.


setshootparams("shoot",this.gunpow);



function onActionProjectile() {
if (params[0] == "shoot") {
somestuff -= params[1];
}
}


Or you could do whatever you want with the params really. You can put the onActionProjectile in any other npc, probably a system npc.

Omini
06-01-2006, 07:59 AM
Alright awesome. :) Thanks very much for the help.

Edit:

Ok it doesn't appear to work.

function shoot()
{
freezeplayer(0.65);
setani("millenium_cx-fire","");
client.cxclip -= 1;
this.angle = getangle(vecx(player.dir),vecy(player.dir));
this.dx = player.x+vecx(player.dir)*2;
this.dy = (player.y-.5)+vecy(player.dir)*2.5;
//Setting Shoot Params
setshootparams("shoot",this.gunpow,player.account);
//Shooting Bullets
shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),0,0,"millenium_bullet","");
shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),0,0,"millenium_bullet","");
shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),0,0,"millenium_bullet","");
shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),0,0,"millenium_bullet","");
shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),0,0,"millenium_bullet","");
shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),0,0,"millenium_bullet","");
}

That's in the Weapon / Gun. In a system NPC (-Systems/HP)

function onActionprojectile()
{
if (!isnopkzone) {
if (params[0] == "shoot") {
clientr.hp -= params[1];
if (clientr.hp <= 0) {
with (findplayer(params[2])) {
clientr.kills += 1;
}
dead();
}
}
}
}

Can anyone see any errors in either of those 2 scripts?