Loathsomes Weapons Tweak - RC2

Need some nice Mods? Here, you are right!
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Loathsomes Weapons Tweak - RC2

Post by MrLoathsome »

I decided a few weeks ago I needed a way to get the low-powered default U1 and UT guns on my maps somehow adjusted
so that they would be useful on a server where I am adding a bunch of extra overpowered guns and overpowered monsters with
too much health.

RC2 Changes:

1. Eliminate bBruteForce config variable.
2. Improved detection of weapons damage variables.*
3. Added "ChunkDamage" config variable for FlakCannon Primary Fire.
4. Added Delete Button to Mod Menu. Allows weapons to be deleted from the list.
5. Supports 254 unique weapons classes in the list. (#255 reserved for Delete function)
6. Number of code optimizations. No longer spawns/destroys anything when loading the list.
7. Slightly improved formatting on log file lines for bDebug mode.
--------------------

So here it is:
LWT-RC2_Menu.jpg
All new info regarding RC2 is in the ReadMe.txt file.

The ReadMe.txt file. (READ IT!!! :help: )
Spoiler
9:35 PM 6/27/2018

RC2 Changes:

1. Eliminate bBruteForce config variable.
2. Improved detection of weapons damage variables.*
3. Added "ChunkDamage" config variable for FlakCannon Primary Fire.
4. Added Delete Button to Mod Menu. Allows weapons to be deleted from the list.
5. Supports 254 unique weapons classes in the list. (#255 reserved for Delete function)
6. Number of code optimizations. No longer spawns/destroys anything when loading the list.
7. Slightly improved formatting on log file lines for bDebug mode.


Loathsome's Weapon Tweak Instructions.

This mutator attempts to give full control over weapons, projectile and scriptedpawn damage.

The intent is to provide a way to balance all the weapons/damage without altering the default
properties or behaviors other than the damage done.

No need to track down the exact weapons/projectiles class names, damage amounts etc. as this will
automatically build the list of weapons as they are picked up by the players/bots/monsters.

After the list is built, you may edit each weapons damage via the Mod Menu with new values
that will be used next time you run it.
*You can adjust the other options at the menu before actually running it and building your list.

Having weapons in the list that are not on your current map/config is no issue.
The list gets loaded once at level start. Weapons in the list not currently being used
will be ignored. The classes do not even need to be available in your current game/config.

This only modifies weapons/chunks in the map as they are spawned.

If you want the list to be 'optimized', get the weapons that will be spawning the most
often in your games at the front of the list.


The Config Variables:

bDebug=False
DamageMult=1.000000
SPDamMult=1.000000
ChunkDamage=16.000000
MaxAdjVal=15


bDebug:

Enables extra info in the log file.

Will list all the weapons in the list and the damage values for each when map loads and also
output a log file line when a new weapons class is detected and added to the ini file list.

Also will log a line for all damage done by players/bots and/or by most scripted pawns to players/bots.
Some 3rd party monster packages such as AKcoop2 bypass the default MutatorTakeDamage and other code.
Damage done to such pawns will not get logged by this mutator.

This can result in a very large log file if you play a long time or are running the mutator on a server.

Recommended setting is False after you have things adjusted the way you want.


DamageMult/MaxAdjVal:

These 2 variables are used to adjust damage done by high fire-rate weapons that have no adjustable Primary, Secondary or
HitDamage variables. Which is pretty much just the MiniGuns, SniperRifles and variants.

The mutator will multiply the actual damage done by DamageMult if the actual damage done is below the MaxAdjVal.

Recommended setting for DamageMult 2-20 ? For MaxAdjVal 12-41 ?

You will have to test with bDebug on a bit and determine the best number here for your needs.
The exact amount of damage done varies depending upon difficulty settings, bot skill settings, aim, weapons being used,
are monsters on the maps, etc etc.

You want to keep DamageMult a bit below the lowest damage value you have set for other weapons that are adjustable
in the weapons list. (Unless you WANT the overlap, and have adjusted the damage values with that in mind...)
You can set it higher, but be aware that ANY "AcutalDamage" done by players/bots that is below the MaxAdjVal will get
multiplied by this DamageMult variable.

If you want to scale EVERYTHING by a fixed amount, set MaxAdjVal higher than the max damage value any of the weapons in your list
show. Remember, if you adjust any adjustable damages for a weapon and are still below the MaxAdjVal setting, those will be multiplied by
the DamageMult setting.


SPDamMult:

This variable can be used to scale ALL damage done to players/bots by scripted pawns. (Monsters)

Set at 2 for 2x damage. Set at 0.50 for 50% damage. Set lower than 0.10 to make the monsters weak and useless.
0.50 - 0.20 range seems to work good if you have Skaarj or other monsters using the same weapons as you are.

Just leave it at 1.0 if you have no monsters in your games or want them to not be adjusted.


ChunkDamage:

This variable was added to give more adjustability to the FlakCannon Primary Fire.

Due to the way the U1/UT Flakcannons handle the "Chunks" they fire, RC1 of this mutator would
only adjust them if the MaxAdjVal was greater than 16. (16-24?) Then they would be adjusted
via the DamageMult setting. Changing the detected FlakCannon Primary Damage value had no effect.

I added this ChunkDamage variable to support Chunks spawned by the default BotPack.UT_FlakCannon and the
Unreali.Flakcannon. This should work with any other FlakCannons that also spawn chunks that extend either
the UT or U1 chunks. (Tested with OLweapons.OLFlakCannon, but no others...)

I coded this bit in a way so it should also work with any other weapons that might fire those Chunks, although I know
of none.

You should set the FlakCannon Primary Fire value to 0 in the config menu when setting things up.
Then you will remember to use the ChunkDamage variable for any future Flak Primary Damage adjustments.

Note: The default FlakCannon Secondary fire also spawns a number of these chunks in addition to its default Secondary Damage amount.
They will also be adjusted to your ChunkDamage setting.


-----------------------------

Recommended Usage Notes:

First you should do a practice match with the mutator running to get the weapons list populated.
Weapons get added in the order they are spawned/picked up, so pick up the ones that are going
to be used/respawn the most often first. (Set game for 0 bots if you want a specific order...)

You can just summon them in order if you do know the class names.

You will then have a list of those weapons in the ini with their original default values.
(Might want to make a backup copy of the ini at that point.)

Then you are ready to adjust the DamageMult and MaxAdjVal for the MiniGuns and other low-damage/high fire rate
weapons so that they are working how you want for your games.

Next, you should set the adjustments for any individual weapons that have adjustable Primary, Secondary or Hitdamage values
available in the Mod Menu configuration window. If the value is 0 it is not adjustable or editable by the Mod Menu. (Mostly)

Note, if you are using the Advanced Preferences or editing the ini with Notepad, changing any values with a 0 default value
wont help you any. (Will get ignored...) You can only adjust values that have a non-zero number.

If you have multiple guns in the list that share the same projectile class, the last one in the list will override
the previous guns settings. Also any monsters that use a projectile class that has been adjusted by this will get the
same settings for that projectile as set for the players weapon that uses that projectile. (Before the SPDamMult kicks in)

Re: SniperRifles/Miniguns + ?

These and other weapons that have damage hardcoded will only be adjustable via playing with the DamageMult and MaxAdjVal variables.

Best fix for the SniperRifles is to use a SniperRifle class that is doing the amount of damage that your games require.

Then set your DamageMult and MaxAdjVal at what works best for the minigun(s) you might be using, and tweak the other weapons
as needed to balance things how you want.

Note: I ran a test were I set the DamageMult at 3x, and set MaxAdjVal at 200 or higher. (Default Sniper does 150 damage on headshot...)
I then set the adjustable damage values to 1/3 of the default setting for all the other weapons.

This gave me a nice bot match where Minigun and Sniper did 3x damage, but all other weapons were pretty much at default.
Just an example of how configurable this thing is now.


Couple of extra configuration/usage notes:

If you have the Advanced Options menus enabled, you can use that to adjust the settings. Keep in mind you must not have
any blank elements in the weapons array. It will stop loading the list when it encounters the first empty spot in the list.
Same applies if you are using Notepad to edit the ini.

Recommend using the Mod Menu to delete weapons from the list if needed.

If you regret any settings you have made for a weapon, or just want to reset that specific weapon to its default values and start
over with it, just use the new Delete button in the menu. Next time the mutator detects that weapon, it will be added to the end
of the list with its original default values.
Once you set any of the weapons damage values to zero, the menu will force you to ignore it in the future. Only way to reset that
is to delete it and let the mutator add it back next time it spawns. (Or use notepad/Adv Options to edit it...)

Some weapons might be detected with Damage values the weapon does not actually use.

For Example: "Botpack.SuperShockRifle"

It only uses the HDamage(hitdamage) variable for the actual damage it does from either Primary or Secondary Fire buttons.
But it inherits a Secondary Damage value of 40 from its parent class which this mutator detects.
You could adjust that via the menu, but it would do nothing for you at all as the weapon does not use it.
Either ignore it OR set it to zero.

---

You must restart your game/practice match after making any changes to the settings via the Mod Menu for your changes to take effect.


Enjoy!

*Credit to sektor211@UT99.org for reminding me of a better way to detect some of the weapons damage values.
I attempted to make this so it will work with all gametypes, weapons, mods etc. But of course no way to test with all of them. :ironic: :what:
Post any questions or bug reports in this thread. (Does it work with MH? :???: )

As always, full source included. This time I actually attempted to put useful comments in it.
If anybody looks at that, let me know if you see anything horrible, redundant or left out.
Had to come up with some new methods for some of this as I was unable to find good examples of what I needed to do.
(New to me anyway. Tell me if I am re-inventing the wheel here. And if so, does it roll faster? :satan: )

*I am testing an alpha version of a Monster Tweaker that uses the same methods. (Builds the list automagically etc...)
Currently it only lets you adjust Health and DamageScaling. May post that also if there is any interest.
You do not have the required permissions to view the files attached to this post.
Last edited by MrLoathsome on Thu Jun 28, 2018 9:26 am, edited 3 times in total.
blarg
User avatar
Hook
Inhuman
Posts: 754
Joined: Tue Apr 22, 2008 11:21 pm
Personal rank: UT99 Promoter/Admin
Location: Minnesota USA

Re: Loathsomes Weapons Tweak

Post by Hook »

Hey MrLoathesome, this looks both well done and useful.
Thank you! :tu:
=Hook=(Member# 626)
HUTP Active Forums: https://hooksutplace.freeforums.net/forum
HUTP UT99 Community Portal: https://hooksutplace.freeforums.net/
OR: https://hermskii.com/hook/ut99_hutp/
UT99 Server -> CROSSBONES Missile Madness {CMM}

* Newest Versions of: PRO-Redeemers | PRO-SNIPER-Redeemers | PRO-SEEKER-Redeemers <-(the Original)
and Now with FOOD FIGHT and Frying Pan arena !!!
IP: 68.232.181.236:7777 <-(NEW IP to come)
UT99 MH Server -> {CMH} CROSSBONES Monster Hunt (MH) by Mars007 (The Original) - IP: 108.61.238.93:7777
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Loathsomes Weapons Tweak

Post by sektor2111 »

MrLoathsome wrote:Post any questions or bug reports in this thread. (Does it work with MH? :???: )
Maybe if other mutator will help MH else THERE IS NO OLD Weapon in MH according to MonsterBase (except other MH versions e.g. XC_MonsterHunt - configurable)
See that MonsterBase snippet here...

Code: Select all

	if ( Other.IsA('Weapon') )
	{
		if ( Other.IsA('TournamentWeapon') )
			return true;

		if ( Other.IsA('UIWeapon') ) //Engine cannot handle grammar...
			return true;

		if ( Other.IsA('Stinger'))
		{
			ReplaceWith(Other, "MonsterHunt.OLStinger");
			return false;
		}

		if ( Other.IsA('Rifle'))
		{
			ReplaceWith( Other, "MonsterHunt.OLRifle" );
			Return false;
		}
...
Where you can ignore a default MH useless code (it's UIWeapons and UIWeapons is a TournamentWeapon so that line is not even needed and has wrong spelling anyway )...
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Loathsomes Weapons Tweak

Post by MrLoathsome »

Hmmmm....

Well the buggy and sloppy MH code is very nice, but is totally irrelevant to how my mutator works. :what:
(You must not have looked at the source code yet...)

This mutator should detect the MonsterHunt.OLStinger just fine and add it to the list.

Note, if this MH.OLStinger does use the same default ProjectileClass as the default Stinger, whichever of
them is listed last in the ini file will over-ride any previous settings by other Stingers in the ini.

If the MH.OLStinger DOES have its own unique and separate ProjectileClasses, you will be able to
adjust them independently.

This also applies for ANY weapons that might happen to share the same Projectile/AltProjectile Classes.
blarg
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Loathsomes Weapons Tweak

Post by sektor2111 »

Light me here

Code: Select all

function SetWeapDamage(int i)  // sets any adjustable weapon/projectile class defaults for current match/level from ini file values
{
	local Weapon TW;
	local class<Weapon> WC;

	WC = class<Weapon>(DynamicLoadObject(WCList[i].WeapC, class'Class'));
	TW = Spawn(WC);
	if (TW != None)
	{
		if (TW.IsA('Enforcer')) Enforcer(TW).default.hitdamage = WCList[i].HDamage;
		else if (TW.IsA('AutoMag')) AutoMag(TW).default.hitdamage = WCList[i].HDamage;
		else if (TW.IsA('ShockRifle')) ShockRifle(TW).default.hitdamage = WCList[i].HDamage;
		else if (TW.IsA('ASMD')) ASMD(TW).default.hitdamage = WCList[i].HDamage;
		if ((TW.ProjectileClass != None) && (TW.ProjectileClass.default.damage != WCList[i].PDamage))
			TW.ProjectileClass.default.damage = WCList[i].PDamage;
		if ((TW.AltProjectileClass != None) && (TW.AltProjectileClass.default.damage != WCList[i].SDamage))
			TW.AltProjectileClass.default.damage = WCList[i].SDamage;

		if ((TW.ProjectileClass == Class'Botpack.UTChunk') || (TW.ProjectileClass == Class'UnrealI.Chunk'))  // handle the default flak chunks....
		{
			Class'Botpack.UTChunk1'.default.damage = TW.ProjectileClass.default.damage;
			Class'Botpack.UTChunk2'.default.damage = TW.ProjectileClass.default.damage;
			Class'Botpack.UTChunk3'.default.damage = TW.ProjectileClass.default.damage;
			Class'Botpack.UTChunk4'.default.damage = TW.ProjectileClass.default.damage;
			Class'UnrealI.Chunk1'.default.damage = TW.ProjectileClass.default.damage;
			Class'UnrealI.Chunk2'.default.damage = TW.ProjectileClass.default.damage;
			Class'UnrealI.Chunk3'.default.damage = TW.ProjectileClass.default.damage;
			Class'UnrealI.Chunk4'.default.damage = TW.ProjectileClass.default.damage;
		}

		TW.Destroy();
	} else if (bDebug) log("LWT SetWeapDamage:"@WCList[i].WeapC@Spawn Failure...);
}
Maybe I have to explain that OLAutomag is Not an Automag, it is a TournamentWeapon since forever - child of UIWeapons - child of TournamenWeapon. To reconfigure my opinion I did not see to many sub-classes of "Weapon" because before XCGE (and/or my crapped "tweaker" and your tweaks) they never worked properly ON-Line so to speak not many "modders/coders" did weapons but... TournamentWeapons.
Your code is attacking by example Automag, we cannot speak about any OLAutomag so light me what exactly works and how does it work in MonsterHunt. Because these "weapons" are TournamentWeapon types not Automag or ASMD child weapons. Here indeed OLDPistol is detected properly based on projectiles, but others None.

Code: Select all

class OLASMD expands UIweapons;

Code: Select all

class OLDpistol expands UIweapons;
...
And then

Code: Select all

class UIweapons expands TournamentWeapon config (MonsterHunt)
If I'm thinking well code for Automag is not even called during game in such a default case. Also "projectileclass" do seems restrictive to that class which is not even used in MH. All MH stuff means OSProjectile OLWeapon. Fix me if I'm wrong. I do have some clue about those MH things because not a single time they bugged me.
Other "weapons" like Rifle and Minigun do not seems to have a deal here. Mutator does more damage when those DamageMult, SPDamMult are set else for weapons with hard-coded damage it doesn't adjust anything than damage taken - see also Minigun2 detected configuration... I think projectiles specific values are not that important at this point since not all weapons can be changed this way but adjusting a damage scaling factor can be more suitable here.
What I do like in this mutator is that configuration menu, it is really nice.
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Loathsomes Weapons Tweak

Post by MrLoathsome »

For classes that do have and use the 'hitdamage' value, such as Automag/ASMD etc, the only fix, as you noticed, would be to add
the specific checks for those in the code and recompile it. (I haven't looked at or played MH in several years. Only played it a few times ever...)
Feel free to add MH support if you wish. (Just change the name of the thing somehow.... :confused2: :roll: )

It would have been easier to just scale all damage as you mention, but I wanted more control. There were some weapons that I did not want to have adjusted.
And I didn't want the thing checking some big "Exclude List" in MutatorTakeDamage, as it would be slow and there is no reliable way to determine
exactly which weapon did the ActualDamage.
----------

Unrelated note:

I did noticed 1 minor glitch relating to weapons that do have actual projectile classes when looking at the code.

If you have a case where you try to set the primary and secondary damages to exactly the same values on a weapon that is
using 2 different projectile classes, the secondary one might not be applied.

Quick fix is to just make the SDamage value slightly more or less. i.e. change it from 200 to 200.1 or 199.9

Glad you like the config menu. I spent too much time on that bit....
blarg
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Loathsomes Weapons Tweak

Post by sektor2111 »

Um, I'm not in a rush for such mutators, but I recall various discussions with Higor through forum. I think MH support is doable without any dependencies probably using whatever GetPropertyText("hitdamage") or such, just my two cents here.
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Loathsomes Weapons Tweak

Post by MrLoathsome »

Good suggestion. Don't think I tried using GetPropertyText when I attempted briefly to do that differently.
Will post an update if I can get that to work. (And remove that other glitch, once I test to confirm that it actually happens that way...)

Also, if you do want this mutator to just scale ALL damage, just set the MaxAdjVal higher
than any of the damage amounts from any of the weapons. And leave all the P/S/HDamage values at default for the weapons.
I could make a MUCH smaller version of the thing that does only that, but then there is no use for my nice UMenu. :loool:
Last edited by MrLoathsome on Thu Jun 21, 2018 12:45 am, edited 1 time in total.
blarg
RocketJedi
Inhuman
Posts: 850
Joined: Wed Mar 12, 2008 7:14 pm
Personal rank: I.T Master
Location: New York

Re: Loathsomes Weapons Tweak

Post by RocketJedi »

any way possible this mod can change the load time of weapons? similar to fast weapons switch, but maybe a slow weapon switch or load?
https://www.vulpinemission.com
Image ROCKET-X8 Server
Image MONSTERHUNT w/ NALI WEAPONS 3 + RX8
Image BUNNYTRACK NY
Image SNIPER DEATHMATCH
Image InstaGib + ComboGib + Jailbreak
Image ROSEBUM ROCKET-X RB
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Loathsomes Weapons Tweak

Post by MrLoathsome »

That would best be done by a separate mutator.

This is only modifying any default damage values for weapons/projectiles that it can, and attempting to scale ActualDamage.
Hopefully done in a way that can be used to make mismatched/unbalanced weapons work better
together on the same map.
Or to just tweak settings for a specific weapon that is either too strong or not powerful enough for the current game config.

Think what you are asking there would require something that modifies functions in the player/playerpawn classes.

Thanks to sektor2111 reminding me that GetPropertyText might be useful for this, there will be an RC2 of this before too long. :rock:

Support for any Weapon that uses the "hitdamage" config variable is now dependent on nothing specific.

Code: Select all

if (W.GetPropertyText("hitdamage") != "") WCList[i].HDamage = int(W.GetPropertyText("hitdamage"));
Still looking at one somewhat "Chunky" issue. The ugly horrible way I handled flakcannon primary fire in RC1 will only work for the default U1 and UT
flakcannons. (And not the OLweapons flak etc...)
If I can't figure a better way on those, I will just recommend setting the flak primary damage amount below your MaxAdjVal setting, and let
the DamageMult var handle those same as it does for miniguns. (That might be the best way....)
blarg
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Loathsomes Weapons Tweak

Post by sektor2111 »

MrLoathsome wrote:Still looking at one somewhat "Chunky" issue. The ugly horrible way I handled flakcannon primary fire in RC1 will only work for the default U1 and UT
flakcannons. (And not the OLweapons flak etc...)
Yes, that was another issue coming from class deal, here I think would be suitable some "ISA('Chunk4')" because if we are looking around these are child classes:

Code: Select all

class OSChunk4 expands Chunk4;
simulated function HitWall( vector HitNormal, actor Wall )
 {
if (!bDelayTime) 
    {
      if ( (Level.Netmode != NM_DedicatedServer) && (FRand()<0.5) &&class'MonsterHunt.uiweapons'.default.busedecals)
      Spawn(class'WallCrack',,,Location, rotator(HitNormal));
      }
      Super.HitWall(HitNormal, Wall );
      }

defaultproperties
{
}
Even is claimed a slow thing "IsA" is good as it is, the rest or replacements problems which people were having are coming from wrong codes used in replacements not IsA. While this class is my class, return true and keep going with IsA, unless some stuff will never be replaced by NOT using IsA.
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Loathsomes Weapons Tweak - RC2

Post by MrLoathsome »

Check Post 1 for RC2 update which should address some of these "chunky" issues.
blarg