About this mod
Adds a function for logging context-data like 'context.Source' to the BG3-Toolkit console (useful for debugging spells, statuses, passives etc.).
- Permissions and credits

Summary
Adds the stat-functor 'LogContextToConsole()' to the modding-toolkit, for logging things like 'context.Source' to the console (useful for debugging spells, statuses, passives etc.).
Installation
To install it globally when working on any mod, extract the 'Data' folder to your base Baldur's Gate 3 folder.
The folder structure should be something like:
/Baldurs Gate 3/Data/Scripts/thoth/helpers/LogContextToConsole.khn
Alternatively if you just want it when working on a single mod, copy the 'Scripts' folder to your specific mod.
The folder structure should be something like:
/Baldurs Gate 3/Data/Mods/<YOURMOD_00000000>/Scripts/thoth/helpers/LogContextToConsole.khn
Function
LogContextToConsole([contextData],[maxDepth])
When the function is called by whatever it's attached to (like a spell, status, passive etc.), it will throw a runtime error that will log the context-data to the modding-toolkit console (the area at the bottom of the modding-toolkit, see the preview screenshot below).
Details
Example usage:
data "OnApplyFunctors" "IF(LogContextToConsole()):ApplyStatus(CHILLED,100,1)"
data "OnApplyFunctors" "IF(LogContextToConsole(context.Source)):ApplyStatus(CHILLED,100,1)"
Clicking on the ''Condition execution failed:'' error in the console will expand it and allow you to select and copy+paste the logged data to actually examine it. The data is in a JSON format, so to make it human readable you'll want to throw it into a JSON formatter/linter (like JSON Editor Online) to give it proper indentation etc. (I couldn't pretty-print it by default as the data tended to get cut-off).
NOTE: The conditional where you use the logging function will always fail to execute due to the runtime error, so it's only supposed to be used while debugging stuff and understanding the layout of the context-data. As the only way I could figure out how to log data to the console was by throwing a runtime error (if anyone figures out how to log to the modding-toolkit console without having to throw a runtime error, let me know).
Preview Screenshot

