Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-26-2010, 07:35 PM
N01ze N01ze is offline
Level Designer
N01ze's Avatar
Join Date: Aug 2010
Posts: 46
N01ze is on a distinguished road
Gun Script help?

I can seem to find a good gun script anywhere, and I was wondering if anyone had a good script that I could use. If anyone has anything, or tips, it would help a lot

Thanks,

~N01ze
Reply With Quote
  #2  
Old 08-26-2010, 08:29 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
well, you could start with the basic stuffs, this script can be found on Testbed under "Shared/Shoot" and it shoots a Arrow when you update the script.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.startx player.x+vecx(player.dir);
  
temp.starty player.y+vecy(player.dir);
  
temp.startz player.z;
  
temp.angle getangle(vecx(player.dir), vecy(player.dir));
  
temp.zangle 0;
  
temp.power  0;
  
temp.ani "arrow"// projectile ani
  
temp.aniparam0 0;
  
temp.aniparam1 0;
  
// etc
  
shoot(temp.startxtemp.startytemp.startztemp.angletemp.zangletemp.powertemp.anitemp.aniparam0temp.aniparam1); // etc with the aniparams

but if your no scripter, you should probably hire one.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #3  
Old 08-27-2010, 07:23 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
there are no good gun scripts, guns are terrible and should not exist
Reply With Quote
  #4  
Old 08-27-2010, 10:49 PM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Quote:
Originally Posted by Loriel View Post
there are no good gun scripts, guns are terrible and should not exist
I think I've fallen in love all over again
Reply With Quote
  #5  
Old 08-27-2010, 10:52 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by cbk1994 View Post
You'll want to use onKeyPressed() and GraalControl.onKeyUp()

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.spread 0.1;
  
this.freeze 0.1// player freeze time
  
this.speed 0.05// controls the timeout
  
this.reload 50;
  
this.load 50;
}
function 
onKeyPressed(codekeyscan) {
  if (
player.weapon != this) {
    return; 
// weapon not selected
  
}
  
  if (
this.keyD) {
    return;
  }
  
  if (
key == "d") {
    
this.keyD true;
    
this.onTimeOut();
  }
}

function 
GraalControl.onKeyUp(codekeyscan) {
  if (
key == "d") {
    
this.keyD false;
    
this.setTimer(0); // end the timeout, stop shooting
  
}
}

function 
onTimeOut() { // this is where the shooting goes
  
freezePlayer(this.freeze);
  
setAni("millenium_scar-fire"NULL);

  
temp.angl getangle(vecx(player.dir), vecy(player.dir))+random(this.spread*-1,this.spread);
  
  
shoot(player.0.5 vecx(player.dir), player.vecy(player.dir), player.ztemp.angl00"idle"player.dir);
  
setTimer(this.speed);

You'll also need to add checks for things like reloading, etc.
..
__________________
Reply With Quote
  #6  
Old 08-28-2010, 10:37 PM
N01ze N01ze is offline
Level Designer
N01ze's Avatar
Join Date: Aug 2010
Posts: 46
N01ze is on a distinguished road
Ok thanks and I can also see why you wouldnt want guns, but I had a really cool idea
Reply With Quote
  #7  
Old 08-29-2010, 05:59 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by N01ze View Post
Ok thanks and I can also see why you wouldnt want guns, but I had a really cool idea
Does it involve glorifying violence/careless murder?
Reply With Quote
  #8  
Old 08-29-2010, 06:43 PM
Dnegel Dnegel is offline
Rjax Shizibz
Join Date: Jul 2009
Posts: 1,334
Dnegel will become famous soon enough
Quote:
Originally Posted by Loriel View Post
Does it involve glorifying violence/careless murder?
If so, he should think it over again.
Reply With Quote
  #9  
Old 09-01-2010, 09:34 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
lets jam the gun
(lol i just had to add this for the luls)

Quote:
Originally Posted by fowlplay4 View Post
PHP Code:
function onWeaponFired() {
  while (
keydown(4) && !this.jammed) {
    
FireGun();
    
waitfor(this"Jammed"this.firerate);
  }
}

function 
onJammed() {
  
this.jammed true;
  
player.chat "$#!&ing gun jammed.";

and have some sort of script behind the scenes throw out random jammed events to guns.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #10  
Old 09-01-2010, 09:38 PM
Fogell Fogell is offline
Ez
Fogell's Avatar
Join Date: Aug 2010
Location: United States, Georgia
Posts: 72
Fogell is on a distinguished road
No1ze I dont think that our 2 month old Dev server needs guns just yet...
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 06:05 AM.


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