.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...
|Sep 21 2011 Anchor|
I Have my "IT_SUPER_NAILGUN" here, already coded with a "fake overhating" effect (overheats after 80 shots for 2 seconds, just a modified reloading code based on Reload Quake xD)..
- if you press you shootbutton, the nailgun doesnt start shooting for 2 seconds, only the barrel animations starts and a "warmup sound plays"
|Sep 27 2011 Anchor|
Yep, already found, modified and rewrote thiis code. And this forum didnt tell me about this post. Dur.
Here we go. My code samples are a bit more complex because I use pointer vars for all add on guns.
The sequence goes like this -
You need a control var defined in defs.qc somewhere near the end:
In weapons.qc where you fire this gun -
else if (self.weapon == IT_SUPER_NAILGUN)
In another part of weapons (or even better a separate qc file for extra weapons):
// fn(set_spindown) - start spin down seq.
void (float tr) set_spindown =
self.think = player_gun_sd1;
// start gun spin up, play sound, setup vars
void () player_gun_spinup = [ 17, player_gun_su2 ]
// run spinup frames until ready to fire - timing is controlled by value in attack_finished
void () player_gun_su2 = [ 18, player_gun_su2 ]
// my fire function - yours might vary a bit
void () W_FireMiniGun =
// use ammo - you have to define bullets, and make an ammo box. or you could use ammo_nails
// this is a brass eject function - not absolutely necessary
if (self.currentammo <= 0)
// fn(player_gat1,2) - gatling main fire sequence
void () player_gun1 = [ 17, player_gun2 ]
if (self.t_width < time)
void () player_gun2 = [ 18, player_gun1 ]
// fn(player_gun_sd1) - ammo empty or trigger release, spin gatling down
void () player_gun_sd1 = [ 19, player_gun_sd1 ]
This came from my gatling gun code, so I renamed a few things, and put your values in where I could.
It is also likely you will need to prototype some of those functions - add them to the end of defs.qc like this:
void () player_gun_sd1;
In general if the compiler says this:
weapons.qc(209): error: Unknown value "player_gun_spinup"
and the function is in a qc file (that is called by progs.src) you will need to prototype the function before it gets called.
Edited by: numbersix
|Dec 29 2011 Anchor|
Well, this did not work for me...
|Jan 9 2012 Anchor|
If you just did a cut and paste, you prob. dont have all the variables defined.
You could animate spin up through a frame sequence. Due to the repetitive nature of spins though you will still likely want a countdown variable or time limit on the loop.
What ever way you do it from a code perspective the process is the same -
(weapon selected by any method)
I could provide you with all my gatling code, but you will be in the same boat with it needing to be integrated before it can be compiled.
The best thing to do might just be to get a working gatlinq with qc and merge that into your code.
|Jan 9 2012 Anchor|
np, got it to work, made a misstake with my defined stuff... xD
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.