Dabos37
Sergeant Knight at Arms

@Dabos37 some Input, but not tested. The underlined ones, can be important for further investigation though
protected void SetAiRelatedProperties(Agent agent, AgentDrivenProperties agentDrivenProperties, WeaponComponentData equippedItem, WeaponComponentData secondaryItem)
{
int meleeSkill = this.GetMeleeSkill(agent, equippedItem, secondaryItem);
SkillObject skill = (equippedItem == null) ? DefaultSkills.Athletics : equippedItem.RelevantSkill;
int effectiveSkill = this.GetEffectiveSkill(agent.Character, agent.Origin, agent.Formation, skill);
float num = this.CalculateAILevel(agent, meleeSkill);
float num2 = this.CalculateAILevel(agent, effectiveSkill);
float num3 = num + agent.Defensiveness;
agentDrivenProperties.AiRangedHorsebackMissileRange = 0.3f + 0.4f * num2;
agentDrivenProperties.AiFacingMissileWatch = -0.96f + num * 0.06f;
agentDrivenProperties.AiFlyingMissileCheckRadius = 8f - 6f * num;
agentDrivenProperties.AiShootFreq = 0.3f + 0.7f * num2;
agentDrivenProperties.AiWaitBeforeShootFactor = (agent._propertyModifiers.resetAiWaitBeforeShootFactor ? 0f : (1f - 0.5f * num2));
bool flag = secondaryItem != null;
agentDrivenProperties.AIBlockOnDecideAbility = MBMath.Lerp(0.25f, 0.99f, MBMath.ClampFloat((float)Math.Pow((double)num, 1.0), 0f, 1f), 1E-05f);
agentDrivenProperties.AIParryOnDecideAbility = MBMath.Lerp(0.01f, 0.95f, MBMath.ClampFloat((float)Math.Pow((double)num, 1.5), 0f, 1f), 1E-05f);
agentDrivenProperties.AiTryChamberAttackOnDecide = (num - 0.15f) * 0.1f;
agentDrivenProperties.AIAttackOnParryChance = 0.3f - 0.1f * agent.Defensiveness;
agentDrivenProperties.AiAttackOnParryTiming = -0.2f + 0.3f * num;
agentDrivenProperties.AIDecideOnAttackChance = 0.15f * agent.Defensiveness;
agentDrivenProperties.AIParryOnAttackAbility = MBMath.ClampFloat((float)Math.Pow((double)num, 3.0), 0f, 1f);
agentDrivenProperties.AiKick = -0.1f + ((num > 0.4f) ? 0.4f : num);
agentDrivenProperties.AiAttackCalculationMaxTimeFactor = num;
agentDrivenProperties.AiDecideOnAttackWhenReceiveHitTiming = -0.25f * (1f - num);
agentDrivenProperties.AiDecideOnAttackContinueAction = -0.5f * (1f - num);
agentDrivenProperties.AiDecideOnAttackingContinue = 0.1f * num;
agentDrivenProperties.AIParryOnAttackingContinueAbility = MBMath.Lerp(0.05f, 0.95f, MBMath.ClampFloat((float)Math.Pow((double)num, 3.0), 0f, 1f), 1E-05f);
agentDrivenProperties.AIDecideOnRealizeEnemyBlockingAttackAbility = 0.5f * MBMath.ClampFloat((float)Math.Pow((double)num, 2.5) - 0.1f, 0f, 1f);
agentDrivenProperties.AIRealizeBlockingFromIncorrectSideAbility = 0.5f * MBMath.ClampFloat((float)Math.Pow((double)num, 2.5) - 0.1f, 0f, 1f);
agentDrivenProperties.AiAttackingShieldDefenseChance = 0.2f + 0.3f * num;
agentDrivenProperties.AiAttackingShieldDefenseTimer = -0.3f + 0.3f * num;
agentDrivenProperties.AiRandomizedDefendDirectionChance = 1f - (float)Math.Log((double)num * 7.0 + 1.0, 2.0) * 0.33333f;
agentDrivenProperties.AISetNoAttackTimerAfterBeingHitAbility = MBMath.ClampFloat((float)Math.Pow((double)num, 2.0), 0.05f, 0.95f);
agentDrivenProperties.AISetNoAttackTimerAfterBeingParriedAbility = MBMath.ClampFloat((float)Math.Pow((double)num, 2.0), 0.05f, 0.95f);
agentDrivenProperties.AISetNoDefendTimerAfterHittingAbility = MBMath.ClampFloat((float)Math.Pow((double)num, 2.0), 0.05f, 0.95f);
agentDrivenProperties.AISetNoDefendTimerAfterParryingAbility = MBMath.ClampFloat((float)Math.Pow((double)num, 2.0), 0.05f, 0.95f);
agentDrivenProperties.AIEstimateStunDurationPrecision = 1f - MBMath.ClampFloat((float)Math.Pow((double)num, 2.0), 0.05f, 0.95f);
agentDrivenProperties.AIHoldingReadyMaxDuration = MBMath.Lerp(0.25f, 0f, Math.Min(1f, num * 1.2f), 1E-05f);
agentDrivenProperties.AIHoldingReadyVariationPercentage = num;
agentDrivenProperties.AiRaiseShieldDelayTimeBase = -0.75f + 0.5f * num;
agentDrivenProperties.AiUseShieldAgainstEnemyMissileProbability = 0.1f + num * 0.6f + num3 * 0.2f;
agentDrivenProperties.AiCheckMovementIntervalFactor = 0.005f * (1.1f - num);
agentDrivenProperties.AiMovemetDelayFactor = 4f / (3f + num2);
agentDrivenProperties.AiParryDecisionChangeValue = 0.05f + 0.7f * num;
agentDrivenProperties.AiDefendWithShieldDecisionChanceValue = Math.Min(1f, 0.2f + 0.5f * num + 0.2f * num3);
agentDrivenProperties.AiMoveEnemySideTimeValue = -2.5f + 0.5f * num;
agentDrivenProperties.AiMinimumDistanceToContinueFactor = 2f + 0.3f * (3f - num);
agentDrivenProperties.AiStandGroundTimerValue = 0.5f * (-1f + num);
agentDrivenProperties.AiStandGroundTimerMoveAlongValue = -1f + 0.5f * num;
agentDrivenProperties.AiHearingDistanceFactor = 1f + num;
agentDrivenProperties.AiChargeHorsebackTargetDistFactor = 1.5f * (3f - num);
agentDrivenProperties.AiWaitBeforeShootFactor = (agent._propertyModifiers.resetAiWaitBeforeShootFactor ? 0f : (1f - 0.5f * num2));
float num4 = 1f - num2;
agentDrivenProperties.AiRangerLeadErrorMin = -num4 * 0.35f;
agentDrivenProperties.AiRangerLeadErrorMax = num4 * 0.2f;
agentDrivenProperties.AiRangerVerticalErrorMultiplier = num4 * 0.1f;
agentDrivenProperties.AiRangerHorizontalErrorMultiplier = num4 * 0.0349065848f;
agentDrivenProperties.AIAttackOnDecideChance = MathF.Clamp(0.23f * this.CalculateAIAttackOnDecideMaxValue() * (3f - agent.Defensiveness), 0.05f, 1f);
agentDrivenProperties.SetStat(DrivenProperty.UseRealisticBlocking, (agent.Controller != Agent.ControllerType.Player) ? 1f : 0f);
}
Edit: Problem....this Method will also be applied to the Multiplayer...
Yes, some time ago someone told me about these parameters and they actually work pretty good to make archers less accurate, but I remember that I had to give archers a huge accuracy nerf to actually notice something in big battles, but then tournaments became a pain where ranged units were not able to hit anyone xD.
Plus I remember that changing one of these parameters where pretty good for the AI to be able to block projectiles without shield wall formation:
agentDrivenProperties.AiRaiseShieldDelayTimeBase = -0.75f + 0.5f * num;
agentDrivenProperties.AiUseShieldAgainstEnemyMissileProbability = 0.1f + num * 0.6f + num3 * 0.2f;
(I am going to check old posts to try to find how I did it)




