Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gun Script help? (https://forums.graalonline.com/forums/showthread.php?t=134260335)

N01ze 08-26-2010 07:35 PM

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 :D

Thanks,

~N01ze

Deas_Voice 08-26-2010 08:29 PM

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.

Loriel 08-27-2010 07:23 PM

there are no good gun scripts, guns are terrible and should not exist

devilsknite1 08-27-2010 10:49 PM

Quote:

Originally Posted by Loriel (Post 1596990)
there are no good gun scripts, guns are terrible and should not exist

I think I've fallen in love all over again

cbk1994 08-27-2010 10:52 PM

Quote:

Originally Posted by cbk1994 (Post 1541067)
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.

..

N01ze 08-28-2010 10:37 PM

Ok thanks and I can also see why you wouldnt want guns, but I had a really cool idea :D

Loriel 08-29-2010 05:59 PM

Quote:

Originally Posted by N01ze (Post 1597151)
Ok thanks and I can also see why you wouldnt want guns, but I had a really cool idea :D

Does it involve glorifying violence/careless murder?

Dnegel 08-29-2010 06:43 PM

Quote:

Originally Posted by Loriel (Post 1597272)
Does it involve glorifying violence/careless murder?

If so, he should think it over again.

Deas_Voice 09-01-2010 09:34 PM

lets jam the gun ;)
(lol i just had to add this for the luls)

Quote:

Originally Posted by fowlplay4 (Post 1541077)
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.


Fogell 09-01-2010 09:38 PM

No1ze I dont think that our 2 month old Dev server needs guns just yet...


All times are GMT +2. The time now is 09:21 PM.

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