Open weapon_smg1.cpp
before this line
extern ConVar sk_plr_dmg_smg1_grenade;
add
extern ConVar sk_plr_num_shotgun_pellets;
you can create other variable if you want star something more serious, but for a simple mod is ok!
Now we go to the secondary attack, and found this:
//Create the grenade
QAngle angles;
VectorAngles( vecThrow, angles );
CGrenadeAR2 *pGrenade = (CGrenadeAR2*)Create( "grenade_ar2", vecSrc, angles, pPlayer );
pGrenade->SetAbsVelocity( vecThrow );
pGrenade->SetLocalAngularVelocity( RandomAngle( -400, 400 ) );
pGrenade->SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
pGrenade->SetThrower( GetOwner() );
pGrenade->SetDamage( sk_plr_dmg_smg1_grenade.GetFloat() );
we need to comment this code, no more no less than this code...
and bellow that we add this:
Vector vecAiming = pPlayer->GetAutoaimVector( AUTOAIM_SCALE_DEFAULT );
pPlayer->SetMuzzleFlashTime( gpGlobals->curtime + 1.0 );
// Fire the bullets, and force the first shot to be perfectly accuracy
pPlayer->FireBullets( sk_plr_num_shotgun_pellets.GetInt(), vecSrc, vecAiming, GetBulletSpread(), MAX_TRACE_LENGTH, m_iSecondaryAmmoType, 0, -1, -1, 0, NULL, true, true );
pPlayer->ViewPunch( QAngle( random->RandomFloat( -2, -1 ), random->RandomFloat( -2, 2 ), 0 ) );
Ok thats all in .cpp (actually you can comment more code about the grenade, wich will be useless, but you will no had compilation problems.
now we need to edit our weapon_smg1.cfg in ours mod folder/script
you must replace:
"clip2_size" "-1"
by
"clip2_size" "1"
and replace
"secondary_ammo" "SMG1_Grenade"
by
"secondary_ammo" "Buckshot"
And at last if you want you can change the sound of the shot, but the grenadelauncher sounds isnt bad for me. Anyway find this line
"double_shot" "Weapon_SMG1.Double"
and replace by
"double_shot" "Weapon_Shotgun.Single"
well compile and check! if theres some bug PM me!
Good luck
i cannot find weapon_smg1.cpp!
same here
it is located in server/hl2 or something like that.
I get a compile error that says: 'CBaseEntity::FireBullets' : no overloaded function takes 13 arguments
Weird... you should copy the firebullets from your shotgun file, maybe valve updates the SDK or maybe you are using a diferent version of SDK
You can also go to scripts smg 1 or 2 and change the ammotype to buckshot, then change the sounds too, a whole lot easier.
Sure that work? I mean I think that would consume shotgun ammo but shoot grenades, but well I dont know about the scripting of HL2