Native Bug - Ranged Weapon Accuracy

Currently viewing this thread:

Jerezereh

Recruit
Best answers
2
I've been working on adding my own custom skill and during this process I believe I've found a bug with the Crossbow, Bow, and Throwing skills. Each of these has a SkillEffect of increasing accuracy with ranks, which I copied onto my custom skill. When testing my skill, I noticed the accuracy actually went down with ranks. This is due to the skill effect calculation using that number to determine "weaponInaccuracy". Making my skill effect's value negative increased accuracy.

From SandboxAgentStatCalculateModel::GetSkillEffectsOnAgent():
C#:
else if (rightHandEquippedItem.RelevantSkill == DefaultSkills.Crossbow)
      {
        ExplainedNumber stat1 = new ExplainedNumber(weaponInaccuracy, (StringBuilder) null);
        SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Crossbow, DefaultSkillEffects.CrossbowAccuracy, character, ref stat1, false);
        agentDrivenProperties.WeaponInaccuracy = stat1.ResultNumber;
        ExplainedNumber stat2 = new ExplainedNumber(agentDrivenProperties.ReloadSpeed, (StringBuilder) null);
        SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Crossbow, DefaultSkillEffects.CrossbowReloadSpeed, character, ref stat2, true);
        agentDrivenProperties.ReloadSpeed = stat2.ResultNumber;
      }
      else
      {
        if (rightHandEquippedItem.RelevantSkill != DefaultSkills.Throwing)
          return;
        ExplainedNumber stat1 = new ExplainedNumber(weaponInaccuracy, (StringBuilder) null);
        SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Throwing, DefaultSkillEffects.ThrowingAccuracy, character, ref stat1, false);
        agentDrivenProperties.WeaponInaccuracy = stat1.ResultNumber;
        ExplainedNumber stat2 = new ExplainedNumber(readySpeedMultiplier, (StringBuilder) null);
        SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Throwing, DefaultSkillEffects.ThrowingSpeed, character, ref stat2, true);
        agentDrivenProperties.ThrustOrRangedReadySpeedMultiplier = stat2.ResultNumber;
      }

From DefaultSkillEffects::InitializeAll():
C#:
this.EffectBowAccuracy = new SkillEffect(new TextObject("{=sQCS90Wq}Bow Accuracy: +{a0} %", (Dictionary<string, TextObject>) null), new SkillObject[1]
{
DefaultSkills.Bow
}, SkillEffect.PerkRole.Personal, 0.09f, SkillEffect.PerkRole.None, 0.0f, SkillEffect.EffectIncrementType.AddFactor);

this.EffectThrowingAccuracy = new SkillEffect(new TextObject("{=SfKrjKuO}Thrown weapon accuracy: +{a0} %", (Dictionary<string, TextObject>) null), new SkillObject[1]
{
DefaultSkills.Throwing
}, SkillEffect.PerkRole.Personal, 0.06f, SkillEffect.PerkRole.None, 0.0f, SkillEffect.EffectIncrementType.AddFactor);

this.EffectCrossbowAccuracy = new SkillEffect(new TextObject("{=JwWnpD40}Crossbow accuracy: +{a0} %", (Dictionary<string, TextObject>) null), new SkillObject[1]
{
DefaultSkills.Crossbow
}, SkillEffect.PerkRole.Personal, 0.05f, SkillEffect.PerkRole.None, 0.0f, SkillEffect.EffectIncrementType.AddFactor);

Is there somewhere I should report this?