VencGanence Posted February 10, 2020 Share Posted February 10, 2020 I'm scripting a growth weapon and it will gain an enchantment at later levels. I see there's SetEnchantment in the OBSE functions, but nothing looks like a direct path to making a dynamic enchantment. Does anyone know how to dynamically make and/or adjust enchantments with scripts? Link to comment Share on other sites More sharing options...
mixxa77 Posted February 10, 2020 Share Posted February 10, 2020 (edited) Sounds very much possible. A good way would probably be creating an enchantment using the CSE and then using OBSE commands to add/remove effects to this enchantment and/or change their magnitudes.There's many functions for this under the Magic section of the OBSE commands, with functions like AddFullEffectItem, SetNthEffectItemMagnitude, etc.https://obse.silverlock.org/obse_command_doc.html That script would likely need to be always running, I don't think the scripted changes to the enchantment would be saved to the savegame, but the empty enchantment (which the script modifies) itself will be if it is created using the CSE, though it should be possible to create a new dynamic enchantment using OBSE itself, but that just sounds like unnecessary extra work. That you would need to test though, I'm not sure about that. Edited February 10, 2020 by mixxa77 Link to comment Share on other sites More sharing options...
VencGanence Posted February 12, 2020 Author Share Posted February 12, 2020 (edited) The functions aren't quite named what I thought they'd be, explaining why I only found SetEnchantment and RemoveEnchantment. They also don't appear to be all grouped together conveniently, but you've given me something to Ctrl+F for, which is far better than what I had before. The enchantment modifications not being saved is something I already worked around while modifying the base weapon's stats: I make the stats a function of the weapon's internal level, and set them accordingly on GetGameLoaded and level up. Edited February 12, 2020 by VencGanence Link to comment Share on other sites More sharing options...
VencGanence Posted February 13, 2020 Author Share Posted February 13, 2020 I've gotten around to adding the enchantment code to my script and you were spot on with what's needed. An empty enchantment in the CS, with auto-calc off.AddFullEffectItem [ench char code] [magnitude:int] [area:int] [duration:int] [0:self | 1:touch | 2:ranged] [enchantmentID]SetNthEffectItemMagnitude/Area/Duration/Range [int] [enchantmentID] [effect index, starting at 0]SetEnchantmentCost [int] [enchantmentID]SetObjectCharge [int] [objectID] This is to hopefully help others googling the same or similar problem. Link to comment Share on other sites More sharing options...
mixxa77 Posted February 13, 2020 Share Posted February 13, 2020 Glad to have helped. :smile: Link to comment Share on other sites More sharing options...
Recommended Posts