Jump to content


zEdit Patcher - How To Add A Script

  • Please log in to reply
1 reply to this topic

#1 DarkPhoenixFF4



  • Members
  • 17 posts

Posted 20 May 2019 - 04:09 AM

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);
                } else if (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.

  • 0

#2 Mator



  • Mod Authors
  • PipPipPipPipPipPipPipPipPip
  • 627 posts

Posted 07 July 2019 - 12:15 PM

Hi, could you maybe join the Modding Tools discord?  I provide most of my support there these days and it will make certain I can address your problems in a timely fashion.  If I reply here I may not remember to check for a week so, yeah.



  • 0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users