Changing weapons for classes


(shaunf) #1

Hi,
I thought it would be interesting if a covert op could choose the enemy team’s machine gun as a weapon eg. an axis covert op could choose a Thompson as a weapon.

I have tried looking through the code for what to change and here is what I have done so far:

In bg_misc.c:


		case PC_COVERTOPS:
			if (weapon == WP_STEN
				|| weapon == WP_SMOKE_BOMB
				|| weapon == WP_SATCHEL
				|| weapon == WP_AMMO
				// Gordon: this is a cvt ops weapon in single player too, right?
				|| weapon == WP_FG42)
				return qtrue;
			else if (weapon == WP_K43 || weapon == WP_THOMPSON)
				return (teamNum == TEAM_AXIS);
			else if (weapon == WP_GARAND || weapon == WP_MP40)
				return (teamNum == TEAM_ALLIES);
			break;

In bg_classes.c:


	{
		PC_COVERTOPS,
		"characters/temperate/allied/cvops.char",
		"ui/assets/mp_spy_blue.tga",
		"ui/assets/mp_arrow_blue.tga",
		{ 
			WP_MP40,
			WP_STEN,
			WP_FG42,
			WP_GARAND,
		},	
	},

and:


	{
		PC_COVERTOPS,
		"characters/temperate/axis/cvops.char",
		"ui/assets/mp_spy_red.tga",
		"ui/assets/mp_arrow_red.tga",
		{ 
			WP_THOMPSON,
			WP_STEN,
			WP_FG42,
			WP_K43,
		},	
	},

g_client.c:


