icecreamassassin Posted January 18, 2016 Share Posted January 18, 2016 So I have the script which drains enchanted items and provides soul gems equivalent to the value drained. It works great other than one thing; every time I run the item it ALWAYS registers what the charge MAX is rather than the CURRENT change, and therefore when you run an empty relic back through it, it calculates the full amount again. The entire purpose of the GetAV RightItemChange function is to get the current charge level and NOT the max otherwise I would just be using the GetEnchantmentValue() function which would be much easier. Basically with this script I have to pass the item from a container to a handling NPC who the code is run on, the charge is adjusted and the gems placed in the container and the weapon is moved back into the container. So what the heck am I missing? The two debug lines show the total enchant value of 3000 and then after it's been reduced it shows as 0 like it should and the item I get back has a depleted charge, but if I put it back through it still registers as if it's fully charged. Scriptname DBM_SoulExtractorScript extends ObjectReference Explosion Property DLC1VampiresBaneExplosion Auto ObjectReference Property MyEffect Auto ObjectReference Property MyEffect2 Auto SoulGem Property SoulGemPettyFilled Auto SoulGem Property SoulGemLesserFilled Auto SoulGem Property SoulGemCommonFilled Auto SoulGem Property SoulGemGreaterFilled Auto SoulGem Property SoulGemGrandFilled Auto Actor Property RelicHolder Auto Int Soul Int GemCnt int SiphonNum Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() GetLinkedRef().BlockActivation(true) Weapon DEWeapon = GetLinkedRef().GetNthForm(0) as Weapon GetLinkedRef().RemoveItem(DEWeapon, akothercontainer = RelicHolder) RelicHolder.EquipItem(DEWeapon, false, true) Soul = RelicHolder.GetAv("RightItemCharge") as int Debug.notification("Soul level is" + Soul + " ") GemCNT = Soul / 250 if Soul < 250 RelicHolder.RemoveItem(DEWeapon, akOtherContainer = Game.GetPlayer()) Debug.notification("This weapon doesn't have enough charge") MyEffect.Disable(true) Self.Disable() Else MyEffect2.Enable(true) Self.Disable() SiphonNum = GemCNT * 250 Soul = Soul - SiphonNum RelicHolder.SetAv("RightItemCharge", Soul) Debug.notification("Soul level is" + Soul + " ") GetLinkedRef().AddItem(SoulGemPettyFilled, GemCNT) While GetLinkedRef().GetItemCount(SoulGemPettyFilled) >= 2 GetLinkedRef().Removeitem(SoulGemPettyFilled, 2) GetLinkedRef().Additem(SoulGemLesserFilled, 1) EndWhile While GetLinkedRef().GetItemCount(SoulGemLesserFilled) >= 2 GetLinkedRef().Removeitem(SoulGemLesserFilled, 2) GetLinkedRef().Additem(SoulGemCommonFilled, 1) EndWhile While GetLinkedRef().GetItemCount(SoulGemCommonFilled) >= 2 GetLinkedRef().Removeitem(SoulGemCommonFilled, 2) GetLinkedRef().Additem(SoulGemGreaterFilled, 1) EndWhile While GetLinkedRef().GetItemCount(SoulGemGreaterFilled) >= 3 GetLinkedRef().Removeitem(SoulGemGreaterFilled, 3) GetLinkedRef().Additem(SoulGemGrandFilled, 2) EndWhile RelicHolder.RemoveItem(DEWeapon, akOtherContainer = Self.GetLinkedRef()) Self.PlaceAtMe(DLC1VampiresBaneExplosion) MyEffect2.Disable(true) MyEffect.Disable(true) Endif GetLinkedRef().BlockActivation(false) Soul = 0 Endif EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts