Weapon accuracy, SOLVED!

Started by chiconspiracy, February 20, 2012, 11:35:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chiconspiracy

For years I was frustrated at the pathetic weakness and inaccuracy of the assault rifles in this game, and thankfully there are solutions. Soon after the mod tools came out, it was soon discovered that weapon damage had nothing to do with gamemodesconfig, but was handled by 41_weaponproperties.

There are two lines you can add to have separate limb and torso damage. The following is what I have for the ak-47, (copied from the Dragunov line.


<value name="selHitLocation_Torso_Severity" type="UInt32">3</value>
<value name="selHitLocation_Limb_Severity" type="UInt32">2</value>

Just one shot to the torso, and he'll go down, and at best be crying for help (useful for tying up enemies when they try to rescue him) leg shots will cripple. These lines are missing from everything but the sniper rifles, so just search and add them under the following:

value name="fHealthFailureChanceModifier" type="Float">1</value>

I also changed <value name="bSingleHitHealthFailure" type="Bool">False</value> to "True", though I have no idea what difference it makes.

Weapon Accuracy

After vainly trying to copy features from the dragonov to the g3 and fal, and having no luck getting realistic spread, I finally found a solution. "bUseAngleSpread" is set to "False" for pretty much every gun. Simply set it to "True" and modify the "fAngleYawBulletSpread" and "fAnglePitchBulletSpread" to whatever numbers you like. For the FAL and G3, I changed Yaw and Pitch to zero, and obtained perfect accuracy:

<object type="FireStrategyProperties">
            <value name="bUseAngleSpread" type="Bool">True</value>  *******Changed from "False"****
            <value name="iBulletsShot" type="UInt32">1</value>
            <value name="iBurstLength" type="UInt32">0</value>
            <value name="fAngleYawBulletSpread" type="Float">0</value>
            <value name="fAnglePitchBulletSpread" type="Float">0</value>

Now the FAL and G3 and nail drivers, like they are in real life.  ;D

So there you go. I'm going to play around with it and see if I can't get some results with decimals for guns that should have some noticeable spread (Like the AK) while avoiding the "can't hit a guy 100 feet away" idiocy that the vanilla game has.

PZ

Outstanding w@&k chiconspiracy!  Kudos to you - now I need to get back into the game again with the modifications you developed.  :-X

chiconspiracy

No problem, now only if we could get bullet drop... and add meshes... hell, changing weapon categories! I want an assault rifle an sniper rifle together.

I think I'd sacrifice a kitten to get a scope on the fal or g3

TheFishlord

Excellent! Now I can actually USE all the information about bullet spread and accuracy I've gathered in my recent ballistics research...Pretty much every weapon in the game needs to be more accurate. I assume the values are degrees left and right and up and down respectively? That would make sense, given that recoil values are also given in degrees.

Quote from: chiconspiracy on February 20, 2012, 01:32:06 PM
No problem, now only if we could get bullet drop... and add meshes... hell, changing weapon categories! I want an assault rifle an sniper rifle together.

I think I'd sacrifice a kitten to get a scope on the fal or g3

I believe you can change weapon categories in the gamesmodeconfig file. In my sniffing around there I think it can be done, but it will be a lot of tedious changing of code.

Also, do you know if these changes have to be applied to the 21_weaponsproperties file?

EDIT: Something you might be interested in, this method you have found of adjusting the accuracy is what is used in the shotguns. (They are set to "true" by default.) So that tells me that while this is one way to do it, there must be another somewhere, because the other weapons have different accuracy ratings but don't use this at all. I'm still looking for that...might come down to just adjusting the "accuracy" stat in the gamesmodeconfig.

chiconspiracy

As a test I set the AR16 to an x and y "spread" values to "1", and it was still nowhere close to being realistically accurate. This will have to be in decimal amounts for sure to get realistic spread.

The 21_weaponsproperties was untouched, I only used the 41_weaponsproperties file.

I figured there must be some other way, but seeing as how this works, I'm going to stick with it. I've made a fairly comprehensive damage layout so far, giving the sniper rifles (except the 50 cal), fal, g3, and pkm the following:

<value name="selHitLocation_Torso_Severity" type="UInt32">3.5</value>
<value name="selHitLocation_Limb_Severity" type="UInt32">2</value>

Apparently the idiots deciding the weapons values ignored the fact that the PKM shoots the SAME round as the Dragunov, and has well over 1000m effective range, yet is a weak, bullet spraying piece of crap. Same with the Fal and G3 to the bolt action rifle. One thing that does need to be done is adding a lot more kick to 7.62 assault rifles. I've shot a civilian version of a fal, and it kicks like a horse. Has there been any progress with weapon recoil, or is it hard coded with the animations?

TheFishlord

I tried to double the recoil of the FAL as a start, but I really didn't notice a difference (maybe just because it's so small to begin with). I'll have to run more tests on that.



Edit: quote of the entire previous post removed, for readability reasons. /Art

nexor

Quote from: chiconspiracy on February 21, 2012, 12:36:31 PM

<value name="selHitLocation_Torso_Severity" type="UInt32">3.5</value>
<value name="selHitLocation_Limb_Severity" type="UInt32">2</value>


Am I mistaken or is this not available on the PKM because I couldn't find it, that could be the reason why it shoots like a spraygun

chiconspiracy

Quote from: nexor on February 22, 2012, 02:32:43 AM
Am I mistaken or is this not available on the PKM because I couldn't find it, that could be the reason why it shoots like a spraygun

