Resolved Dismount effect doesn't work

Users who are viewing this thread

Version number
1.5.6
Branch
Beta
Modded/unmodded
No, I didn't use any mods.

scarface52

Grandmaster Knight
Summary: Dismount effect doesn't work by any means. Here is a detailed explanation from @bm01 that points out the source of the issue:
For the dismount to happen the inflicted damage needs to be higher than 25 and the spear has to hit the head, neck, chest or shoulders. Arms and legs won't do. "Shrugged off" blows can't dismount. The three perks works the same way (but two of them have a random chance on top of it).
Figured it out, the damage check is wrong. Here's the method for reference:
Code:
private static void DecideAgentDismountedByBlow(Agent attackerAgent, Agent victimAgent, AttackCollisionData collisionData, WeaponComponentData attackerWeapon, bool isInitialBlowShrugOff, ref Blow blow)
{
    if (victimAgent.HasMount && !isInitialBlowShrugOff)
    {
        bool flag = (float)blow.InflictedDamage / victimAgent.HealthLimit > 0.25f;
        bool flag2 = MBMath.IsBetween((int)blow.VictimBodyPart, 0, 6);
        if (victimAgent.Health - (float)collisionData.InflictedDamage >= 1f && flag && flag2)
        {
            if (blow.StrikeType == StrikeType.Thrust && blow.WeaponRecord.WeaponFlags.HasAnyFlag(WeaponFlags.CanDismount))
            {
                blow.BlowFlag |= BlowFlags.CanDismount;
                return;
            }
            float num = 0f;
            num += MissionGameModels.Current.AgentApplyDamageModel.CalculateDismountChanceBonus(attackerAgent, attackerWeapon);
            if ((MBMath.IsBetween(num, 0f, 1f) ? MBRandom.RandomFloat : 0.1f) <= num)
            {
                blow.BlowFlag |= BlowFlags.CanDismount;
                return;
            }
        }
    }
}
The issue is that "blow.InflictedDamage" hasn't be set yet, it's always equal to 0, so the amount of inflicted damage is always believed to be inferior to 25% of the target's max HP. "collisionData.InflictedDamage" should be used instead.

Similarly, DecideAgentKnockedByBlow is checking blow.BaseMagnitude but it hasn't be set yet either and is always equal to 0 too.
 
Last edited:
what happens if you charge at them(not on full speed so you won't die)? Maybe if you are standing or going really slow it won't work

edit, okay watched the video again and there is a horseman who charges and still stands on the horse. this should be a bug yes
 
what happens if you charge at them(not on full speed so you won't die)? Maybe if you are standing or going really slow it won't work

edit, okay watched the video again and there is a horseman who charges and still stands on the horse. this should be a bug yes
I have tested further and I can't dismount with hooked spears either. It was working fine in previous versions though. Have you used them?
 
Has anyone tried it inside of a 1.5.6 fresh campaign instead of the custom battles? I have been able to use it prior to 1.5.6 in the campaign.
This makes me think it either got broken when:
1) the polearm and 2-handed perks were updated with the knockdown abilities.
2) they someone didn’t get implemented into the custom battles.
 
@scarface52 can confirm, it doesnt work for me either. I tried with 2 different guards
Thank you for testing. Which guards did you use? Have you crafted the weapon?
Has anyone tried it inside of a 1.5.6 fresh campaign instead of the custom battles? I have been able to use it prior to 1.5.6 in the campaign.
This makes me think it either got broken when:
1) the polearm and 2-handed perks were updated with the knockdown abilities.
2) they someone didn’t get implemented into the custom battles.
I did try in a campaign and I also had Braced perk; it didn't work. It was working on 1.5.2 though.
 
I couldn't see well on the video, but for the dismount to happens the inflicted damage needs to be higher than 25 and the spear has to hit the head, neck, chest or shoulders. Arms and legs won't do. "Shrugged off" blows can't dismount. The three perks works the same way (but two of them have a random chance on top of it). I've tested this feature extensively for my mod (1.5.5 and early 1.5.6), and unless something changed recently nothing is wrong with it.
 