else if( pc == PC_COVERTOPS ) {
			switch( client->sess.playerWeapon ) {				
			case WP_THOMPSON:
			case WP_MP40:
			if( client->sess.sessionTeam == TEAM_AXIS ) {
				AddWeaponToPlayer( client, WP_THOMPSON, 2*(GetAmmoTableData(WP_THOMPSON)->defaultStartingAmmo), GetAmmoTableData(WP_THOMPSON)->defaultStartingClip, qtrue );
				break;
			} else {
				AddWeaponToPlayer( client, WP_MP40, 2*(GetAmmoTableData(WP_MP40)->defaultStartingAmmo), GetAmmoTableData(WP_MP40)->defaultStartingClip, qtrue );
				break;
			}


But I still can’t choose it as a weapon, can anyone help me with what else needs editting?

Thank you,
Shaun


(bacon) #2

Try changing

else if( pc == PC_COVERTOPS ) { 
         switch( client->sess.playerWeapon ) {             
         case WP_THOMPSON: 
         case WP_MP40: 
         if( client->sess.sessionTeam == TEAM_AXIS ) { 
            AddWeaponToPlayer( client, WP_THOMPSON, 2*(GetAmmoTableData(WP_THOMPSON)->defaultStartingAmmo), GetAmmoTableData(WP_THOMPSON)->defaultStartingClip, qtrue ); 
            break; 
         } else { 
            AddWeaponToPlayer( client, WP_MP40, 2*(GetAmmoTableData(WP_MP40)->defaultStartingAmmo), GetAmmoTableData(WP_MP40)->defaultStartingClip, qtrue ); 
            break; 
         }

To

else if( pc == PC_COVERTOPS ) { 
         switch( client->sess.playerWeapon ) {             
         case WP_THOMPSON: 
            AddWeaponToPlayer( client, WP_THOMPSON, 2*(GetAmmoTableData(WP_THOMPSON)->defaultStartingAmmo), GetAmmoTableData(WP_THOMPSON)->defaultStartingClip, qtrue ); 
            break; 
         case WP_MP40: 
            AddWeaponToPlayer( client, WP_MP40, 2*(GetAmmoTableData(WP_MP40)->defaultStartingAmmo), GetAmmoTableData(WP_MP40)->defaultStartingClip, qtrue ); 
            break; 
         }

That should work. I haven’t tested it since I’m not a PC with VC right now.


(shaunf) #3

Thanks, but it still doesn’t seem to work :frowning:

I can’t even pick up enemy Thompsons/MP40s, although I suspect that you should only be able to do that if you are holding an MP40/Thompson anyway.

Has anyone else added a weapon to a specific class? I don’t want to be able to get it as a secondary weapon or anything, I want them to be able to choose it as a primary weapon.

Thanks,
Shaun


(bacon) #4

You compiled the client dll right?


(shaunf) #5

Yes, I did it again just to make sure and it still doesn’t work. Perhaps someone can test the above code to make sure I haven’t done anything stupid?


(h0nd) #6

If I’m not talking shit (I’m drunk lol), I think I came across a weapon pickup code somewhere… Search for “pickup”, I think you can find it that way.


(bacon) #7

I just tried your EXACT code and it works fine. I don’t know why you’re having problems.
Make sure you’ve compiled both the server dll and the client dll. The client dll must be in a PK3 if you’re running the server pure.


(shaunf) #8

Bacon: So let me get this straight, you can (as a covert ops) choose the enemy SMG as a weapon, or at least pick it up?

h0nd: I found various things to do with picking up weapons and other things in g_items.c, is that what you mean?

Edit
Ok, I just copied the dlls to the game folder again and found the client DLL that was currently there was a much older version of the file! I definitely chose to copy over it the first time, as I clicked Yes to All when I first copied both the DLLs, so I don’t know what went wrong.

Anyway, I have the new version in there now and it works! Thanks for all your help Bacon :slight_smile:


(Demolama) #9

Im having the same problem with the pull down menu in limbo… the ability to choose for example the mp40 as a Allied member

I have the ability to pick one up doing the game… however I cant get it to show up on the limbo menu and therefore the player cant start with it


(shaunf) #10

If you are not playing on the server have you compiled the client DLL and put it in a pk3 file and set sv_pure to 1 on the server?

You also need the client DLL in the mod folder, not in a pk3 if you are playing on the server.


(incoming) #11

yo i am new but i need your help

how i create a pk3 file and when i created something whit the source_code of et were i put the files to it work when i play

plz plz plz plz i need your help and plz explain me whit precision

thx incoming jesuisbon67@hotmail.com


(raffles) #12

A pk3 file is just a zip file renamed to pk3.

I think you mean where do you put the DLLs of some source you have just compiled? Put them in a new folder in your ET folder and create a new shortcut to the ET executable with +set fs_game <foldername>.

eg. If you have your game installed in C:\Program Files\WolfET and you have your DLLs in a folder named incomingmod then the shortcut should be ““C:\Program Files\WolFET\ET.exe” +set fs_game incomingmod”


(Ramoonus) #13

i think its a wicked idea :clap: :drink: :bump:


(incoming) #14

Thank you but when i write the thing i want in the source

how i compile the dll and when i create a map how i do to create a .campaign file ?? plz help me

example goldrush.campaign


(raffles) #15

Info on how to compile in windows is in this sticky thread:
http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=6537

A campaign is a text file with the following syntax:

{
name “<full name of campaign>”
shortname “<shortname of campaign>”
description “<description of campaign>”
maps “<names of maps>”
mapTC 374 374
type “wolfmp”
}

The names of the maps are put in the order you want them to be played and seperated by semi-colons eg. oasis;radar;battery;fueldump;goldrush;railgun


(incoming!) #16

yo guys its me incoming hehe

i have a error when i am trying to compile whit visual c++ 6

here’s the error

Compiling…
bg_misc.c
C:\WolfET_Source\src\game\bg_misc.c(3088) : error C2143: syntax error : missing ‘;’ before ‘||’
C:\WolfET_Source\src\game\bg_misc.c(3089) : error C2059: syntax error : ‘)’
C:\WolfET_Source\src\game\bg_misc.c(3091) : error C2059: syntax error : ‘)’
C:\WolfET_Source\src\game\bg_misc.c(3095) : error C2181: illegal else without matching if
Error executing cl.exe.

cgame_mp_x86.dll - 4 error(s), 0 warning(s)

help me plz i am in window xp

jesuisbon67@hotmail.com


(bacon) #17

Looks like you’re putting a ) at the end of a line (or multiple lines)…DON’T DO THAT


(raffles) #18

Perhaps when you have errors compiling code you should include the lines that you are having problems with?


(incoming!) #19

i got a other error man

--------------------Configuration: cgame - Win32 Debug--------------------
Compiling…
bg_misc.c
Linking…
Creating library Debug/cgame_mp_x86.lib and object Debug/cgame_mp_x86.exp
Le chemin d’accÅ s sp‚cifi‚ est introuvable.
0 fichier(s) copi‚(s).
Error executing c:\windows\system32\cmd.exe.

cgame_mp_x86.dll - 1 error(s), 0 warning(s)
The following environment variables were not found
$(WOLFDIR)

help me plz


(bacon) #20

Goto Project->Settings then scroll down to the “Post-Build” and change the copy path. Or you can copy it manually from the Debug directory.