weapon.cfg


(No1_sonuk) #1

Does anyone have a list if what each line in the RTCW weapon.cfg file is?

Detail such as what specifically the different versions of the actions are for.


(Hewster) #2

Hi,

What do you need to know ?
I thought it was self explanitory ?

not all actions are used for all weapons, but its nice to have the
ability to add different actions for different instances in-game.

You need to look in the actual code to see which weapons use what
actions, but bascially all use
IDLE1
ATTACK1
DROP
RAISE
RELOAD1

Let me know what you’re trying to-do & I can probably help you out
(I’ve had quite a bit of experiance in modding the weapons ;))

Hewster


(No1_sonuk) #3

I want to add an M1 Garand. So I need to have normal shots for the first 7, then the bolt stays open after the 8th.


(Hewster) #4

I’m not a weapons expert :)…

is the 8th shot the last ?

But basically what you are saying is you want to add / use a second
fire animation after 7 shots ?

You need to create this animation, and point to it in ATTACK2 in the
weapon.cfg, then in the code you need to check when this weapon has
fired 7 shots & make it use this second animation, rather than the default
ATTACK1

Search bg_move.c for this line “weapattackanim = WEAP_ATTACK1;”
then add a check after this line, something like:

	if ((pm->ps->weapon == WP_M1Garand) && ( pm->ps->ammoclip[WP_M1Garand] <= 2))
			weapattackanim = WEAP_ATTACK2;

where “WP_M1Garand” is your weapon name & “2” is the amount of
ammo which will be left in the clip when you want this second animation
to play, in this case, if the clip holds 10 shots, then bullets 8, 9 & 10
will show the second animation.

Hope this helps ya out :slight_smile:

Hewster


(No1_sonuk) #5

Thanks, Hewster. That’s exactly what I’m looking for.

And yes, the Garand has an 8-round clip.


(No1_sonuk) #6

Well, after having a look, I found references to “WEAP_ATTACK_LASTSHOT”. Looks like it may already be in there. But I couldn’t find the part of the code that looks at the weapon.cfg file to check if it’s useable.


(Hewster) #7

ok, well since it is the lastshot,
if you reference your lastshot animation in ATTACK3, then it should
automatically play it on the last shot… no need to-do a separate check
in the code :slight_smile:

btw, the weapon.cfg is read in CG_ParseWeaponConfig , which is called
from CG_RegisterWeapon in cg_weapons.c

Hewster