abc123456
Regular

I spent 2 days trying to reverse engineer the code handling the combat AI. I was able to make the AI parry around 95% of the time. However, the AI struggles to parry feints when you set AIAttackOnDecideChance to greater than 0.
It looks like the AI has problem parrying feinting attacks when they are attacking.
If you set AIParryOnDecideAbility = 100 and AIAttackOnDecideChance = 0, the AI does parry against feints well.
Does anyone know which properties to adjust to improve AI parry vs feinting attacks?
Or is the code handled elsewhere?
EDIT: Just after posting this, I had an idea. If you set AIParryOnDecideAbility = 100 and AIAttackOnDecideChance = 0.1
The AI can now parry feints better.
It seems like the AI has poor defense if he is aggressive.
I guess posting in the forums helped my brain somehow!
It looks like the AI has problem parrying feinting attacks when they are attacking.
If you set AIParryOnDecideAbility = 100 and AIAttackOnDecideChance = 0, the AI does parry against feints well.
Does anyone know which properties to adjust to improve AI parry vs feinting attacks?
Or is the code handled elsewhere?
C#:
float num3 = num + agent.Defensiveness;
agentDrivenProperties.AiRangedHorsebackMissileRange = (float)(0.300000011920929 + 0.400000005960464 * (double)num2);
agentDrivenProperties.AiFacingMissileWatch = (float)((double)num * 0.0599999986588955 - 0.959999978542328);
agentDrivenProperties.AiFlyingMissileCheckRadius = (float)(8.0 - 6.0 * (double)num);
agentDrivenProperties.AiShootFreq = (float)(0.300000011920929 + 0.699999988079071 * (double)num2);
agentDrivenProperties.AiWaitBeforeShootFactor = (agent._propertyModifiers.resetAiWaitBeforeShootFactor ? 0f : ((float)(1.0 - 0.5 * (double)num2)));
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 = (float)(((double)num - 0.150000005960464) * 0.100000001490116);
agentDrivenProperties.AIAttackOnParryChance = (float)(0.300000011920929 - 0.100000001490116 * (double)agent.Defensiveness);
agentDrivenProperties.AiAttackOnParryTiming = (float)(0.300000011920929 * (double)num - 0.200000002980232);
agentDrivenProperties.AIDecideOnAttackChance = 0.15f * agent.Defensiveness;
agentDrivenProperties.AIParryOnAttackAbility = MBMath.ClampFloat((float)Math.Pow((double)num, 3.0), 0f, 1f);
agentDrivenProperties.AiKick = (float)((((double)num > 0.400000005960464) ? 0.400000005960464 : ((double)num)) - 0.100000001490116);
agentDrivenProperties.AiAttackCalculationMaxTimeFactor = num;
agentDrivenProperties.AiDecideOnAttackWhenReceiveHitTiming = (float)(-0.25 * (1.0 - (double)num));
agentDrivenProperties.AiDecideOnAttackContinueAction = (float)(-0.5 * (1.0 - (double)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 = (float)(0.200000002980232 + 0.300000011920929 * (double)num);
agentDrivenProperties.AiAttackingShieldDefenseTimer = (float)(0.300000011920929 * (double)num - 0.300000011920929);
agentDrivenProperties.AiRandomizedDefendDirectionChance = (float)(1.0 - Math.Log((double)num * 7.0 + 1.0, 2.0) * 0.333330005407333);
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 = (float)(0.5 * (double)num - 0.75);
agentDrivenProperties.AiUseShieldAgainstEnemyMissileProbability = (float)(0.100000001490116 + (double)num * 0.600000023841858 + (double)num3 * 0.200000002980232);
agentDrivenProperties.AiCheckMovementIntervalFactor = (float)(0.00499999988824129 * (1.10000002384186 - (double)num));
agentDrivenProperties.AiMovemetDelayFactor = (float)(4.0 / (3.0 + (double)num2));
agentDrivenProperties.AiParryDecisionChangeValue = (float)(0.0500000007450581 + 0.699999988079071 * (double)num);
agentDrivenProperties.AiDefendWithShieldDecisionChanceValue = Math.Min(1f, (float)(0.200000002980232 + 0.5 * (double)num + 0.200000002980232 * (double)num3));
agentDrivenProperties.AiMoveEnemySideTimeValue = (float)(0.5 * (double)num - 2.5);
agentDrivenProperties.AiMinimumDistanceToContinueFactor = (float)(2.0 + 0.300000011920929 * (3.0 - (double)num));
agentDrivenProperties.AiStandGroundTimerValue = (float)(0.5 * ((double)num - 1.0));
agentDrivenProperties.AiStandGroundTimerMoveAlongValue = (float)(0.5 * (double)num - 1.0);
agentDrivenProperties.AiHearingDistanceFactor = 1f + num;
agentDrivenProperties.AiChargeHorsebackTargetDistFactor = (float)(1.5 * (3.0 - (double)num));
agentDrivenProperties.AiWaitBeforeShootFactor = (agent._propertyModifiers.resetAiWaitBeforeShootFactor ? 0f : ((float)(1.0 - 0.5 * (double)num2)));
float num4 = 1f - num2;
agentDrivenProperties.AiRangerLeadErrorMin = (float)(-(float)((double)num4) * 0.349999994039536) + improvedCombatAI.RangedError;
agentDrivenProperties.AiRangerLeadErrorMax = num4 * 0.2f + improvedCombatAI.RangedError;
agentDrivenProperties.AiRangerVerticalErrorMultiplier = num4 * 0.1f;
agentDrivenProperties.AiRangerHorizontalErrorMultiplier = num4 * 0.0349065848f;
agentDrivenProperties.AIAttackOnDecideChance = MathF.Clamp((float)(0.230000004172325 * (double)base.CalculateAIAttackOnDecideMaxValue() * (3.0 - (double)agent.Defensiveness)), 0.05f, 1f);
agentDrivenProperties.SetStat(DrivenProperty.UseRealisticBlocking, 1f);
EDIT: Just after posting this, I had an idea. If you set AIParryOnDecideAbility = 100 and AIAttackOnDecideChance = 0.1
The AI can now parry feints better.
It seems like the AI has poor defense if he is aggressive.
I guess posting in the forums helped my brain somehow!
Last edited: