Skip to content

Instantly share code, notes, and snippets.

View LaughingLeader's full-sized avatar

LaughingLeader

  • The Batcave
View GitHub Profile
@LaughingLeader
LaughingLeader / EventManager.lua
Last active October 27, 2022 01:08
Example of making a system for registering functions to call when flags are set, for Divinity: Original Sin 2 with the Script Extender.
EventManager = {
Register = {},
}
---@alias EventManagerObjectFlagSetCallback fun(flag:string, targetGUID:GUID, dialogInstance:integer)
local _Callbacks = {
ObjectFlagSet = {
---@type table<string, EventManagerObjectFlagSetCallback[]>
Active = {},
@LaughingLeader
LaughingLeader / LeaderLibSkillListenerExample.lua
Last active April 11, 2021 21:49
An example of using LeaderLib's skill listener to create a function that runs during each different skill state.
--[[
Add LeaderLib's Lua folder to VSCode workspace (not the mod) so EmmyLua will use the scripts for auto-completion.
With the way EmmyLua works, if you set up these globals in a different file,
EmmyLua will associate their usage with LeaderLib's scripts, so you'll see types/etc pointing back to the originals.
]]
--This should ideally be called in a script loaded by both client and server.
--It will import LeaderLib's various globals into your mod's table, so you can use helpers without setting them first.
--Mods.MyModTable needs to be the name you specified in your mod's ositools settings.
Mods.LeaderLib.Import(Mods.MyModTable)
@LaughingLeader
LaughingLeader / dos2de_vitalityscaling.py
Created September 9, 2020 18:15
Vitality scaling functions transcribed from decompiled code. For Divinity: Original Sin 2 - Definitive Edition.
import numpy as np
class ExtraDataClass():
def Reset(self):
setattr(self, "VitalityStartingAmount", 21)
setattr(self, "VitalityExponentialGrowth", 1.25)
setattr(self, "VitalityLinearGrowth", 9.091)
setattr(self, "VitalityToDamageRatio", 5)
setattr(self, "VitalityToDamageRatioGrowth", 0.2)
setattr(self, "FirstVitalityLeapLevel", 9)
@LaughingLeader
LaughingLeader / BootstrapClient.lua
Last active April 5, 2020 19:25
An Osiris Extender Lua script to override vitality and armor values in character stats (Divinity: Original Sin 2 - Definitive Edition).
local player_stats = {
--["_Base"] = true,
["_Hero"] = true,
["HumanFemaleHero"] = true,
["HumanMaleHero"] = true,
["DwarfFemaleHero"] = true,
["DwarfMaleHero"] = true,
["ElfFemaleHero"] = true,
["ElfMaleHero"] = true,
["LizardFemaleHero"] = true,
@LaughingLeader
LaughingLeader / ToggleScriptExample_ElementalArrowheads.txt
Last active January 9, 2020 21:14
An example of toggling a script on/off when specific statuses are applied.
PROC
MyMod_ToggleScript_Enable((STRING)_Script)
AND
NOT SysIsActive(_Script)
THEN
SysActivateGoal(_Script);
PROC
MyMod_ToggleScript_Disable("MyMod_TS_ElementalArrowheads")
AND
@LaughingLeader
LaughingLeader / MyMod_CheckWeaponTypes.gameScript
Created November 3, 2019 01:12
Checks for equipped weapon types and sends out a corresponding character event when one is found (for Divinity: Original Sin 2 - Definitive Edition).
INIT
EVENTS
EVENT MyMod_CheckWeaponTypes
VARS
CHARACTER:_Char
INT:_FoundType
ON
OnCharacterEvent(_Char, "MyMod_CheckWeaponType")
ACTIONS
@LaughingLeader
LaughingLeader / Auto Identify Story Script
Created August 1, 2019 01:44
DOS2DE story script that auto-identifies items if Loremaster meets a min value in the party.
//REGION AUTO_IDENTIFY
IF
ItemTemplateOpening(_, _Item, _Char)
AND
ObjectGetFlag(_Item, "LLTEST_LORE_Identified", 0)
AND
CharacterIsPlayer(_Char, 1)
AND
LLTEST_LORE_PartyHasHighEnoughLoremaster(_Char, 5)
AND
@LaughingLeader
LaughingLeader / meta.lsx
Last active September 7, 2023 08:12
Origin multiplayer limit override for Divinity: Original Sin 2: Definitive Edition. Right click Raw -> Save Link As, then place this file at "Divinity Original Sin 2\DefEd\Data\Mods\DivinityOrigins_1301db3d-1f54-4e98-9be5-5094030916e4\meta.lsx". Make the folders as needed. The "NumPlayers" value is the player limit.
<?xml version="1.0" encoding="UTF-8" ?>
<save>
<header version="2" />
<version major="3" minor="6" revision="2" build="0" />
<region id="Config">
<node id="root">
<children>
<node id="Dependencies">
<children>
<node id="ModuleShortDesc">
@LaughingLeader
LaughingLeader / MyMod_Statuses.gameScript
Last active June 17, 2019 20:03
An example of how to implement an incremental status with behavior scripting (Divinity: Original Sin 2 - Definitive Edition Modding) (no incremental turn version).
INIT
EVENTS
/*
Apply MYMOD_PAIN_APPLY with a skill or whatever is appropriate (weapon, script, etc).
This status should have the amount of turns you want the actual status to be, i.e.:
MYMOD_PAIN_APPLY,100,3
MYMOD_PAIN_1 to 5 should have increasing StackPriority properties,
@LaughingLeader
LaughingLeader / MyMod_TalentBonuses.gameScript
Created April 3, 2019 00:53
A gameScript that applies a status influence (permanent status) to players with the Escapist talent.
INIT
INT:%MyMod_InitialTalentCheck = 0
EVENTS
//MYMOD_ESCAPIST_BONUS is a CONSUME status that applies a potion via the StatsId property that increases movement speed.
EVENT MyMod_EscapistTalent_Added
VARS
CHARACTER:_Player
ON
OnTalentUnlocked(_Player, Escapist)