scratch qc weapons?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

scratch qc weapons?

Postby ceriux » Fri Feb 22, 2013 3:18 am

can someone explain to me the main functions required for coding a weapon from scratch (no preexisting code?) please, thank you?
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: scratch qc weapons?

Postby r00k » Fri Feb 22, 2013 3:55 pm

Look in ITEMS.QC for 'void() weapon_foo =' , these are spawn functions when the map loads.
In WEAPONS.QC, is the code for changing weapons, and firing the weapon.

So you will need
a spawn function which creates the entity, and precaches it's model, sets up a touch function, then spawns the item.
an impulse use to select that weapon, (including cycling to that weapon via impulse 10/12)
addition to w_attack so u can update v_fooweapon anims via player.qc and handle what happens when u shoot the weapon.
plus if the weapon uses any ammo, you need to account for all that too!

Sorry i wrote this off the cuff and in a hurry, if you like i could make a simple weapon and document all required code...
r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: scratch qc weapons?

Postby ceriux » Fri Feb 22, 2013 10:16 pm

it would probably be helpful esp if you're good with comments. im going to attempt with out though. thanks for the post!
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest