Jump to content

Script question


superl

Recommended Posts

I created a mod to remove enchantment, everything works fine but with one problem, I can't get rid of the glow left by the enchantment, the glow will only show when equip, it wont show if you drop it

 

here is my script

Scriptname _DS_DisenchantingScript extends ActiveMagicEffect 


event OnEffectStart(Actor akTarget, Actor akCaster)
    
    Target(akTarget)
    
    endEvent

Function Target(Actor actorRef, int handSlots = 2, int firstSlot = 30, int lastSlot = 61) global
    

    ; enleve enchantment main gauche.
    if handSlots >= 0 && WornObject.GetEnchantment(actorRef, 0, 0) != None
        WornObject.SetEnchantment(actorRef, 0, 0, None, 0)
        Weapon  sword = actorRef.GetEquippedObject(0) as Weapon
        
        ;float Tempered = WornObject.GetItemHealthPercent(actorRef, 0, 0)
        ;string Name = WornObject.GetDisplayName(actorRef, 0, 0)
        ;actorRef.RemoveItem(sword, 1)
        ;
        ;ObjectReference NewOne = actorRef.PlaceAtMe(sword)
        ; NewOne.SetItemHealthPercent(Tempered)
        ; NewOne.SetDisplayName(Name)
        ; actorRef.AddItem(NewOne)
        
        Debug.Notification("Enchantment removed from " + sword.GetName())
    endIf
    
    ; enleve enchantment main droite.
    if handSlots >= 1 && WornObject.GetEnchantment(actorRef, 1, 0) != None
        WornObject.SetEnchantment(actorRef, 1, 0, None, 0)
        Weapon sword = actorRef.GetEquippedObject(1) as Weapon
         
        ;float Tempered = WornObject.GetItemHealthPercent(actorRef, 0, 0)
        ;string Name = WornObject.GetDisplayName(actorRef, 0, 0)
        ;actorRef.RemoveItem(sword, 1)
        
        ;ObjectReference NewOne = actorRef.PlaceAtMe(sword)
        ; NewOne.SetItemHealthPercent(Tempered)
        ; NewOne.SetDisplayName(Name)
        ; actorRef.AddItem(NewOne)
        Debug.Notification("Enchantment removed from " + sword.GetName())
    endIf

    int index = firstSlot
    
    while index <= lastSlot ; check armure equiper.
        int slotMask = Armor.GetMaskForSlot(index)
        Armor armure = actorRef.GetWornForm(slotMask) as Armor
        
        if armure != None ; enchantment oui ou non.
            Enchantment ench = WornObject.GetEnchantment(actorRef, 0, slotMask)

            if ench != None ; enleve enchantment sur armure.
                WornObject.SetEnchantment(actorRef, 0, slotMask, None, 0)
                Debug.Notification("Enchantment removed from " + armure.GetName())
            endIf
        endIf
        
        index += 1
    endWhile
EndFunction

All the comment code in the handSlot is what I tried so far and does work at all, the glow still return and also rename with a double (fine) and do the same for all the same base weapon in the inventory.

 

Thank you for the help

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...