Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

Adding weapons with Skill

- - - - -

  • Please log in to reply
No replies to this topic

#1
OFFLINE   sCenna.

sCenna.

    Newbie

  • Members
  • Pip
  • 6 posts
0
Unknown
Tutorial: Become a new Weapons when u reach Medic Skill Level 4 and/or Engi Skill Level 4:

(Etpub 0.91 / Chaos 0.1.5)



File: cgame/cg_limbopanel.c



In:

	void CG_LimboPanel_WeaponPanel( panel_button_t* button ) {

Search:

		// render in expanded mode ^

		for( i = 0, x = 1; i < cnt; i++ ) {

			weapon_t cycleWeap = CG_LimboPanel_GetWeaponForNumber( i, cgs.ccSelectedWeaponNumber, qtrue );

			if( cycleWeap != weap ) {

				CG_LimboPanel_WeaponPanel_DrawWeapon( &rect, cycleWeap, qtrue, va( "%iof%i", i+1, cnt ), CG_LimboPanel_RealWeaponIsDisabled( cycleWeap ) );



				if( BG_CursorInRect( &rect ) ) {

					if( button->data[7] != x ) {

						SOUND_FOCUS;



						button->data[7] = x;

					}

				}



				rect.y -= rect.h;

				x++;

			}

		}



Change it with:

		// render in expanded mode ^

		for( i = 0, x = 1; i < cnt; i++ ) {

			weapon_t cycleWeap = CG_LimboPanel_GetWeaponForNumber( i, cgs.ccSelectedWeaponNumber, qtrue );

			if( cycleWeap != weap && (

				cycleWeap != WP_SHOTGUN || cycleWeap != WP_PPS43 || 

				cgs.clientinfo[cg.clientNum].skill[SK_EXPLOSIVES_AND_CONSTRUCTION] >= 5 ||

				cgs.clientinfo[cg.clientNum].skill[SK_FIRST_AID] >= 5)) {



				CG_LimboPanel_WeaponPanel_DrawWeapon( &rect, cycleWeap, qtrue, va( "%iof%i", i+1, cnt ), CG_LimboPanel_RealWeaponIsDisabled( cycleWeap ) );



				if( BG_CursorInRect( &rect ) ) {

					if( button->data[7] != x ) {

						SOUND_FOCUS;



						button->data[7] = x;

					}

				}



				rect.y -= rect.h;

				x++;

			}

		}

...



Search:

int CG_LimboPanel_WeaponCount_ForSlot( int number ) {

	if( number == 1 ) {

		bg_playerclass_t* classInfo = CG_LimboPanel_GetPlayerClass();

		int cnt = 0, i;



		for(i = 0; i < MAX_WEAPS_PER_CLASS; i++) {

			if( !classInfo->classWeapons[i] ) {

				break;

			}



			cnt++;

		}

		return cnt;

	} else {

		if( cgs.clientinfo[cg.clientNum].skill[SK_HEAVY_WEAPONS] >= 4 && CG_LimboPanel_GetClass() == PC_SOLDIER ) {

			if( cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4 ) {

				return 3;

			} else {

				return 2;

			}

		} else {

			if( cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4 ) {

				return 2;

			} else {

				return 1;

			}

		}

	}

}



Change it with:

int CG_LimboPanel_WeaponCount_ForSlot( int number ) {

	if( number == 1 ) {

		bg_playerclass_t* classInfo = CG_LimboPanel_GetPlayerClass();

		int cnt = 0, i;



		for(i = 0; i < MAX_WEAPS_PER_CLASS; i++) {

			if( !classInfo->classWeapons[i] ) {

				break;

			}

			

			// dont count Shotgun if disabled

			if (classInfo->classWeapons[i] == WP_SHOTGUN && !( cgs.clientinfo[cg.clientNum].skill[SK_EXPLOSIVES_AND_CONSTRUCTION] >= 5 ))

				continue;

			if ( classInfo->classWeapons[i] == WP_PPS43 && !( cgs.clientinfo[cg.clientNum].skill[SK_FIRST_AID] >= 5 ))

				continue;

				

			cnt++;

		}

		return cnt;

	} else {

		if( cgs.clientinfo[cg.clientNum].skill[SK_HEAVY_WEAPONS] >= 4 && CG_LimboPanel_GetClass() == PC_SOLDIER ) {

			if( cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4 ) {

				return 3;

			} else {

				return 2;

			}

		} else {

			if( cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4 ) {

				return 2;

			} else {

				return 1;

			}

		}

	}

}



File: game/bg_classes.c

Search PC_Medic and PC_Engineer

Add then the weapon, but they must to be the last weapons!

Dont forgott to make these on Axis and Allied!!!!

	{

		PC_MEDIC,

		"characters/temperate/allied/medic.char",

		"ui/assets/mp_health_blue.tga",

		"ui/assets/mp_arrow_blue.tga",

		{ 

			WP_THOMPSON,

			WP_M3A1,

			WP_PPS43 //must to be the last weapon

		},	

	},



	{

		PC_ENGINEER,

		"characters/temperate/allied/engineer.char",

		"ui/assets/mp_wrench_blue.tga",

		"ui/assets/mp_arrow_blue.tga",

		{ 

			WP_THOMPSON,

			WP_CARBINE,

			WP_M3A1,

			WP_BREN,

			WP_SHOTGUN //must to be the last weapon

		},	

	},



	

File: game/g_client.c

These will fix the /class e 5 2 command

qboolean _SetMedicSpawnWeapons(gclient_t *client) 

{

	weapon_t w;

	weapon_t w2;

	w = client->sess.latchPlayerWeapon;

	if(client->sess.sessionTeam == TEAM_AXIS) {

		switch(w) {

			case WP_PPS43:

				if( client->sess.skill[SK_FIRST_AID] <= 4 ) //If Skill Level 5 reached: Allow ppsh43

					w = WP_MP40;

				break;

			case WP_MP44:

			case WP_MP40:

			case WP_M3A1:

				break;

			default:

				w = WP_MP40;

		}

		AddWeaponToPlayer(client, WP_GRENADE_LAUNCHER, 0, 1, qfalse);

		w2 = G_BestSecWeaponForClient( client );

		if( w2 == WP_AKIMBO_LUGER && 

				(g_medics.integer & MEDIC_NOAKIMBO) ) {

			w2 = WP_LUGER;

		}

	}

	else if(client->sess.sessionTeam == TEAM_ALLIES) {

		switch(w) {

			case WP_PPS43:

				if( client->sess.skill[SK_FIRST_AID] <= 4 ) //If Skill Level 5 reached: Allow ppsh43

					w = WP_THOMPSON;

				break;

			case WP_BAR:

			case WP_THOMPSON:

			case WP_M3A1:

				break;

			default:

				w = WP_THOMPSON;

		}

		AddWeaponToPlayer(client, WP_GRENADE_PINEAPPLE, 0, 1, qfalse);	



		w2 = G_BestSecWeaponForClient( client );

		if( w2 == WP_AKIMBO_COLT && 

				(g_medics.integer & MEDIC_NOAKIMBO) ) {



....





qboolean _SetEngineerSpawnWeapons(gclient_t *client) 

{

	weapon_t w = client->sess.latchPlayerWeapon;

	weapon_t w2 = G_BestSecWeaponForClient( client );

	if(client->sess.sessionTeam == TEAM_AXIS) {

		switch(w) {

			case WP_SHOTGUN:

				if( client->sess.skill[SK_EXPLOSIVES_AND_CONSTRUCTION] <= 4 ) //If Skill Level 5 reached: Allow Shotgun

					w = WP_MP40;

				break;

			case WP_KAR98:

			case WP_MP40:

			case WP_M3A1:

			case WP_BREN:

				break;

		default:

			w = WP_MP40;

		}

		AddWeaponToPlayer(client, WP_GRENADE_LAUNCHER, 0, 4, qfalse);	

	} else if(client->sess.sessionTeam == TEAM_ALLIES) {

		switch(w) {

			case WP_SHOTGUN:

				if( client->sess.skill[SK_EXPLOSIVES_AND_CONSTRUCTION] <= 4 ) //If Skill Level 5 reached: Allow Shotgun

					w = WP_THOMPSON;

				break;

			case WP_CARBINE:

			case WP_THOMPSON:

			case WP_M3A1:

			case WP_BREN:

				break;

		default:

			w = WP_THOMPSON;

		}

		AddWeaponToPlayer(client, WP_GRENADE_PINEAPPLE, 0, 4, qfalse);

	} else {

		return qfalse;

	}

	

	

	

Credits: Nq-Mod and Chaos-Mod





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users