Core Impact Framework - API Usage

Table of Contents

πŸ“Œ Introduction

The Core Impact Framework (CIF) is an advanced and modular overhaul of Skyrim's impact system, designed to offer fine-grained customization of interactions between weapons, projectiles, and actors in the game. This framework allows for the adjustment, modification, and enrichment of impact effects in a wide variety of situations, making combat more immersive and dynamic. With a flexible system of filters and modifiers, it gives mod creators precise control over how impacts are managed based on context.

For example, CIF can adapt effects based on the armor worn by the target, differentiating impacts on heavy armor, light armor, or simple clothing. However, it goes beyond that: the impact calculation is done based on each piece of armor and the position of the impact. This means that the system evaluates the specific piece of armor the impact hits and applies effects accordingly.

In addition to this, the target's state, equipment, type of weapon used, the nature of the attack, and many other parameters can influence the result. Numerous filters and options allow for fine-tuning every detail, and everything is fully documented in this presentation.

πŸ”Ή Available Filters

Filters allow for further refinement of impact management based on several criteria:

Thanks to this approach, CIF allows for deep customization, providing a more realistic, varied, and impactful combat experience.

πŸ”Ή Advanced Modifiers

The CIF modifiers offer in-depth customization of impacts with a multitude of options. You can not only adjust visual, sound, and dynamic effects but also influence elements such as blood splatter, objects appearing after a hit, or specific sounds associated with each impact.

Here are some examples of possible modifiers:

These modifiers offer maximum flexibility to make impacts even more immersive and varied.


πŸ“Œ Prerequisites

Before starting this tutorial, and to save time, make sure you have the following skills:

If you're not comfortable with any of these skills or tools, it is recommended to acquire them before following this tutorial.

Great, now that we're all set up, let's dive into using the Core Impact Framework API.

πŸ“Œ Location of JSON Files

The JSON files should be placed in Data/SKSE/CoreImpactFramework. The exact organization of these files doesn't matter as long as they remain in this directory. You are free to organize them in subfolders as you see fit.

Similarly, there are no specific rules for naming the files: you are completely free to name them however you like.

In summary: as long as they are in this folder, everything is fine. The rest is up to you! βœ…

πŸ“Œ Impact Mapping - Structure and Functioning

{
  "ImpactMapping": [
    {
      "Comment": "Replaces the head impact (biped slot 30) with sparks for heavy armor when struck by arrows.",
      "Priority": 10,
      "Filters": {
        "Materials": ["Skyrim.esm:0x12F3F"],
        "BipedSlot": [31],
        "ArmorClasses": ["Heavy"],
        "WeaponsType": ["Ranged"],
        "Blocked": ["No"]
      },
      "Modifiers": {
        "ImpactData": "Skyrim.esm:0xF69C4"
      }
    }
  ]
}

ImpactMapping is an array in your JSON file that allows you to define rules for customizing impacts. Each object in this array contains:

This system allows you to adapt impacts based on a multitude of in-game situations.

⚠️ Important: ImpactMapping is strictly intended to replace visual and sound elements related to impacts. It is crucial to adhere to this rule, as once overrides are processed, only a single compiled ImpactMapping will be retained. Misusing this system to apply third-party, non-visual effects may interfere with other mods attempting to display impact visuals, leading to missing or incorrect effects.

For any functionality you wish to implement that does not directly affect visuals or sounds (such as using a spell to launch a script or apply damage, for example), please use Hit Mapping instead. HitMapping is more permissive and supports stacking, allowing multiple entries to be executed together without overwriting each other.

πŸ”Ή Priority - Rule Priority

The Priority field defines the order in which rules in the ImpactMapping are processed. A rule with a higher priority will be applied first and can override those with lower priority.

This system allows for the addition of exceptions and specific behaviors based on the importance of the rules.

πŸ”Ή Filters - Conditions to Validate

When an impact occurs, the Filters are evaluated. All conditions must be met for the Modifiers to be applied.

πŸ“ Important Notes:

πŸ”Ή Modifiers - Actions to Perform

The Modifiers are the actions that will be executed once the Filters have been validated. These actions allow you to replace or enhance the impact effects, adding sound effects, visual effects, or modifying the behavior of the impacts in the game.

The specific details of each Modifier element will be covered in a later step. For now, just remember that these are the actions that will truly customize the impact once the filters are validated.

πŸ”Ή Other parameters

Override : When this parameter is enabled (true), the framework continues to process objects even if the filters are valid. The Modifiers of the highest-priority objects will be kept and will override those of subsequent objects. This allows for the merging of multiple rule sets for the same impact event, where the highest-priority Modifiers take precedence.

For example, one set of rules might replace the sound effect, while another sets a new decal to be displayed, all within a single impact event. You can use this parameter as many times as necessary to create layered and varied effects.

OverrideMerge : This parameter, used in conjunction with Override, is less commonly used but allows merging array-type elements (such as ExtraImpactData) with those of lower-level objects. When OverrideMerge is enabled, the array elements will be added to those already present in the subsequent objects, rather than completely replacing them. This allows you to enrich effects without removing existing data, offering more flexibility in customizing impacts.

πŸ“Œ Hit Mapping - Structure and Functioning

{
  "HitMapping": [
    {
      "Comment": "Plays a sound and a slight magical effect upon impact.",
      "Priority": 10,
      "Class": "MyCustomEffects",
      "Filters": {
        "Materials": ["Skyrim.esm:0x12F3F"],
        "Blocked": ["No"]
      },
      "Modifiers": {
        "ExtraImpactData": ["Skyrim.esm:0x7331F"],
        "ExtraSound": ["Skyrim.esm:0x51939"]
      }
    },
    {
      "Comment": "When a hit is made to the head, in addition to the previous sound effect, the magical effect is replaced by a new, more dazzling one.",
      "Priority": 20,
      "Class": "MyCustomEffects",
      "Override": true,
      "Filters": {
        "Materials": ["Skyrim.esm:0x12F3F"],
        "BipedSlot": [31],
        "Blocked": ["No"]
      },
      "Modifiers": {
        "ExtraImpactData": ["Skyrim.esm:0x105F36"]
      }
    }
  ]
}

HitMapping is an array in your JSON file that defines additional rules for handling impacts, similar in structure to ImpactMapping but intended for different use cases.

While ImpactMapping is strictly reserved for replacing visual and sound effects related to impacts, HitMapping is specifically designed for gameplay-related modifications that do not directly affect visuals or sounds. It supports stacking, allowing multiple entries to coexist and be executed together without overwriting each other.

The elements of HitMapping are:

πŸ”Ή Class - Grouping and Overriding Objects

The Class parameter is a new addition that enables the use of the override system across multiple objects sharing the same class name. When you define a Class for an entry, it allows all objects with the same class name to either override or merge their modifiers depending on the Override setting. This provides greater control and flexibility when you want to apply specific behaviors or effects to a group of similar objects without needing to manually manage each individual entry.

For the override system to function correctly, it is mandatory to define a Class. If no Class is provided, the override mechanism will not be applied, and the object will remain independent. The Class parameter should be a string value, preferably concise and clear, to ensure ease of use and avoid conflicts with other class names.

πŸ”Ή Filters - Conditions to Validate

Filters in HitMapping are identical to those used in ImpactMapping.

Please refer to that section for a detailed explanation of how filters work.

πŸ”Ή Modifiers - Actions to Perform

⚠️ Only specific modifiers are available for HitMapping. Modifiers that directly alter the primary visual or audio effects of an impact are reserved for ImpactMapping and cannot be used globally through HitMapping.

The following modifiers are available for use in HitMapping to customize the impact effects:

πŸ“Œ Filters

Each filter is a condition that must be met for the modifiers to be applied. It's not necessary to declare all filters, only the ones you wish to use should be defined. Filters are inclusive, meaning all conditions within the same group must be fulfilled to be valid. However, within the arrays of each filter, the values work in OR: for example, if a weapon (WeaponsType) is filtered by the "Ranged" type and you have declared 3 specific projectile IDs (Projectiles[...]), it will mean that only ranged weapons will be compatible, but one of the three listed projectiles must be used by the weapon for the condition to be validated.

The only exception to this OR system is for Global Variables and Conditions, which must all be validated for the filter to be considered fulfilled. In other words, if multiple Globals or Conditions are defined, they function in AND, and each condition must be satisfied for the modifiers to apply.

πŸ“ Before moving on to the filter list, here are a few clarifications on the use of FormID and EditorID in the JSON:

Complete List of Filters

Parameter Description and Possible Values
Globales

Description: Defines conditions based on global game variables. Each entry consists of three elements: the global variable (EditorID or FormID), a comparison operator, and a value (integer or float). This is useful for triggering effects only when specific global game states are met.

Possible Values: Array of 3 elements:

  • Global Variable: EditorID (Global Variable), FormID (Global Variable)
  • Comparison: ==, !=, <, >, <=, >=
  • Value: Int, Float

Example:

"Globales": [
  ["My_Custom_GV", "==", 1],
  ["Plugin.esp:0x800", ">=", 100.0]
]

Conditions

Description: Array of perk FormIDs to check against. When using a perk for this purpose, it is unnecessary to fill in entry points because only the conditions linked to the perk will be evaluated.

Important: In these conditions, Target refers to the actor who takes the hit, while Subject refers to the actor who delivers the attack.

Possible Values: FormID (Perk)

Example:

"Conditions": ["Plugin.esp:0x800", "Plugin.esp:0x801", "Plugin.esp:0x802"]

Races

Description: Restricts effects to specific array of actor races. Can use EditorIDs or FormIDs. Useful for targeting particular creatures for an effect.

Possible Values: EditorID (Race), FormID (Race)

Example:

"Races": ["RaceNord", "Plugin.esp:0x800", "Plugin.esp:0x801"]

Keywords

Description: Matches any of the listed keywords against the relevant actor. Keywords are a great way to group specific races or actors under a common label, making it easy to target them.

Possible Values: EditorID (Keyword), FormID (Keyword)

Example:

"Keywords": ["Plugin.esp:0x800", "Plugin.esp:0x801", "ActorTypeNPC"]

Skins

Description: Checks if the actor has one of the listed skin armors equipped. Only FormID (Armor) are accepted.

Possible Values: FormID (Armor)

Example:

"Skins": ["Plugin.esp:0x800", "Plugin.esp:0x801", "Plugin.esp:0x802"]

Materials

Description: Checks if the actor race has one of the listed material type. Only FormID (MaterialType) are accepted.

In most cases, it is the ID associated with the MaterialSkin Form (0x12F3F), which is used for humanoid characters' skin materials (including the player).

Possible Values: FormID (MaterialType)

Example:

"Materials": ["Skyrim.esm:0x12F3F", "Plugin.esp:0x800", "Plugin.esp:0x801"]

FormID

Description: Filters based on the FormID of the target actor, either the placed reference or its base object. Useful for applying specific effects to particular actors or creatures.

Possible Values: FormID (Actor or ActorBase)

Example:

"FormID": ["Plugin.esp:0x800", "Plugin.esp:0x801"]

BipedSlot

Description: Filters based on the affected body slot(s). Accepts integer slot values (e.g., 30 for head, 32 for body), EditorIDs, or FormIDs of global variables. Use this when you need to apply effects to specific armor pieces or body parts during an attack or hit event.

⚠️ In order for the BipedSlot filter to work, make sure the targeted actors have a proper Biped Mapping associated with them (see the chapter below). If you're dealing with vanilla creatures, they should already be covered by the mod, so you don't need to worry about it.

Possible Values: Int, EditorID (Global Variable), FormID (Global Variable)

Example:

"BipedSlot": [30, 32, "Plugin.esp:0x800", "MyGlobalEditorID"]

ArmorClasses

Description: Restricts conditions to certain armor types. Use this to apply different effects based on how heavily armored a character is.

Possible Values: Default, Cloth, Light, Heavy

Example:

"ArmorClasses": ["Light", "Heavy"]

WeaponsType

Description: Filters by weapon type. Covers all major categories: swords, axes, maces, daggers, ranged weapons, magic, hand-to-hand, and even creature-based attacks. Essential for differentiating combat behavior and effects between melee, ranged, or magical combat styles.

Possible Values: OneHandSword, TwoHandSword, OneHandAxe, TwoHandAxe, OneHandMace, TwoHandMace, Dagger, Ranged, Magic, HandToHand, Beast, Other

Example:

"WeaponsType": ["OneHandSword", "TwoHandSword", "OneHandAxe", "TwoHandAxe"]

Weapons

Description: Checks if the weapon used matches any in the provided list of FormIDs. Ideal for effects tied to specific weapons, such as legendary blades or custom modded equipment.

Possible Values: FormID (Weapon)

Example:

"Weapons": ["Plugin.esp:0x800", "Plugin.esp:0x801", "Plugin.esp:0x802"]

Projectiles

Description: Applies conditions based on the projectile used (arrows, bolts, magical missiles, etc.). Useful for tailoring effects to specific ammo types or magical attacks.

Possible Values: FormID (Projectile)

Example:

"Projectiles": ["Plugin.esp:0x800", "Plugin.esp:0x801", "Plugin.esp:0x802"]

Attacks

Description: Restricts to specific attack types. This allows for fine-tuned control, such as triggering effects only on heavy attacks or bash.

Possible Values: Regular, Power, Bash

Example:

"Attacks": ["Regular", "Power"]

Blocked

Description: Determines whether the attack was blocked, and how. Great for creating mechanics that respond differently depending on the method of defense.

