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 07-29-2007, 08:30 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Question Gun Script

my gun can only attack like a sword, and i need to make it so it fires from afar, can someone help me?


__________________________________________________ ________
//#CLIENTSIDE
function onCreated() {
client.max_m16_ammo = 100;
client.m16_ammo= 100;
this.m16_on = 0;
}
function onWeaponFired() {
if (this.m16_on = 0) {
this.m16_on = 1;
if (this.m16_on == 1 && client.m16_ammo > 0) {
replaceani("walk", "nightmare_m16_walk");
replaceani("idle", "nightmare_m16_idle");
replaceani("sword", "nightmare_m16_fire");
} else if (this.m16_on == 1 && client.m16_ammo == 0) {
replaceani("walk", "nightmare_m16_walk");
replaceani("idle", "nightmare_m16_idle");
replaceani("sword", "nightmare_m16_reload");
}
} else if (this.m16_on == 1) {
this.m16_on = 0;
replaceani("walk", "walk");
replaceani("idle", "idle");
replaceani("sword", "sword");
}
}
function onKeyPressed(keycode, keychar) {
if (this.harpo_on == 1 && keychar == "r") {
if (client.harpo_ammo == 0) {
setani("nightmare_m16_reload", " ");
client.m16_ammo = client.max_m16_ammo;
}
}
if (keychar == "s" && client.m16_ammo > 0) {
client.m16_ammo -= 1;
setshootparams("damage", 10);
temp.shootangle = getangle(vecx(player.dir), vecy(player.dir));
shoot(player.x+vecx(player.dir), player.y+vecy(player.dir), player.z, temp.shootangle, 0, 0, "nightmare_m16_bullet", NULL);
}
}
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #2  
Old 08-10-2007, 04:47 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
.......... i know half of are stealing it so DONT READ UNLESS U CAN HELP!!!
(or u just wanna chat, thats fine too.)
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #3  
Old 08-10-2007, 09:18 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Why would anyone want to steal this..?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 08-10-2007, 10:18 PM
Horrified Horrified is offline
Rediculously inactive
Join Date: Jul 2007
Posts: 961
Horrified is on a distinguished road
Send a message via ICQ to Horrified Send a message via AIM to Horrified Send a message via MSN to Horrified Send a message via Yahoo to Horrified
Quote:
Originally Posted by Knightmare1 View Post
my gun can only attack like a sword, and i need to make it so it fires from afar, can someone help me?
what do you mean o_o?

You mean you press S and a sword comes up anyway...?

and I don't know why someone would steal a script that's BROKEN.
Reply With Quote
  #5  
Old 08-11-2007, 01:16 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Also questionable whether you made that or not. Seems to follow a common format
Reply With Quote
  #6  
Old 08-11-2007, 01:22 AM
Cloven Cloven is offline
Delteria
Cloven's Avatar
Join Date: Dec 2006
Location: Florida, United States
Posts: 542
Cloven has a spectacular aura about
Send a message via AIM to Cloven
Seems like sloppy code in general.
Reply With Quote
  #7  
Old 08-12-2007, 03:30 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
At least he seems to somewhat understand his objects.
But I cringe at this:
Quote:
if (this.m16_on = 0) {
__________________
Do it with a DON!
Reply With Quote
  #8  
Old 08-12-2007, 05:31 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
You need to use the shoot() command for a good gun in my opinion, wiki has good documentation on this command, but you could also use showimg with some checks and what not, seems like it might lag. The reason it only attacks like a sword is because your replace the sword ani which is default to only hurt the things in front you, not things that are afar.
__________________
Deep into the Darkness peering...
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 01:37 AM.


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