Jump to content

[LE] Enhance shield/armour


Elias555

Recommended Posts

Is there a way to use the enhance weapon magic effect but only apply it to shields/armour? If not, is there a workaround method of getting it done? I saw the SKSE function SetEnchantment but I think that's permanent. I guess I could listen for unequipping/moving containers but I'm hoping there's a better method.

 

Editing this post so you don't have to read the whole thread to get up to date. I'm making an enhance shield spell 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

 

 

Edited by Elias555
Link to comment
Share on other sites

I'm not sure about this but shouldn't it work directly? that magic effect archetype runs on self adding the enchantment to the weapons if they don't have any, correct? There's no difference between a self casted magic effect and an armor enchantment in that regard so I don't see why it wouldn't work.

 

If you want to make an armor piece add effects to melee weapons there's also the perk entry point apply combat something. I've used that in armor to add fire damage to weapons in addition of their enchantment.

https://www.creationkit.com/index.php?title=Perk_Entry_Point

Edited by FrankFamily
Link to comment
Share on other sites

Enhance weapon applies an enchantment to a weapon for the duration of the spell or until sheathed. My application will be for a shield and I want to have that same control, including the visual changes that comes with an enchantment.

 

I've used that in armor to add fire damage to weapons in addition of their enchantment.

https://www.creationkit.com/index.php?title=Perk_Entry_Point

That sounds interesting. How did you do that exactly?

Link to comment
Share on other sites

It's fairly straightforward. You have the constant magic effect that goes into the armor enchantment, around the top right of the magic effect window you can link a perk. The perk will be added while the effect is active.

 

In that perk you use the "Apply Combat Hit Spell" entry (adds effect to target when you succesfully hit him with a melee weapon and whatever conditions you have are met). Point it to a contact fire and forget magic effect with fire or whatever (edit: actually you point it to a spell containing said magic effect). Add condition that the armor piece is equipped to be safe in case it isn't properly removed, optionally add other conditions to make it more interesting like only on power attacking or sneaking, stuff like that. You can condition different perk entries (and therefore effects) to different directions of power attacks which is pretty cool but I can't recall the specifics of that.

 

I believe this has the potential to conflict with other perks using that entry point in that only one spell will be applied to the target in a hit, if all have a few conditions this shouldn't be a problem.

Edited by FrankFamily
Link to comment
Share on other sites

I tried this but it's not adding the enchantment to the shield.

Scriptname _AceTestingScript extends ActiveMagicEffect
  

Enchantment Property MyEnchantment Auto


Event OnEffectStart(Actor akCaster, Actor akTarget)

	Armor EquippedShield = Game.GetPlayer().GetEquippedShield()
	EquippedShield.SetEnchantment(MyEnchantment)

EndEvent

Wiki:

 

Sets the enchantment associated with this armor. Note refers to the base object, not an object reference.

Not sure what that means exactly.

 

Edit: It is adding the enchantment but not the visuals for some reason. I can see the visuals in the menu or when I drop the shield but not while equipped.

Edit2: The enchantment effect isn't working either, just the visuals when on the ground and in the inventory.

 

It's fairly straightforward. You have the constant magic effect that goes into the armor enchantment, around the top right of the magic effect window you can link a perk. The perk will be added while the effect is active.

 

In that perk you use the "Apply Combat Hit Spell" entry (adds effect to target when you succesfully hit him with a melee weapon and whatever conditions you have are met). Point it to a contact fire and forget magic effect with fire or whatever (edit: actually you point it to a spell containing said magic effect). Add condition that the armor piece is equipped to be safe in case it isn't properly removed, optionally add other conditions to make it more interesting like only on power attacking or sneaking, stuff like that. You can condition different perk entries (and therefore effects) to different directions of power attacks which is pretty cool but I can't recall the specifics of that.

 

I believe this has the potential to conflict with other perks using that entry point in that only one spell will be applied to the target in a hit, if all have a few conditions this shouldn't be a problem.

Thanks for that, it'll come in handy for something else.

Edited by Elias555
Link to comment
Share on other sites

Alright, I got the effect to apply but not visually. It applies to all shields with the same base object and I don't know how to make it only the object reference in the players hands. I also need a way to remove the enchantment if the player decides to drop the weapon. Anyway, one thing at a time. Visuals don't appear on the shield while it's equipped on the player but appears when in containers, inventory, on the floor.

Scriptname _AceTestingScript extends ActiveMagicEffect
  
Enchantment Property MyEnchantment Auto

Event OnEffectStart(Actor akCaster, Actor akTarget)

    Armor EquippedShield = Game.GetPlayer().GetEquippedShield()
    EquippedShield.SetEnchantment(MyEnchantment)
    Game.GetPlayer().UnequipItem(EquippedShield, False, True)
    Game.GetPlayer().EquipItem(EquippedShield, False, True)

EndEvent

Edit: I had thought of adding a check to make sure the player has the shield equipped but

 

GetEquipped condition does not work for items in the left hand.

 

I still don't get why the enchantment shader wouldn't work. It's the same shader I'm using for a weapon enchantment.

Edited by Elias555
Link to comment
Share on other sites

Shaders for weapon might be somewhat different? I'd try with a shader from an armor piece to make sure.

 

I don't think there's a function for setting enchantment on an object reference because obtaining the object reference will be a problem when the item is in inventory. They give a "XX form in YY container" or something like that, not an objref you can use.

 

You could however use the functions here in the wornobject script: https://www.creationkit.com/index.php?title=WornObject_Script

here is how the slot masks work: https://www.creationkit.com/index.php?title=Slot_Masks_-_Armor

Those should work on the specific item you have equipped and not the form, without required a proper reference to it.

Edited by FrankFamily
Link to comment
Share on other sites

Yeah, tried a different shader and the same thing, works in the inventory or on the ground but not when held.

I have no idea how to use SetEnchantment event without an example.

Event SetEnchantment(Actor akActor, Int handSlot, Int slotMask, Enchantment source, Float maxCharge)

    int kSlotMask39 ;shield
    akActor = Game.GetPlayer()
    slotMask = kSlotMask39

EndEvent
Link to comment
Share on other sites

It's function not event, I haven't used those functions but I guess you'd pass something like this:

 

SetEnchantment(Game.GetPlayer(), 0, 0x00000200, myenchantment, maxCharge)

 

or instead of the hexadecimal value accessing the property on the armor script, kslotmask39. I don't see why you couldn't just write the number as I did above though.

Link to comment
Share on other sites

I don't get it. SetEnchantment already exists and it functions here:

	Armor EquippedShield = Game.GetPlayer().GetEquippedShield()
	EquippedShield.SetEnchantment(MyEnchantment)

How can you have two functions with the same name? It compiles when I make it an event, but this doesn't:

Scriptname _AceTestingScript extends ActiveMagicEffect
  

Enchantment Property MyEnchantment Auto

Event OnEffectStart(Actor akCaster, Actor akTarget)

	SetEnchantment(Game.GetPlayer(), 0, 0x00000200, MyEnchantment)

EndEvent

Error: SetEnchantment is not a function or does not exist. I tried kSlotMask39 as well it and "variable kSlotMask39 is undefined".

Edited by Elias555
Link to comment
Share on other sites

  • Recently Browsing   0 members

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