• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

[mutator] WeaponConfig - edit weapons during gameplay

Hi,
mutator WeaponConfig allows you to edit weapon settings on the fly. it works for netplay too. all changes send to clients, so they syncronized.

how it works.
admin type in console
mutate wpn menu (admin can bind it to button for fast access)
2012-12-09_122954.jpg


menu showed
2012-12-09_123141.jpg


values are for currently selected weapon. if this weapon not edited before, all it current parameters grabbed and saved to weaponconfig.ini on serverside. Look like this:
Code:
[WTFEquipAK48S WeaponConfigObject]
WeaponClass=UnitedMut_v54.WTFEquipAK48S
Damage[0]=(Value=45.000000,BonusMax=0.000000,BonusLog=0.000000)
Damage[1]=(Value=0.000000,BonusMax=0.000000,BonusLog=0.000000)
HeadMult[0]=(Value=1.100000,BonusMax=0.000000,BonusLog=0.000000)
HeadMult[1]=(Value=1.000000,BonusMax=0.000000,BonusLog=0.000000)
cost=(Value=1000.000000,BonusMax=0.000000,BonusLog=0.000000)
AmmoCost=(Value=10.000000,BonusMax=0.000000,BonusLog=0.000000)
Capacity[0]=(Value=300.000000,BonusMax=0.000000,BonusLog=0.000000)
Capacity[1]=(Value=0.000000,BonusMax=0.000000,BonusLog=0.000000)
MagSize=(Value=30.000000,BonusMax=0.000000,BonusLog=0.000000)
Weight=(Value=6.000000,BonusMax=0.000000,BonusLog=0.000000)
FireRate[0]=(Value=0.110000,BonusMax=0.000000,BonusLog=0.000000)
FireRate[1]=(Value=0.000000,BonusMax=0.000000,BonusLog=0.000000)
ReloadRate=(Value=3.000000,BonusMax=0.000000,BonusLog=0.000000)
Spread[0]=(Value=0.010000,BonusMax=0.000000,BonusLog=0.000000)
Spread[1]=(Value=0.000000,BonusMax=0.000000,BonusLog=0.000000)
RecoilX[0]=250.000000
RecoilX[1]=0.000000
RecoilY[0]=500.000000
RecoilY[1]=0.000000
AllowInShopAt=(Value=0.000000,BonusMax=0.000000,BonusLog=0.000000)
DamageType[0]=Class'UnitedMut_v54.WTFEquipDamTypeAK48S'
DamageType[1]=None
AmmoClass[0]=Class'KFmod.AK47Ammo'
AmmoClass[1]=None
PickupClass=Class'UnitedMut_v54.WTFEquipAK48SPickup'

you can edit not only values, but perk bonuses for weapon.
First in bottom right corner you need to specify what perks will get bonuses.
2012-12-09_130935.jpg

then set BonusMax and BonusLog too.

You can use this mutator without perk bonuses, and only edit standart weapon settings.
I say at start that bonuses will work only after you edit ServerPerks files so it is a little difficult. ill explain later.

BonusMax - is the max bonus to value. for example if standart weapon damage is 100 and BonusMax is 2, then player with highest perk level will have 200 damage from this weapon. if perk level is middle, then it will have only half of BonusMax.

Because MinPerkLevel and MaxPerkLevel in serverPerks can be changed, need to add some routine to SRVeterancyTypes to calculate level coefficient. so if min perk level 6 and max perk level 14, then perk level 10 will have coefficient 0.5. and will get 0.5 * BonusMax

BonusLog - is value that allow you select how BonusMax will grow for perk levels.

if BonusLog zero 0 , then coefficient is linear, so middle perk will get exactly 0.5 * BonusMax
if BonusLog positive (0 to 1), then progress will be fast at start and slow at end, so for middle perk level you will have 0.75 * BonusMax

if BonusLog negative (-1 to 0) then progress will be slow at start and fast at end perk levels, so middle perk level will have coeff 0.25 * BonusMax