Example Context Data
{
"Event": "",
"HasContextFlag": "function: 00000000B774C940",
"StatusId": "BS_DEBUG_PRONETESTING",
"StatusEvent": {
"name": "OnApply",
"value": "16"
},
"StatusRemoveCause": {
"name": "External",
"value": "3"
},
"PassiveId": "",
"PassiveFunctorIndex": "-1",
"InterruptId": "",
"InterruptedRoll": {
"Difficulty": "0",
"NaturalRoll": "0",
"Total": "0",
"RollType": {
"name": "None",
"value": "0"
},
"Ability": {
"name": "None",
"value": "0"
},
"RollCritical": {
"name": "None",
"value": "0"
},
"AdvantageState": {
"name": "None",
"value": "0"
}
},
"CheckedAbility": {
"name": "None",
"value": "0"
},
"CheckedSkill": {
"name": "None",
"value": "19"
},
"SpellModificationDescription": {
"SpellId": "",
"TargetRadius": "0.0",
"AreaRadius": "0.0",
"NumberOfTargets": "0"
},
"Distance": "0.0",
"SourcePosition": {
"Length": "4.3732137680054",
"X": "3.75",
"Y": "-0.0009765625",
"Z": "2.25"
},
"TargetPosition": {
"Length": "4.3732137680054",
"X": "3.75",
"Y": "-0.0009765625",
"Z": "2.25"
},
"ObserverPosition": {
"Length": "inf",
"X": "3.4028234663853e+38",
"Y": "3.4028234663853e+38",
"Z": "3.4028234663853e+38"
},
"PreferredCastingAbility": {
"name": "Wisdom",
"value": "5"
},
"AttackDescription": {
"GetDamageDoneForType": "function: 00000000B766A1D0",
"InitialHPPercentage": "0",
"TotalHealDone": "0",
"TotalDamageDone": "0"
},
"HitDescription": {
"GetDamageDoneForType": "function: 00000000B766A200",
"GetLastConditionRoll": "function: 00000000B766A230",
"IsDamagedAfterMiss": "false",
"IsFromSneak": "false",
"IsHitpointsDamaged": "false",
"IsInstantKill": "false",
"IsKillingBlow": "false",
"IsReaction": "false",
"FirstAttack": "false",
"LastAttack": "false",
"IsHit": "false",
"IsMiss": "false",
"IsCritical": "false",
"IsCriticalHit": "false",
"IsCriticalMiss": "false",
"OriginalDamageValue": "0",
"TotalHealDone": "0",
"TotalDamageDone": "0",
"SpellLevel": "0",
"SpellPowerLevel": "0",
"SpellSchool": {
"name": "None",
"value": "0"
},
"AttackAbility": {
"name": "Wisdom",
"value": "5"
},
"AttackType": {
"name": "None",
"value": "0"
},
"CauseType": {
"name": "StatusTick",
"value": "5"
},
"DeathType": {
"name": "None",
"value": "0"
},
"HitWith": {
"name": "None",
"value": "0"
},
"MainDamageType": {
"name": "None",
"value": "0"
},
"SaveAbility": {
"name": "None",
"value": "0"
},
"InflicterObject": {
"IsValid": "true",
"Level": "1",
"ProficiencyBonus": "2",
"IsInvulnerable": "false",
"HP": "10",
"HPWithoutTemporaryHP": "10",
"MaxHP": "10",
"MaxHPWithoutTemporaryHP": "10",
"TemporaryHP": "0",
"HPPercentage": "100",
"HPPercentageWithoutTemporaryHP": "100",
"GetClassLevel": "function: 00000000B76D6050",
"GetPassiveSkill": "function: 00000000B76D5F90",
"GetSavingThrow": "function: 00000000B76D5FC0",
"HasAnyResistances": "function: 00000000B76D6020",
"HasAllResistances": "function: 00000000B76D5FF0",
"Weight": "75000",
"Size": {
"name": "Medium",
"value": "2"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "13",
"Dexterity": "13",
"Constitution": "14",
"Intelligence": "10",
"Wisdom": "17",
"Charisma": "8",
"Athletics": "1",
"Acrobatics": "1",
"SleightOfHand": "1",
"Stealth": "1",
"Arcana": "0",
"History": "2",
"Investigation": "0",
"Nature": "0",
"Religion": "2",
"AnimalHandling": "3",
"Insight": "5",
"Medicine": "5",
"Perception": "3",
"Survival": "3",
"Deception": "-1",
"Intimidation": "-1",
"Performance": "-1",
"Persuasion": "-1"
},
"ThrownObject": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B76D5F60",
"GetPassiveSkill": "function: 00000000B766A2C0",
"GetSavingThrow": "function: 00000000B766A2F0",
"HasAnyResistances": "function: 00000000B766A350",
"HasAllResistances": "function: 00000000B766A320",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
}
},
"Source": {
"IsValid": "true",
"Level": "1",
"ProficiencyBonus": "2",
"IsInvulnerable": "false",
"HP": "10",
"HPWithoutTemporaryHP": "10",
"MaxHP": "10",
"MaxHPWithoutTemporaryHP": "10",
"TemporaryHP": "0",
"HPPercentage": "100",
"HPPercentageWithoutTemporaryHP": "100",
"GetClassLevel": "function: 00000000B7669FC0",
"GetPassiveSkill": "function: 00000000B7669F00",
"GetSavingThrow": "function: 00000000B7669F30",
"HasAnyResistances": "function: 00000000B7669F90",
"HasAllResistances": "function: 00000000B7669F60",
"Weight": "75000",
"Size": {
"name": "Medium",
"value": "2"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "13",
"Dexterity": "13",
"Constitution": "14",
"Intelligence": "10",
"Wisdom": "17",
"Charisma": "8",
"Athletics": "1",
"Acrobatics": "1",
"SleightOfHand": "1",
"Stealth": "1",
"Arcana": "0",
"History": "2",
"Investigation": "0",
"Nature": "0",
"Religion": "2",
"AnimalHandling": "3",
"Insight": "5",
"Medicine": "5",
"Perception": "3",
"Survival": "3",
"Deception": "-1",
"Intimidation": "-1",
"Performance": "-1",
"Persuasion": "-1"
},
"Target": {
"IsValid": "true",
"Level": "1",
"ProficiencyBonus": "2",
"IsInvulnerable": "false",
"HP": "10",
"HPWithoutTemporaryHP": "10",
"MaxHP": "10",
"MaxHPWithoutTemporaryHP": "10",
"TemporaryHP": "0",
"HPPercentage": "100",
"HPPercentageWithoutTemporaryHP": "100",
"GetClassLevel": "function: 00000000B76D6140",
"GetPassiveSkill": "function: 00000000B76D6080",
"GetSavingThrow": "function: 00000000B76D60B0",
"HasAnyResistances": "function: 00000000B76D6110",
"HasAllResistances": "function: 00000000B76D60E0",
"Weight": "75000",
"Size": {
"name": "Medium",
"value": "2"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "13",
"Dexterity": "13",
"Constitution": "14",
"Intelligence": "10",
"Wisdom": "17",
"Charisma": "8",
"Athletics": "1",
"Acrobatics": "1",
"SleightOfHand": "1",
"Stealth": "1",
"Arcana": "0",
"History": "2",
"Investigation": "0",
"Nature": "0",
"Religion": "2",
"AnimalHandling": "3",
"Insight": "5",
"Medicine": "5",
"Perception": "3",
"Survival": "3",
"Deception": "-1",
"Intimidation": "-1",
"Performance": "-1",
"Persuasion": "-1"
},
"Observer": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B7669B10",
"GetPassiveSkill": "function: 00000000B7669A50",
"GetSavingThrow": "function: 00000000B7669A80",
"HasAnyResistances": "function: 00000000B7669AE0",
"HasAllResistances": "function: 00000000B7669AB0",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
},
"Passive": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B766A1A0",
"GetPassiveSkill": "function: 00000000B766A0E0",
"GetSavingThrow": "function: 00000000B766A110",
"HasAnyResistances": "function: 00000000B766A170",
"HasAllResistances": "function: 00000000B766A140",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
},
"SourceProxy": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B7669C00",
"GetPassiveSkill": "function: 00000000B7669B40",
"GetSavingThrow": "function: 00000000B7669B70",
"HasAnyResistances": "function: 00000000B7669BD0",
"HasAllResistances": "function: 00000000B7669BA0",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
},
"TargetProxy": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B766A0B0",
"GetPassiveSkill": "function: 00000000B7669FF0",
"GetSavingThrow": "function: 00000000B766A020",
"HasAnyResistances": "function: 00000000B766A080",
"HasAllResistances": "function: 00000000B766A050",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
},
"ObserverProxy": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B7669ED0",
"GetPassiveSkill": "function: 00000000B7669E10",
"GetSavingThrow": "function: 00000000B7669E40",
"HasAnyResistances": "function: 00000000B7669EA0",
"HasAllResistances": "function: 00000000B7669E70",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
},
"AttackWeapon": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B7669DE0",
"GetPassiveSkill": "function: 00000000B7669D20",
"GetSavingThrow": "function: 00000000B7669D50",
"HasAnyResistances": "function: 00000000B7669DB0",
"HasAllResistances": "function: 00000000B7669D80",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
},
"UsedItem": {
"IsValid": "false",
"Level": "0",
"ProficiencyBonus": "0",
"IsInvulnerable": "false",
"HP": "0",
"HPWithoutTemporaryHP": "0",
"MaxHP": "0",
"MaxHPWithoutTemporaryHP": "0",
"TemporaryHP": "0",
"HPPercentage": "0",
"HPPercentageWithoutTemporaryHP": "0",
"GetClassLevel": "function: 00000000B7669CF0",
"GetPassiveSkill": "function: 00000000B7669C30",
"GetSavingThrow": "function: 00000000B7669C60",
"HasAnyResistances": "function: 00000000B7669CC0",
"HasAllResistances": "function: 00000000B7669C90",
"Weight": "0",
"Size": {
"name": "None",
"value": "-1"
},
"ArmorType": {
"name": "None",
"value": "0"
},
"ActionTypes": {
"ActionTypes": {}
},
"EquipmentSlot": {
"name": "None",
"value": "22"
},
"Strength": "0",
"Dexterity": "0",
"Constitution": "0",
"Intelligence": "0",
"Wisdom": "0",
"Charisma": "0",
"Athletics": "0",
"Acrobatics": "0",
"SleightOfHand": "0",
"Stealth": "0",
"Arcana": "0",
"History": "0",
"Investigation": "0",
"Nature": "0",
"Religion": "0",
"AnimalHandling": "0",
"Insight": "0",
"Medicine": "0",
"Perception": "0",
"Survival": "0",
"Deception": "0",
"Intimidation": "0",
"Performance": "0",
"Persuasion": "0"
}
}