Possible Values: No, ShieldLight, ShieldHeavy, Weapon

Example:

"Blocked": ["ShieldLight", "ShieldHeavy"]

States

Description: Filters based on the target's state. Useful to prevent effects from triggering on already-dead actors, or to add specific death animations or final blows.

Possible Values: Alive, Dying, Killmove, Dead

Example:

"States": ["Dying", "Killmove"]

CriticalAttack

Description: Filters based on whether the hit was a critical attack. Useful to apply special effects only during critical strikes.

Possible Values: Yes, No

Example:

"CriticalAttack": ["Yes"]

SneakAttack

Description: Filters based on whether the hit was delivered while sneaking. Ideal for triggering specific effects for stealth attacks.

Possible Values: Yes, No

Example:

"SneakAttack": ["No"]

Percentage

Description: This value represents the chance for the condition to be valid. A random number between 0 and 100 is rolled when the impact happens. If this number is lower than the specified value, the condition is valid. For example, setting it to 80 means the filter has an 80% chance to be valid.

Possible Values: Float, EditorID (Global Variable), FormID (Global Variable)

Example:

"Percentage": 25.0

MaxHealth

Description: This value represents a percentage of the character's maximum health. As long as the current health is below the specified value, the condition will be valid.

Possible Values: Float, EditorID (Global Variable), FormID (Global Variable)

Example:

"MaxHealth": 80.0

MinDamage

Description: This value represents the minimum percentage of health that must be removed by the attack. As long as the damage dealt meets or exceeds the specified value, the condition will be valid.

Possible Values: Float, EditorID (Global Variable), FormID (Global Variable)

Example:

"MinDamage": 20.0

πŸ“Œ Modifiers

Once the filters are validated, the following modifiers may be applied.

Parameter Description and Possible Values
ImpactData

Description: The primary impact effect applied upon hit, replacing the game's original effect.

Possible Values: FormID (Impact Data)

Example:

"ImpactData": "Plugin.esp:0x800"

⚠️ This modifier is only available for ImpactMapping.

BloodSpray

Description: This spell is cast toward the direction of the blood spray and is used to generate visual gore effects upon impact. Each Magic Effect in the spell must have a projectile assigned, as each one triggers an individual blood spray.

The first effect is launched at full velocity, while subsequent ones use reduced speed to simulate realistic blood physics. The framework automatically adjusts the velocity, so there's no need to modify the projectiles properties yourself.

You can also use the CK Conditions menu to control whether the spell should be cast, offering flexibility in its application based on the context of the hit.

Possible Values: FormID (Spell)

Example:

"BloodSpray": "Plugin.esp:0x800"

ExtraImpactData

Description: An array of additional impact effects applied upon hit. Each effect in the array will be played individually, but no sound or decal will be applied.

Possible Values: Array of FormID (Impact Data)

Example:

"ExtraImpactData": ["Plugin.esp:0x801", "Plugin.esp:0x802"]

ExtraSound

Description: An array of additional sounds played upon hit.

Possible Values: Array of FormID (Sound Descriptor)

Example:

"ExtraSound": ["Plugin.esp:0x900", "Plugin.esp:0x901"]

PreserveOriginalSound

Description: Whether to keep the original impact sound in addition to the overridden one. This is only relevant if ImpactData is specified.

Possible Values: Boolean

Example:

"PreserveOriginalSound": true

⚠️ This modifier is only available for ImpactMapping.

PreserveOriginalDecal

Description: Whether to keep the original impact decal in addition to the overridden one. This is only relevant if ImpactData is specified.

Possible Values: Boolean

Example:

"PreserveOriginalDecal": true

⚠️ This modifier is only available for ImpactMapping.

SoundOverride

Description: Sound effect that overrides the default impact sound, taking precedence over PreserveOriginalSound.

Possible Values: FormID (Descriptor Form)

Example:

"SoundOverride": "Plugin.esp:0x800"

⚠️ This modifier is only available for ImpactMapping.

DecalOverride

Description: Decal effect that overrides the default impact decal.

Possible Values: FormID (Impact Data)

Example:

"DecalOverride": "Plugin.esp:0x800"

⚠️ This modifier is only available for ImpactMapping.

RemoveDecal

Description: Whether to remove the impact decal entirely. This takes precedence over all other settings related to decals.

Possible Values: Boolean

Example:

"RemoveDecal": false

⚠️ This modifier is only available for ImpactMapping.

RemoveBloodSplatter

Description: Determines whether to force the game to disable default blood splatter generation on impact.

πŸ“ Note: This does not affect dynamic blood sprays.

