Nymra Posted March 27, 2022 Posted March 27, 2022 I am curious if there is a way to obtain the ESP name of an item (like for example weapon or piece of armor) via script? I wanted to create a "Load Order Proof" way of transfering items between profiles and if I could get the ESP name this should be possible?! All mods I found "forget" items if the load order changes and the owning ESP has another prefix. thx alot
Tlam99 Posted March 27, 2022 Posted March 27, 2022 Bool weapon Getformfromfile(id, string) Returns true if there Id 0x00000nnn, string xxxx.esp
Nymra Posted March 27, 2022 Author Posted March 27, 2022 19 minutes ago, Tlam99 said: Bool weapon Getformfromfile(id, string) Returns true if there Id 0x00000nnn, string xxxx.esp but when I do not know the ESP name? Say I have weapon X from mod abc.esp I want to save that weapons ID and ESP file name to a json to then be able to recover it via Getformfromfile
Tlam99 Posted March 27, 2022 Posted March 27, 2022 Create formlist with strings Getweapon eqipped id Read all mods in and check each entry until true
ihatemykite Posted March 27, 2022 Posted March 27, 2022 A better way might be to use xEDIT Pascal script. That allows you to check through all weapon forms from all mods you select. And then you can just save the ID to the file. Problem would be that saved file will most likely be just text, not JSON.
jbezorg Posted March 27, 2022 Posted March 27, 2022 1 hour ago, Nymra said: but when I do not know the ESP name? Say I have weapon X from mod abc.esp I want to save that weapons ID and ESP file name to a json to then be able to recover it via Getformfromfile I think this will work since the first 2 hexadecimal digits in the Form ID are the mod index. 0x1B0012B7 Int iFormId = myWhatever.GetFormID() Int iModIndex = Math.RightShift(iFormId, 24) ; e.g. 0x1B0012B7 becomes 0x1B or the decimal value of 27 String sFileName = Game.GetModName(iModIndex) ;Gets Name of Mod eg. Skyrim.esm, Update.esm, Hearthfire.esm, etc. https://www.creationkit.com/index.php?title=GetFormID_-_Form https://www.creationkit.com/index.php?title=RightShift_-_Math https://www.creationkit.com/index.php?title=GetModName_-_Game
jbezorg Posted March 27, 2022 Posted March 27, 2022 The following bitwise logical AND will mask off the index of a form id. Not really necessary with GetFormFromFile since the function does it internally. Int iItemMask = Math.LogicalAnd(iFormId, 0x00FFFFFF) So 0x1B0012B7 becomes 0x000012B7 and you can save "String sFileName" and "Int iItemMask" to the JSON file. https://www.creationkit.com/index.php?title=LogicalAnd_-_Math https://miniwebtool.com/bitwise-calculator/?data_type=16&number1=1B0012B7&number2=00FFFFFF&operator=AND https://miniwebtool.com/bitwise-calculator/bit-shift/?data_type=16&number=1B0012B7&place=24&operator=Shift+Right
Nymra Posted March 27, 2022 Author Posted March 27, 2022 22 minutes ago, jbezorg said: I think this will work since the first 2 hexadecimal digits in the Form ID are the mod index. 0x1B0012B7 Int iFormId = myWhatever.GetFormID() Int iModIndex = Math.RightShift(iFormId, 24) ; e.g. 0x1B0012B7 becomes 0x1B or the decimal value of 27 String sFileName = Game.GetModName(iModIndex) ;Gets Name of Mod eg. Skyrim.esm, Update.esm, Hearthfire.esm, etc. https://www.creationkit.com/index.php?title=GetFormID_-_Form https://www.creationkit.com/index.php?title=RightShift_-_Math https://www.creationkit.com/index.php?title=GetModName_-_Game aaaah, thx alot, this explains it for me. damnit, I searched the CK wiki and did not stumble over the GetModname o_O
jbezorg Posted March 27, 2022 Posted March 27, 2022 This will just save base IDs though. You'll have to take additional steps for player enchanted items if you're planning a "Save My Stuff" mod for Skyrim. This is a problem I ran into in Fallout 4 with player modded armor and weapons.
jbezorg Posted March 27, 2022 Posted March 27, 2022 14 minutes ago, Nymra said: damnit, I searched the CK wiki and did not stumble over the GetModname o_O The CK wiki search sucks. It's exact match and that's it. Not a substring match. I usually go to the scripting reference pages and use CTRL+F and try to find a function that way.
Nymra Posted March 27, 2022 Author Posted March 27, 2022 8 minutes ago, jbezorg said: This will just save base IDs though. You'll have to take additional steps for player enchanted items if you're planning a "Save My Stuff" mod for Skyrim. This is a problem I ran into in Fallout 4 with player modded armor and weapons. at least for me the enchantments are not an issue right now. base IDs are totally sufficient. I plan a "feature" that allows the player to summon a "mystic trader" that reequips a previously saved equipment sex in exchange for sex and money (and a random chance of some... scamming :D) basically I want to built a kinky based economy in skyrim that offers an alternative to classic looting/crafting mechanics. I personally also dont like looted armor. I spend alot of time to design my outfits and always want them back
jbezorg Posted March 27, 2022 Posted March 27, 2022 That and the one-size-fits-all-unisex outfits in Skyrim and Fallout 4. Conan the Nord looting a suit of bikini armor from a female woof elf and wearing it.
Nymra Posted March 27, 2022 Author Posted March 27, 2022 7 minutes ago, jbezorg said: That and the one-size-fits-all-unisex outfits in Skyrim and Fallout 4. Conan the Nord looting a suit of bikini armor from a female woof elf and wearing it. yeah, that too I fiddled around with almost any loot mod out there by now I think but they are either overintrusive or useless in a way. For my purpose ofc, kinky skyrim is some very special place, haha. But actually there was a mod somewhere that randomized the sizes of looted armor so you had to find suitable ones or suffer drawbacks or could not fit it at all. I dont remember the name tho.
Nymra Posted March 28, 2022 Author Posted March 28, 2022 12 hours ago, jbezorg said: If you find it again. let me know
jbezorg Posted March 29, 2022 Posted March 29, 2022 Thanks! Bookmarking that though I'm playing AE now.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.