BonusLog is float, so you can set BonusLog not 1, but for example 0.3, so players will get bonuses at start a little faster.

for Bonus system work you need to edit VeterancyTypes in ServerPerks.
add to SRVeterancyTypes.uc
Code:
var int lvlmin, lvlmax;
//--------------------------------------------------------------------------------------------------
static function float GetLogCoeff(float lvl, float log)
{
	local float lvlmult, float1;
	lvlmult = GetLevelMult(lvl);
	float1 = (0.f-log)*(lvlmult**2.f) + (1.f+log)*(lvlmult);
	float1 = FClamp(float1,0.f,1.f);
	return float1;
}
//--------------------------------------------------------------------------------------------------
static function float GetLevelMult(float cur)
{
	if (default.lvlmin==0)
		default.lvlmin = class'ServerPerksMut'.default.MinPerksLevel;
	if (default.lvlmax==0)
		default.lvlmax = class'ServerPerksMut'.default.MaxPerksLevel;
	cur = Max(0,cur - default.lvlmin);
	return cur / (float(default.lvlmax) - float(default.lvlmin));
}
//--------------------------------------------------------------------------------------------------
static function float GetMagCapacityMod(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	return class'WeaponConfig'.static.GetMagCapacityBonus(Other, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel));
}
//--------------------------------------------------------------------------------------------------
static function float GetCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	return class'WeaponConfig'.static.GetCostBonus(Item, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel));
}
//--------------------------------------------------------------------------------------------------
//static function float GetAmmoPickupMod(KFPlayerReplicationInfo KFPRI, KFAmmunition Other);
//static function float GetShotgunPenetrationDamageMulti(KFPlayerReplicationInfo KFPRI, float DefaultPenDamageReduction)
//static function float GetReloadSpeedModifier(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
//static function int ZedTimeExtensions(KFPlayerReplicationInfo KFPRI)
//static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
//--------------------------------------------------------------------------------------------------
static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType)
{
	return class'WeaponConfig'.static.GetCapacityBonus(AmmoType, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel));
}
//--------------------------------------------------------------------------------------------------
static function float GetHeadShotDamMulti(KFPlayerReplicationInfo KFPRI, KFPawn P, class<DamageType> DmgType)
{
	return class'WeaponConfig'.static.GetHeadMultBonus(DmgType, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel) );
}
//--------------------------------------------------------------------------------------------------
static function int AddDamage(KFPlayerReplicationInfo KFPRI, KFMonster Injured, KFPawn DamageTaker, int InDamage, class<DamageType> DmgType)
{
	local float flt;
	flt = class'WeaponConfig'.static.GetDamageBonus(DmgType, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel), InDamage);
	return Round(float(InDamage) * flt);
}
//--------------------------------------------------------------------------------------------------
static function float ModifyRecoilSpread(KFPlayerReplicationInfo KFPRI, WeaponFire Other, out float Recoil)
{
	Recoil = class'WeaponConfig'.static.GetSpreadBonus(Other.Weapon, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel) );
	return Recoil;
}
//--------------------------------------------------------------------------------------------------
static function float GetFireSpeedMod(KFPlayerReplicationInfo KFPRI, Weapon Other)
{
	return class'WeaponConfig'.static.GetFireRateBonus(Other, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel) );
}
//--------------------------------------------------------------------------------------------------
static function float GetReloadSpeedModifier(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	return class'WeaponConfig'.static.GetReloadRateBonus(Other, KFPRI.ClientVeteranSkill, GetLevelMult(KFPRI.ClientVeteranSkillLevel) );
}
//--------------------------------------------------------------------------------------------------

