Forum

reload help

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

reload help

Postby sniperz227 » Fri May 06, 2011 9:24 pm

hi i needed help with my reload code. it works fine but im trying to make it so that it will work when i put it in a new .qc file. it was in weapons .qc but then it got all messy so i decided to make its own .qc file. what happens is when i put my code in there is some code in the weapons.qc W_Attack and the impulse command because that is where i call my reload function but i get an error saying it cannot find the function.

Code: Select all
/*
===========================
Reload Code For All Weapons
===========================
*/


/*
==============
Assault Rifles
==============
*/

/*
----
M4A1
----
*/

void () reload =
{
local .float shots_fired

if (self.weapon == IT_M4A1)
{
self.shots_fired = 30 - self.exam_m4a1;
   if (self.exam_m4a1 < 30 && self.ammo_m4a1 > 0)
{
self.ammo_m4a1 = self.ammo_m4a1 - self.shots_fired;
self.exam_m4a1 = 30;
}
else
{
self.exam_m4a1 = self.exam_m4a1 + self.ammo_m4a1;
self.ammo_m4a1 = 0;
}
}
self.currentammo = self.exam_m4a1;
self.attack_finished = time + 3.5;
};

thats the code is there something i could do so that it works when i put it in a diff .qc file
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Re: reload help

Postby Nahuel » Fri May 06, 2011 9:29 pm

check your progs.src, you should put your new .qc before weapons.qc
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby sniperz227 » Fri May 06, 2011 9:32 pm

thanks :)
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest