IWantMyMod Posted April 2, 2018 Posted April 2, 2018 Lets say I have this:pluginFile := FileByIndex('My Plugin'); weapon := RecordByEditorID(pluginFile, 'MyWeapon'); formList := RecordByEditorID(pluginFile, 'MyFormList');So I have an IInterface for a weapon and an IInterface for a FormList. How do I add the weapon to the formList?
0 zilav Posted April 2, 2018 Posted April 2, 2018 (edited) formids := ElementByName(formList, 'FormIDs'); SetEditValue( ElementAssign(formids, HighInteger, nil, False), Name(weapon) ); Edited April 2, 2018 by zilav
0 IWantMyMod Posted April 7, 2018 Author Posted April 7, 2018 Thank you. I would have never figured that out on my own. I wish I could find more well annotated examples of how to do various common tasks. I discovered that RecordByEditorID() will not return an ARMO or FLST so I have to use MainRecordByEditorID(GroupBySignature(skyrim, 'ARMO'), 'ArmorDaedricShield') for example. Also I discovered that if the FormList has no item then formids := ElementByName(formList, 'FormIDs') will return null and SetEditValue( ElementAssign(formids, HighInteger, nil, False), Name(weapon) ) fails. I tried using formids := Add(formList, 'FormIDs', true). It worked but I end up with a null item in the list. Is there a way to add an empty FormIDs to the FormList?
0 zilav Posted April 8, 2018 Posted April 8, 2018 No, you can't add empty arrays in xEdit, it always creates an empty entry in them automatically. You can use that empty element with proper checksformids := ElementByName(formList, 'FormIDs'); if not Assigned(formids) then SetEditValue( ElementByIndex(Add(formList, 'FormIDs', True), 0), Name(weapon) ) else SetEditValue( ElementAssign(formids, HighInteger, nil, False), Name(weapon) );
Question
IWantMyMod
Lets say I have this:
So I have an IInterface for a weapon and an IInterface for a FormList. How do I add the weapon to the formList?
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now