and in every SRVetCommando and others you need to call Super statements:
Code:
static function float GetMagCapacityMod(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	local float ret;
	// trying to get value from weaponconfig
	ret = Super.GetMagCapacityMod(KFPRI, Other);
	if (ret!=0 && ret!=1)
		return ret;
		
	// if value we get is standart (0 or 1) then BonusMax is not used or weapon not found in config
	// so continue with usual bonus mechanism
	else if( (Bullpup(Other) != none
		|| WTFEquipAK48S(Other) != none
		|| WTFEquipSCAR19a(Other) != none
		|| WTFEquipBulldog(Other) != none
		|| AK47AssaultRifle(Other) != none
		|| SA80AssaultRifle(Other) != none
		|| FnFalAssaultRifle(Other) != none
		|| FnFalAAssaultRifle(Other) != none
		|| M7A3CAssaultRifle(Other) != none
		|| SCARMK17AssaultRifle(Other) != none
		|| VALAssaultRifle(Other) != none
		|| FNFAL_ACOG_AssaultRifle(Other) != none
		|| MKb42AssaultRifle(Other) != none
        || ThompsonSMG(Other) != none
		|| M4AssaultRifle(Other) != none ) && KFPRI.ClientVeteranSkillLevel > 0 )
	{
		if ( KFPRI.ClientVeteranSkillLevel == 1 )
			return 1.10;
		else if ( KFPRI.ClientVeteranSkillLevel == 2 )
			return 1.20;
		return 1.25; // 25% increase in assault rifle ammo carry
	}
	return 1.0;
}

Mutator line: WeaponConfig.WeaponConfig
Download link

source code: https://github.com/DaveScream/WeaponConfig
if you want help, write to me Ill add you to collaborators for this project on github, so we can work and push changes to code together

this mutator uses:
poosh - StringReplicationInfo (modifyed for CRC control)
Benjamin's WeaponStat grabber (modifyed to not only get weapon parameters, but set it too)

thanks to
as always my hero #1 - Marco (sorry if I bother you too often)
Dr.Killjoy (helped me with dependson statement)
Wormbo from epicgames for help with replication from Client to Server
and my team Operatsiya Y
 
Last edited:
quick question

quick question

is it possible to change the damage type for each weapon with this mutator (eg. shotgun with explosive rounds) and do the values get saved once changed on serverside/clientside or both if at all?

This looks really interesting but am a little nervous about implementing it into my server right now.
 
Upvote 0
thank you guys so pleasant to me to make somethink and look at positive feedback ;)

is it possible to change the damage type for each weapon with this mutator (eg. shotgun with explosive rounds) and do the values get saved once changed on serverside/clientside or both if at all?

This looks really interesting but am a little nervous about implementing it into my server right now.
I think yes it may be possible to change damagetype, but i never tryed. will try today evening. All changes send and saved on serverside ini file immediately after menu on client is closed (if no cancel button pressed). and after it all changes applyed on server and replicated to clients (then applyed on client too).

The main problem is possibility of 'on the fly' damagetype changes.

Maybe Benjamin know somethink about it). Maybe some trick with destroy weapon on all clients and spawn it with new settings.
 
Last edited:
Upvote 0
Hey This is a really ambitious and truly desired tool! I have to ask sadly as I have some problems installing the mod. I'm fairly new to modding and was wondering on how to do it right.
Hi,
Lets try to understand why it is not working.

1. Please, download and use the debug version:WeaponConfigDebug.7z

2. Answer the questions
-What server type you use? Dedicated or Standalone or Listen?
-Do you use ServerPerks mutator?

3.You need to add mutator with
Code:
WeaponConfig.WeaponConfig

4. In debug version, WeaponConfig.ini have bOnlyAdmins=false, so you dont need to login as admin, so just open console and type:
Code:
mutate WPN Menu

5. You must see the menu, and these messages.
2012-12-15_111055.jpg


6. If you dont see menu:
- do you see messages like on screenshot?
- do you see in log file (ucc.log if dedicated, killingfloor.log if Listen or Standalone server) the string:
Code:
WeaponConfig: Loading...
 
Last edited:
Upvote 0