Last edited:
I couldn't see well on the video, but for the dismount to happens the inflicted damage needs to be higher than 25 and the spear has to hit the head, neck, chest or shoulders. Arms and legs won't do. "Shrugged off" blows can't dismount. The three perks works the same way (but two of them have a random chance on top of it). I've tested this feature extensively for my mod (1.5.5 and early 1.5.6), and unless something changed recently nothing is wrong with it.
Yes, the video is not very helpful. I have checked DecideAgentDismountedByBlow to understand better which tells the same story as you. I'm guessing Don't Stop Me Now is the mod of yours that you are referring here. But dismounting never kicked in while playing for some reason. Have you witnessed AI to dismount while testing your mod?
 
okay, are there any more wrong ones in the patch notes, aside Double Thorn Wings?
Double Huge Hooks With Fur Covering can't dismount too and Riveted Hooked Wings can dismount even though it's not mentioned. Here is the correct list:
  • Double Hooks
  • Weighted Long Thorns
  • Double Hook Wings
  • Singular Hook Wing
  • Riveted Hooked Wings
  • Tied Spear Wing
 
Yes, the video is not very helpful. I have checked DecideAgentDismountedByBlow to understand better which tells the same story as you. I'm guessing Don't Stop Me Now is the mod of yours that you are referring here. But dismounting never kicked in while playing for some reason. Have you witnessed AI to dismount while testing your mod?
So I've just tested. I disabled my mod, I gave myself the Braced perk and crafted a polearm with double hooks, but I couldn't dismount anything (meaning that both checks failed / were skipped). However, after reenabling my mod and making it as easy to trigger as possible (no damage / body part hit check for example), it worked.
Still trying to figure out why it doesn't work in vanilla.
 
Last edited:
Figured it out, the damage check is wrong. Here's the method for reference:
Code:
private static void DecideAgentDismountedByBlow(Agent attackerAgent, Agent victimAgent, AttackCollisionData collisionData, WeaponComponentData attackerWeapon, bool isInitialBlowShrugOff, ref Blow blow)
{
    if (victimAgent.HasMount && !isInitialBlowShrugOff)
    {
        bool flag = (float)blow.InflictedDamage / victimAgent.HealthLimit > 0.25f;
        bool flag2 = MBMath.IsBetween((int)blow.VictimBodyPart, 0, 6);
        if (victimAgent.Health - (float)collisionData.InflictedDamage >= 1f && flag && flag2)
        {
            if (blow.StrikeType == StrikeType.Thrust && blow.WeaponRecord.WeaponFlags.HasAnyFlag(WeaponFlags.CanDismount))
            {
                blow.BlowFlag |= BlowFlags.CanDismount;
                return;
            }
            float num = 0f;
            num += MissionGameModels.Current.AgentApplyDamageModel.CalculateDismountChanceBonus(attackerAgent, attackerWeapon);
            if ((MBMath.IsBetween(num, 0f, 1f) ? MBRandom.RandomFloat : 0.1f) <= num)
            {
                blow.BlowFlag |= BlowFlags.CanDismount;
                return;
            }
        }
    }
}
The issue is that "blow.InflictedDamage" hasn't be set yet, it's always equal to 0, so the amount of inflicted damage is always believed to be inferior to 25% of the target's max HP. "collisionData.InflictedDamage" should be used instead.

Similarly, DecideAgentKnockedByBlow is checking blow.BaseMagnitude but it hasn't be set yet either and is always equal to 0 too.
 
Last edited:
The issue is that "blow.InflictedDamage" hasn't be set yet, it's always equal to 0, so the amount of inflicted damage is always believed to be inferior to 25% of the target's max HP. "collisionData.InflictedDamage" should be used instead.
Great findings! Thanks for digging up. I'm not a programmer, so can you tell me if this means that dismount effect is bugged in every scenario including Knock Off and Hammer Bolts perks? I will update the OP accordingly to that.
Similarly, DecideAgentKnockedByBlow is checking blow.BaseMagnitude but I suspect it's always equal to 0 too.
Hard Knock perk from polearm tree is working fine for me.
 
Back
Top Bottom