Need Help Coding FG42 Scope in MP


(Denny) #1

Hey guys, i’ve been to 3 different forums and have gotten no help on this, which happens but i need some help getting the FG42 Scope to work in RTCW MP. I’ve got everything else done and working but this and it’s frustrating.

All i need is asistance on what file(s) to edit to enable the FG42 scope. I really appreciate any help and it would really be cool if you could help me.

If you need code samples of what i’ve got done or need more info feel freeto ask.


(Denny) #2

Damn, this must be hard to implement then huh? Otherwise i would have gotten a reply by now.

Anyways, this is for the Fritzbot mod btw, i’ll give co-credit to anyone who helps me get this scope working.


(nUllSkillZ) #3

Hmm, you could take a look in the ET-source code.
Because there the FG42 is part of the multiplayer.


(No1_sonuk) #4

What about copying the Mauser?


(Denny) #5

What do you mean? Like setting the FG42 to use the Mauser Scope instead? Or Code wise, because yeah i’ve doing comaprisons, i’ve even tried mimicing(sp?) mauser code to try and implement it but it didn’t turn up any results.

What baffles me is everything is setup code wise in the MP code to use the FG42 scope but there’s just some missing code somwhere to finish off enabling it that’s preventing the FG42 scope from working from what i can tell.

I was gonna take a look at the ET code but i wonder how much it differs from the RTCW code, it looks about the same.


(No1_sonuk) #6

Hmm, dunno. I do know that when I was working on the Great Crusade mod for RtCW (dead for more than 2 years now), we had working scopes on the FG42. I don’t know how they did it - I just added the scope to the model.


(Denny) #7

I got it, man, thank you nUllSkillZ, i looked in the ET code and found two pieces of code that made it work. The only thing now is when i zoom it zooms the whole picture, it son’t have that scope circle like it should.

Thanks goto you Sonuk too, here’s how i did it.

First you gotta define the FG42 Scope as a weapon in bg_misc.c like so…


/*QUAKED weapon_fg42scope (.3 .3 1) (-16 -16 -16) (16 16 16) SUSPENDED
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
model="models/weapons2/fg42/fg42.md3"
*/
	{
		"weapon_fg42scope",	//----(SA)	modified
		"sound/misc/w_pkup.wav",
        {	"models/weapons2/fg42/fg42.md3",
			"models/weapons2/fg42/v_fg42.md3",
			"models/weapons2/fg42/pu_fg42.md3"
		},

		"icons/iconw_fg42_1",	// icon
		"icons/ammo5",				// ammo icon
		"FG42 Scope",				// pickup		//----(SA)	modified
		0,
		IT_WEAPON,
		WP_FG42SCOPE,	// this weap
		WP_FG42,		// shares ammo w/
		WP_FG42,		// shares clip w/
		"",							// precache
		"",							// sounds
//		{0,0,0,0}
	},

Then you have to setup the ammo and such in g_client.c like so…


			case 14:     // WP_FG42
                        if ( pc != PC_SOLDIER )
                         	return;

				COM_BitSet( client->ps.weapons, WP_FG42 );
				client->ps.ammoclip[BG_FindClipForWeapon(WP_FG42)] = 20;
				client->ps.ammo[BG_FindAmmoForWeapon(WP_FG42)] = 20;
				client->ps.weapon = WP_FG42;

				COM_BitSet( client->ps.weapons, WP_FG42SCOPE );
				client->ps.ammoclip[BG_FindClipForWeapon(WP_FG42SCOPE)] = 20;
				client->ps.ammo[BG_FindAmmoForWeapon(WP_FG42SCOPE)] = 20;
				client->ps.weapon = WP_FG42SCOPE;
				break;

And that’s all i did and it started zooming when i hit the scope mode button. Now all i need to do is the scope view stuff i mentioned above. Would that be under animations maybe?


(nUllSkillZ) #8

Hmm, I think you should also post in the ET mod forum.
May be someone there knows what to do.


(carnage) #9

u need to display a .UI file or the rtcw equielant

look though the SP files and there already should be the fg42 scope file


(Denny) #10

There’s no need now, all i got to do is adjust the scope accuracy and it’s all finished :clap:

Now what would really be cool is the FG42 model with an axis arm because all i got is the model with an allied arm. Anyone know if there’s one to be located?


(carnage) #11

tough luck, i belive the skin or the allied arm is build onto that moddle. you will have to open it in a moddleing program and give it the new skins then export again


(Denny) #12

Hey Sonuk, didn’t you create an axis arm FG42 model awhile back for the BoB mod? If so, you still go it?


(No1_sonuk) #13

Here is the entire contents of my BoB FG42 models folder.
http://www.tim-jacobs.pwp.blueyonder.co.uk/bob/fg42.zip

Some of the models were modified by me. Others are standard RtCW.
I think the ones you need are:[ul]v_fg42_barrel3.md3 - Allies arm
v_fg42_barrel3_axis.md3 - Axis arm
fg42.mdc - 3rd person version with scope[/ul]
These have a 2003 date, and are the ones I made.

That should save you some time. :wink:


(Denny) #14

Thanks Sonuk! Those models look great, i have to adjust the animations for reloading to get them to work properly though. :beer:


(No1_sonuk) #15

NP. Just one more part of my work for dead mods that’s going to good use. :drink:

Oh, and a friendly word of advice: Wait a whole 24 hours, at least, before bumping your questions. Don’t forget that the people that can help you might be in a very different time zone. :smiley:


(Denny) #16

Hey guys, i’m getting some erroneous stuff when trying to run my FG42 mod using a dedicated server. It loads the gun, but the textures are all messed up and i get a consoel error like so…


WARNING: R_FindImageFile could not find 'textures/effects/GUNfx.tga' in

shader 'models/weapons2/fg42/fg42_2'

Shader models/weapons2/fg42/fg42_2 has a stage with no image

I’ve tracked it down to be somethign with the models.shader file. Here’s what i got in that file for the FG42…


models/weapons2/fg42/fg42_2
{

	{
		map models/weapons2/fg42/fg42_2.tga
		rgbGen lightingdiffuse
	}
}
//models/weapons2/fg42/fg42_2
//{
//	{
//		map textures/effects/GUNfx.tga
//		blendFunc GL_ONE GL_ZERO
//		tcMod scale 2 2
//		tcmod turb 0 .1 0 .05
//		rgbGen lightingdiffuse
//		tcGen environment 
//	}
//	{
//		map models/weapons2/fg42/fg42_2.tga
//		blendfunc blend
//		rgbGen lightingdiffuse
//	}
//}

Does anyone know why it’s doing this?


(No1_sonuk) #17

Looks like it’s commented out, so it shouldn’t be a problem.
IIRC, models.shader is one of the stock shader files - you shouldn’t mess with those, just add your own shader file that will be loaded after models.shader.


(Denny) #18

You have to add the custom shader file to a shaderlist.txt or something like that correct? (sorry it’s been awhile)


(No1_sonuk) #19

Not for in-game stuff like the weapon models. That said, it wouldn’t actually hurt to do it.
Shaderlist.txt is only used for Radiant to get its shaders for map compilation.

If you had to modify shaderlist.txt for everything, no 2 mods or maps could exist together because they’d be overriding one or the other.


(Denny) #20

Makes sense, i’ve only made like 1 custom shader before. How would you go about making a mod shader though, i named it FG42.shader and put the stuff i showed above and it won’t work.