Dinorush-MeleeSwingCustomization icon

MeleeSwingCustomization

Improves Bat's hitbox and adds customization for devs.

Last updated 2 months ago
Total downloads 1697
Total rating 0 
Categories Client Mods Rundown Mods Dev Tools
Dependency string Dinorush-MeleeSwingCustomization-1.1.1
Dependants 4 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack_GTFO-3.2.1 icon
BepInEx-BepInExPack_GTFO

BepInEx pack for GTFO. Preconfigured and includes Unity Base DLLs.

Preferred version: 3.2.1

README

MeleeSwingCustomization

Improves bat hitbox by moving the swing (not direct hit) hitbox a little bit farther out.

Customization (Requires MTFO)

Reads custom files under Custom/MeleeSwingCustomization. You can customize the hitbox location for swings (i.e. the attack sphere) and pushes, set capsule hitboxes for swings, and adjust the speed of swing/push animations. Speed adjustments automatically scale attack timings (i.e. MeleeAnimation times). A template file is generated on game launch if the folder does not exist. Files support LiveEdit and immediately apply changes on save. They have the format:

[ // Can contain multiple blocks
    {
        "ArchetypeID": 4,       // MeleeArchetypeID of the target weapon
        "Name": "Improved Bat", // Purely for organization
        "AttackOffset": "(0 0.55 0)", // Position offset for the attack sphere. null uses the original.
        "PushOffset": null,     // Position offset the push sphere. null uses the original.
        "LightAttackSpeed": 1,  // Speed modifier for light attacks/hits
        "ChargedAttackSpeed": 1,// Speed modifier for charged attacks/hits
        "PushSpeed": 1          // Speed modifier for pushes
        "AttackSphereCenterMod": 1.9; // Modifier on attack sphere radius when the hitbox is at the center of the screen.
    },
]

AttackOffset also supports capsule hit detection. To use it, specify 2 or 3 offsets. The first specifies the position offset for the attack sphere, while the next two specify the start and end for the capsule, respectively. If a third offset is not specified, the capsule end is set as the attack offset. For exmaple, this makes a capsule hitbox from (0, -0.2, 0) to (0, 0.55, 0):

"AttackOffset": "(0 0.55 0) (0 -0.2 0)"

AttackOffset also supports a larger object definition for further customization:

"AttackOffset": {
    "Offset": "(0 0.55 0) (0 -0.2 0)",   // Position offset for the attack sphere/capsule.
    "CapsuleOffset": "(0 -0.2 0)"        // Parallel field to Offset that specifies only capsule offsets.
                                           // Useful if you don't want to modify the attack sphere offset.
    "CapsuleUseCamFwd": false,           // Capsule uses CameraDamageRayLength to compute capsule length.
                                           // Starts at the first capsule offset, drawing towards the second.
                                           // If none are specified, draws from (0, 0, 0) to the attack offset.
    "CapsuleCamFwdAdd": 0,               // Modifier added with CameraDamageRayLength to compute capsule length.
    "CapsuleSize": 0,                    // Radius/size of the capsule. 0 uses AttackSphereRadius.
    "CapsuleUseCenterMod": false         // Applies the "AttackSphereCenterMod" bonus to CapsuleSize.
}

Short Guide to Melee Hitboxes

Melee follows a 3-step process:

  1. Direct Hits
    • Hits whatever is being looked at within CameraDamageRayLength (MeleeArchetype) distance.
    • If something is being looked at within said distance, no other hitboxes can be active.
  2. Attack Sphere
    • Centered on the attack offset, hits any enemy/lock within AttackSphereRadius (MeleeArchetype) of the offset.
  3. View to Attack Offset
    • Checks for hits on a line from the player's viewpoint to the attack offset.
    • Hits enemies/locks if AttackSphere hit something, otherwise hits anything.

Capsule hit detection adds an additional 4th step that functions identically to Attack Sphere (but uses a capsule instead).

Examples

Big hitbox at the end of the weapon, thin handle hitbox

  • Set attack offset to the location of the big hitbox and specify AttackSphereRadius as needed.
  • Specify capsule endpoints for the handle with a small CapsuleSize.

Extend Hitbox a bit farther but don't hit walls any farther away

  • Specify a capsule endpoint (start or end) past the attack offset.

Extend range with GtfXP MeleeRangeMultiplier

  • Use CapsuleUseCamFwd to scale with the same modifier
  • Use CapsuleCamFwdAdd to get the hitbox to be close to the standard range
  • Optional: Specify capsule start point and/or end point (draws from 0 -> attack offset by default).