Discussion Suggestion Add ability to destroy weapon in mission

Users who are viewing this thread

Kommissar

Recruit
It would be nice if we had an ability to destroy a specific weapon at will. This would allow us to simulate things like broken lances, much needed for historical mods. Example code here that attempts to remove the weapon from the agent causes an exception further down the line, although seems to work for some weapons and in some cases.

C#:
        public override void OnRegisterBlow(Agent attacker, Agent victim, GameEntity realHitEntity, Blow b, ref AttackCollisionData collisionData, in MissionWeapon attackerWeapon)
        {
            if (attacker.Character == null || attackerWeapon.Item == null)
            {
                return;
            }

            if (attacker.HasWeapon())
            {
                EquipmentIndex v = attacker.GetWieldedItemIndex(Agent.HandIndex.MainHand);
                if (v != EquipmentIndex.None)
                {
                    attacker.RemoveEquippedWeapon(v);
                }
            }
        }
 
Back
Top Bottom