Those are the damage modifiers, nothing to do with accuracy. I did add that however, to make it more realistic.

The following are what control spread, and is included with all weaposn.

<value name="fAngleYawBulletSpread" type="Float">0</value>
<value name="fAnglePitchBulletSpread" type="Float">0</value>

TheFishlord

Weapon recoil, SOLVED.   :-D

For whatever reason, the game just doesn't like having the 42_weapons.xml file in the Patch folder, and crashes whenever you load a game if you have it there. The patch.xml file was edited correctly but that still didn't make a difference. I don't know why it doesn't like 42_weapons.xml when we put 41_WeaponsProperties.xml into the Patch folder, and it worked fine - but screw you game, we got a way around you now!

So anyway, the 22_weapons.xml file only covers multiplayer weapons. The 42_weapons.xml covers multiplayer and singleplayer weapons. If you want to adjust the recoil of a weapon, or anything else in the weapon.xml file, you have to do this:

1. Go to the "world1" or "world2" folders (I don't think it matters which one). Go to 42_weapons.xml
2. Copy the entire weapons section for the single player weapon out of it. For the FAL, which I just edited, this means taking everything from

Spoiler
  <object hash="256A1FF9">
    <value name="Name" type="String">Primary.FNFAL</value>
    <object type="Entity">
      <value name="hidName" type="String">weapons.Primary.FNFAL</value>

Up to BUT NOT INCLUDING the next weapon's section, which should be

Spoiler
   <object hash="256A1FF9">
    <value name="Name" type="String">Primary.FNFAL.Multi</value>
    <object type="Entity">
      <value name="hidName" type="String">weapons.Primary.FNFAL.Multi</value>

3. Take that entire chunk, find the one and only section referring to the FAL in your 22_weapons.xml file in your mymod/Patch folder (should be a .Multi version)
4. Paste it in above that section, so it appears the same as the sections in the 42_weapons.xml file, back in the world1 folder.
5. Adjust values as you see fit
6. Build patch, install, play!

Because the game only liked having its weapons adjusted through the 22_weapons file, we couldn't use any other file to change things. What we've done now is smuggled in some changes to the 42_weapons file, inside the 22_weapons file, even though they weren't even mentioned in the 22 originally.

Unfortunately this means you will have to repeat this process for every weapon you want to modify, but it's better than nothing. Note that you can still modify things as much as you want in the 21 and 41_WeaponsProperties.xml, it's only the settings or changes specified in a weapons.xml file that need to do a workaround like this.

PZ

Excellent research, and w@&k, TheFishLord!  Kudos!

chiconspiracy

Awesome find. Would it w@&k by any chance to completely overwrite the contents of 22_weapons with 42 weapons?

TheFishlord

Unfortunately not. I tried just renaming it to 22_weapons.xml and moving it in, but there must be something different, because the game crashed whenever I loaded a save then. Don't know why.

Next up on my to do list...figure out how to change magazine sizes...

PZ

Quote from: TheFishlord on February 28, 2012, 11:14:34 AM
...Next up on my to do list...figure out how to change magazine sizes...

That would truly be a great find  :-X

PZ

I copied TheFishLord's and chiconspiracy's solutions into knowledge base articles so we have a permanent (easy to find) place.  They are featured here

(you two can edit your own entries to add/change instructions)

Knightmare

Another solution to the underpowered weapons is to increase the level of the damage.  In the Stim_ImpactDamage section for each weapon, the nLevel value determines this.  I ended up changing the MAC10's damage level from 7 to 10, the same as the .45 pistol:

Spoiler

<object type="Stim_ImpactDamage">
  <value name="hidEventName" type="String">Stims</value>
  <value name="eventMask" type="UInt32">2</value>
  <value name="hidTargetEntityId" type="UInt64">18446744073709551615</value>
  <value hash="FC25E1F1" type="String">BulletImpact</value>
  <value name="sDetail" type="Hash">AB3FB98A</value>
  <value name="selType" type="UInt32">3</value>
  <value name="nLevel" type="UInt32">10</value> <!-- was 7 -->

For reference, the damage level for the FAL is 14, the Dragunov 25, and the AS50 30.

Quote from: chiconspiracy on February 21, 2012, 12:36:31 PM
As a test I set the AR16 to an x and y "spread" values to "1", and it was still nowhere close to being realistically accurate. This will have to be in decimal amounts for sure to get realistic spread.

No problem with using decimals there, as floats have half their range of precision between 1 and -1.  I found some suitable decimal amounts for the M16/AR16:

<value name="fAngleYawBulletSpread" type="Float">0.002</value> <!-- was 2 -->
<value name="fAnglePitchBulletSpread" type="Float">0.002</value> <!-- was 2 -->

The way I got these values is to take the desired group size in inches at 1000 yards, halve it, divide by 36,000 inches, calc the inverse tangent for that ratio, and finally double that angle.  The halving and doubling is due to using half of the cone for the trig operation.  Here it is in formula form:

2*atan((GS/2)/36000)
GS= group size in inches

PZ

Excellent mathematics, Knightmare  :-X +1

Art Blade

 ??? ??? ??? I'd never even have thought of calculating that. Only trial and errror  :-D Nice one,  :-X +1 :)
[titlebar]Vision without action is a daydream. Action without vision is a nightmare.[/titlebar]What doesn't kill us, makes us weirder.

fragger

Impressive :-X +1 from me too 8)

Tags:
🡱 🡳

Similar topics (5)