Possible Values: Boolean

Example:

"RemoveBloodSplatter": true

⚠️ This modifier is only available for ImpactMapping.

ImpactBounce

Description: Whether to allow physical projectiles, such as arrows, to bounce upon impact.

Possible Values: Boolean

Example:

"ImpactBounce": true

⚠️ This modifier is only available for ImpactMapping.

Spells

Description: Array of spells cast when the modifier is triggered. The spells will be applied immediately, with the target being the actor hit and the subject being the one responsible for the hit.

Possible Values: Array of FormID (Spell)

Example:

"Spells": ["Plugin.esp:0x800", "Plugin.esp:0x801"]

PlacedObjects

Description: Array of objects placed in the world upon hit. These can be any visible object in the world. Most often, you will want to use explosions. The object will be placed precisely at the impact point.

Possible Values: Array of FormID (Any Form)

Example:

"PlacedObjects": ["Plugin.esp:0x800", "Plugin.esp:0x801"]

πŸ“Œ Biped Mapping (For new races/creature only)

This section explains how to define the nodes associated with biped slots. These definitions enable the use of certain filters and features. In most cases, only the biped slots of NPCs capable of wearing armor will be used, but nothing prevents you from creating your own mapping for specific custom creatures.

Example: The following configuration shows how to define the mapping for Draugr.

{
  "BipedMapping": [
    {
      "Priority": 20,
      "Filters": {
        "Races": ["DraugrRace", "DraugrMagicRace", "DLC2HulkingDraugrRace"]
      },
      "BipedBones": {
        "31": ["NPC Head [Head]", "NPC Neck [Neck]"],
        "32": ["NPC Spine [Spn0]", "NPC Spine1 [Spn1]", "NPC Spine2 [Spn2]", "NPC COM [COM ]", "NPC L Thigh [LThg]", "NPC R Thigh [RThg]", "NPC L UpperArm [LUar]", "NPC R UpperArm [RUar]"],
        "33": ["NPC L Forearm [LLar]", "NPC R Forearm [RLar]", "NPC L Hand [LHnd]", "NPC R Hand [RHnd]"],
        "37": ["NPC L Calf [LClf]", "NPC R Calf [RClf]", "NPC L Foot [LLft ]", "NPC R Foot [Rft ]"]
      }
    }
  ]
}

The table below shows the properties related to Biped Mapping. The priority system works the same way as for Impact Mapping, and the filters, though basic, also function in a similar manner.

Priority

Description: The priority of the biped mapping. Higher values will be applied first. Negative values can also be used.

Possible Values: Integer

Example:

"Priority": 10

Filters

Description: Filters that define the characters this biped mapping will apply to.

Fields within Filters:

  • Races: An array of races (EditorID (Race), FormID (Race)) to filter the biped mapping.
  • Keywords: An array of keywords (EditorID (Keyword), FormID (Keyword)) to further refine the filter. For example, the keyword "ActorTypeNPC" is used for all humanoid NPCs, and "IsBeastRace" is only used for Khajiit and Argonian.
  • Skins: An array of skin types (FormID (Armor)) that will be considered for the mapping.

Example:

"Filters": {
  "Races": ["RaceDarkElf", "RaceWoodElf"],
  "Keywords": ["ActorTypeNPC"],
  "Skins": []
}

BipedBones

Description: The key (30, 31, etc.) represents the biped slot to which the nodes will be associated. Biped slots are listed in the Creation Kit when creating a piece of armor, so feel free to refer to it in order to choose the slot best suited to your needs.

The linked array contains the list of node names associated with the biped slot. These nodes are represented by short character strings. You will find them in "skeleton.nif" files associated with the targeted races. You can open and analyze these files using NifSkope.

Example:

"BipedBones": {
  "31": ["NPC Head [Head]", "NPC Neck [Neck]"],
  "32": ["NPC Spine [Spn0]", "NPC Spine1 [Spn1]", "NPC Spine2 [Spn2]", "NPC COM [COM ]"],
  "37": ["..."]
}

πŸ“Œ Testing in the Game

After configuring your JSON files, it is crucial to test your changes in the game to ensure they work as intended. If you encounter a crash when launching the game, it likely means that the structure of one of your JSON files is malformed (possibly an extra comma). Feel free to use tools like JSON Formatter to validate your JSON files or find potential errors.

Once the game is running, be sure to check the CoreImpactFramework.log file (located in Documents\My Games\Skyrim Special Edition\SKSE) for any errors or issues with your JSON files. Regularly check this file during your testing to identify and quickly correct errors. This will help you refine your configuration and ensure smooth integration into the game.