Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Quick Question (regarding setshootparams) (https://forums.graalonline.com/forums/showthread.php?t=66381)

Omini 06-01-2006 06:22 AM

Quick Question (regarding setshootparams)
 
Ok so if I put this into a weapon npc (ie. a gun)

NPC Code:
setshootparams(shoot,this.gunpow);



Is it possible to put the

NPC Code:
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 06:47 AM

Quote:

Originally Posted by Omini
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 06: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 06:56 AM

Quote:

Originally Posted by Omini
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.

NPC Code:

setshootparams("shoot",this.gunpow);



NPC Code:

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 06:59 AM

Alright awesome. :) Thanks very much for the help.

Edit:

Ok it doesn't appear to work.

NPC Code:
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)

NPC Code:
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?


All times are GMT +2. The time now is 01:47 PM.

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