Jump to content

Enhance Shield


Elias555

Recommended Posts

I'm making an enhance shield spell, similar to the enhanced weapon archetype but I've run into some trouble.

 

This script applies the enchantment to the current equipped shield. It's in the magic effect.

Problems:

Doesn't re-equip the shield once the spell runs out.

Enchantment shader only plays while in an inventory or on the floor.

 

 

 

Scriptname _AceTestingScript extends ActiveMagicEffect

Enchantment Property MyEnchantment Auto

Armor EquippedShield
Armor BaseShield

Event OnEffectStart(Actor akCaster, Actor akTarget)

    WornObject.SetEnchantment(Game.GetPlayer(), 0, 0x00000200, MyEnchantment, 1000)
    BaseShield = Game.GetPlayer().GetEquippedShield()
    EquippedShield = Game.GetPlayer().GetEquippedShield()
    Game.GetPlayer().UnequipItemEX(EquippedShield, 2, False)

EndEvent



Event OnEffectFinish(Actor akCaster, Actor akTarget)

    Game.GetPlayer().RemoveItem(EquippedShield, 1, True)
    Armor ReplacementShield = Game.GetPlayer().Additem(BaseShield, 1, True)
    Game.GetPlayer().EquipItemEX(ReplacementShield, 2, False) ;NOT WORKING

EndEvent

 

 

 

This magic effect is responsible for removing the enhanced shield effect if the player decides to unequip the shield before the spell ends.

Problems:

Switching to a spell or dropping the weapon doesn't count as unequipping

It has a while loop.

 

 

 

Scriptname _AceTestingScript2 extends ActiveMagicEffect

Armor BaseShield

Event OnEffectStart(Actor akCaster, Actor akTarget)

    BaseShield = Game.GetPlayer().GetEquippedShield()
    Armor EquippedShield = Game.GetPlayer().GetEquippedShield()
    
    While Game.GetPlayer().GetEquippedShield() == EquippedShield

        Debug.Notification("shield is equipped")

        If Game.GetPlayer().GetEquippedShield() != EquippedShield

            Game.GetPlayer().RemoveItem(EquippedShield, 1)
            Game.GetPlayer().Additem(BaseShield, 1)

        EndIf

    EndWhile

EndEvent

 

 

 

I've been struggling with this for a while now and I'm willing to give my left nut for the solutions. ANY help is appreciated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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