xedit-lib
xedit-lib copied to clipboard
SetLinksTo doesn't resolve unions
I was trying to do add a Condition via script, like this:
let conditionElem= xelib.AddElement(record, 'Conditions\\.');
xelib.SetIntValue(conditionElem, 'CTDA\\Type', 10010000);
xelib.SetFloatValue(conditionElem, 'CTDA\\Comparison Value', 1.0);
xelib.SetValue(conditionElem, 'CTDA\\Function', 'HasPerk');
xelib.SetValue(conditionElem, 'CTDA\\Run On', 'Reference');
xelib.SetValue(conditionElem, 'CTDA\\Reference', 'Player [00000014]');
xelib.SetLinksTo(conditionElem, 'CTDA\\Parameter #1', thePerk);
The last line gives me the error: "Error: Failed to set reference at: zPatch.esp\1000ACB2\Conditions[1], "CTDA\Parameter #1" Element cannot hold references." It obviously can, Parameter #1 must be a reference to the perk. This works as a workaround:
xelib.SetValue(conditionElem, 'CTDA\\Parameter #1', xelib.GetHexFormID(thePerk));