Okay, I'm trying to write a zEdit patch that'll automatically apply the True Spear Combat script and keywords to any weapon that comes up as a spear. I have the filtering working 100%, but when it comes time to add the keywords and script, zEdit keeps erroring out on the last line here:
patch:function(record, helpers, settings, locals){let weap = xelib.GetElement(locals.tsc_file,'Tsc_SteelSpear');let script = xelib.GetScript(weap,'WeaponStyleSpearScript');let scr = xelib.ElementToObject(script);const name = xelib.LongName(record);
helpers.logMessage(`Patching weapon ${name}`);if(name.includes('Halberd')){
helpers.logMessage(`Weapon ${name} is a halberd; adding halberd keyword.`);
xelib.AddKeyword(record, locals.tsc_keyword_halberd);}elseif(name.includes('Shortspear')){
helpers.logMessage(`Weapon ${name} is a short spear; adding spear keyword.`);
xelib.AddKeyword(record, locals.tsc_keyword_spear);}else{
helpers.logMessage(`Weapon ${name} is a long spear; adding long spear keyword.`);
xelib.AddKeyword(record, locals.tsc_keyword_longspear);}
xelib.AddScript(record, scr.Script.scriptName, scr.Script.Flags);}
Apparently, zEdit "failed to resolve element at path: scriptName", which suggests that it's expecting an xEdit path. But scripts don't have such a path. I tried resolving it by adding the original ESP as a master, but that errored out as well (the documentation says that AddMaster expects a filename, but it errors out saying that it's expecting a file handle if you give a filename and a filename if you give a file handle, WTF?). I'm not sure what the right thing to do here is.
Question
DarkPhoenixFF4
Okay, I'm trying to write a zEdit patch that'll automatically apply the True Spear Combat script and keywords to any weapon that comes up as a spear. I have the filtering working 100%, but when it comes time to add the keywords and script, zEdit keeps erroring out on the last line here:
Apparently, zEdit "failed to resolve element at path: scriptName", which suggests that it's expecting an xEdit path. But scripts don't have such a path. I tried resolving it by adding the original ESP as a master, but that errored out as well (the documentation says that AddMaster expects a filename, but it errors out saying that it's expecting a file handle if you give a filename and a filename if you give a file handle, WTF?). I'm not sure what the right thing to do here is.
1 answer to this question
Recommended Posts