Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-01-2006, 06:22 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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?
__________________



Reply With Quote
  #2  
Old 06-01-2006, 06:47 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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).
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 06-01-2006, 06:50 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to 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?
__________________



Reply With Quote
  #4  
Old 06-01-2006, 06:56 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
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.
Reply With Quote
  #5  
Old 06-01-2006, 06:59 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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?
__________________




Last edited by Omini; 06-01-2006 at 07:43 AM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:10 PM.


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