[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Sniper Rifle

Sniper Rifle

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Sniper Rifle

Postby redrum » Wed Sep 19, 2007 4:38 pm

Guys, I followed the tutorial on the sniper rifle. Works great!

I wanted to change the damage that it deals to be proportional to the distance of the shot.

I tried this change to the code, but it won't compile :(

/* //all new function new

sniper rifle
================
W_FireSniper
================
*/
void() W_FireSniper =
{
local vector dir;
local float damage;

damage = 300 + random()*50 + random()*50; //up to 400, never less than 300

- sniper damage

sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);

self.punchangle_x = -2;

self.currentammo = self.ammo_shells = self.ammo_shells - 10; //set to whatever you want
dir = aim (self, 100000);
FireBullets (1, dir, '0 0 0', damage);

org = self.origin + '0 0 16';
traceline (org, org + v_forward*300, TRUE,
self);
};

I added the lines in bold.
Am I on the right path of thinking?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Wed Sep 19, 2007 6:06 pm

User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby FrikaC » Wed Sep 19, 2007 7:39 pm

FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Urre » Thu Sep 20, 2007 6:34 am

I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby redrum » Thu Sep 20, 2007 2:44 pm

Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 3 guests