搜索结果: *

  1. order_without_power

    BL Coding How to make a configuration file for mod?

    It's best to use Mod Configuration Menu.
  2. order_without_power

    BL Coding How to override conversation text at runtime?

    LordConversationsCampaignBehavior
  3. order_without_power

    BL Coding How to override conversation text at runtime?

    You need to use a transpiler.
  4. order_without_power

    BL Coding [XML] Most crossbow properties can't be overwritten by a mod

    Instead of overriding the whole XML, try this XSLT:

    XML:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output omit-xml-declaration="yes"/>
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="Item[@id='crossbow_f']/@difficulty">
            <xsl:attribute name="difficulty">
                <xsl:value-of select="75"/>
            </xsl:attribute>
        </xsl:template>
        <xsl:template match="Item[@id='crossbow_f']/ItemComponent/Weapon/@missile_speed">
            <xsl:attribute name="missile_speed">
                <xsl:value-of select="102"/>
            </xsl:attribute>
        </xsl:template>
        <xsl:template match="Item[@id='crossbow_f']/ItemComponent/Weapon/@thrust_damage">
            <xsl:attribute name="thrust_damage">
                <xsl:value-of select="115"/>
            </xsl:attribute>
        </xsl:template>
    </xsl:stylesheet>
  5. order_without_power

    BL Coding How to make the rounded map notifications?

    What rounded map notification are you referring to? Can you take a screenshot of an example?
  6. order_without_power

    BL Coding Weird situation - encountering an enemy party with no troops

    Could you confirm this issue is related with mods and not reproducible on unmodded games?
    I no longer maintain the mod that has been reported to cause the issue, but both me and other players who don't use the mod anymore have not encountered the issue again so I can pretty much confirm that the issue is related with an older version of that mod.
  7. order_without_power

    BL Coding Harmony-Patch causes unrelated soundeffects to not play / strange sideeffect

    I think there's a better solution. Try unpatching Mission.MissileHitCallBack before Agent.MakeVoice, then patching it after.

    C#:
        [HarmonyPatch(typeof(Agent), "MakeVoice")]
        public class Patch
        {
            private static Harmony _harmony = new Harmony("sy.piercingprojectiles");
            
            public static void Prefix()
            {
                _harmony.Unpatch(AccessTools.Method(typeof(Mission), "MissileHitCallback"),
                    AccessTools.Method(typeof(HarmonyPatches), nameof(HarmonyPatches.Mission_MissileHitCallback_Transpiler)));
            }
            
            public static void Postfix()
            {
                _harmony.Patch(AccessTools.Method(typeof(Mission), "MissileHitCallback"),
                    transpiler: new HarmonyMethod(typeof(HarmonyPatches), nameof(HarmonyPatches.Mission_MissileHitCallback_Transpiler)));
    
                if (!_patchApplied)
                    PiercingProjectiles.Message($"{nameof(PiercingProjectiles)}: failed to apply patch", false);
            }
        }
  8. order_without_power

    BL Coding Harmony-Patch causes unrelated soundeffects to not play / strange sideeffect

    I also encountered that bug myself while writing one of my other mods.

    Try patching MissileHitCallBack only when needed, then unpatching it immediately after.

    Add a MissionBehavior in your SubModule like this:

    C#:
        public class YourSubModule : MBSubModuleBase
        {
            public override void OnBeforeMissionBehaviorInitialize(Mission mission) => mission.AddMissionBehavior(new YourMissionBehavior());
        }

    In this MissionBehavior, manually patch when an agent shoots a missile and unpatch when the missile hits like this:

    C#:
        public class YourMissionBehavior : MissionBehavior
        {
            private Harmony _harmony = new Harmony("sy.piercingprojectiles");
    
            public override MissionBehaviorType BehaviorType => MissionBehaviorType.Other;
    
            public override void OnAgentShootMissile(Agent shooterAgent, EquipmentIndex weaponIndex, Vec3 position, Vec3 velocity, Mat3 orientation, bool hasRigidBody, int forcedMissileIndex)
            {
                _harmony.Patch(AccessTools.Method(typeof(Mission), "MissileHitCallback"),
                    transpiler: new HarmonyMethod(typeof(HarmonyPatches), nameof(HarmonyPatches.Mission_MissileHitCallback_Transpiler)));
    
                if (!_patchApplied)
                    PiercingProjectiles.Message($"{nameof(PiercingProjectiles)}: failed to apply patch", false);
            }
    
            public override void OnMissileHit(Agent attacker, Agent victim, bool isCanceled, AttackCollisionData collisionData)
            {
                _harmony.Unpatch(AccessTools.Method(typeof(Mission), "MissileHitCallback"),
                    AccessTools.Method(typeof(HarmonyPatches), nameof(HarmonyPatches.Mission_MissileHitCallback_Transpiler)));
            }
        }
  9. order_without_power

    Resolved General [1.7.2] Loading any mods with dlls before Native causes siege engine placement icons to be not visible

    Are you still experiencing this issue on the latest version of the game?
    No, it has been fixed!
  10. order_without_power

    BL Coding Harmony prefix with internal parameter

    Try casting the parameter to object.
  11. order_without_power

    When are lords going to learn to surrender?

    Fret not, I have the solution right here. Behold!

  12. order_without_power

    BL Coding Character Creation problem

    You need to create two new classes, one inheriting from StoryModeCharacterCreationContent and the other from SandboxCharacterCreationContent.
后退
顶部 底部