Jump to content

Enchanting item with script disables script execution until item is dropped and picked up


MaxYari

Recommended Posts

Hello everyone, title pretty much says it all.

For the mod of mine i need to have a weapon with an attached script that will be enchantable. But as soon as you enchant it - script behaviour breaks and onEquip block apparently stops being called. It fixes itself if you drop the item and pick it up.

Is there anyway to "activate" that inventory item through code?

I haven't tried anything yet but was thinking of maybe dropping and picking it up through script if there's no proper way to do it, I'll update this topic if i'll have time to try and have some interesting results.

P.S.: I've brought this issue up here but since it wasn't closely related to main topic - I created a new one.

Have a good day everyone!

Link to comment
Share on other sites

Is there anyway to "activate" that inventory item through code?

I downloaded your mod and had a try. Yes, I have the same situation as well as you described it - the enchanted item some way 'forgets' about the script which was attached to it's base item. I can assume next if you'd ask my opinion:

In your AAEHquest's script - GetLastEnchantedItem-> if that item's base is your fist -> item.CopyIR Player ; item.RemoveMeIR

I tried to add "OnAdd" block to the AAFFistWeapon script and see what will happen in the moment right after the item was enchanted - same situation, the item's script was not initialized.

Link to comment
Share on other sites

 

Is there anyway to "activate" that inventory item through code?

I downloaded your mod and had a try. Yes, I have the same situation as well as you described it - the enchanted item some way 'forgets' about the script which was attached to it's base item. I can assume next if you'd ask my opinion:

In your AAEHquest's script - GetLastEnchantedItem-> if that item's base is your fist -> item.CopyIR Player ; item.RemoveMeIR

I tried to add "OnAdd" block to the AAFFistWeapon script and see what will happen in the moment right after the item was enchanted - same situation, the item's script was not initialized.

 

But i think GetLastEnchantedItem returns only enchantedItem and there's no way to get base from it? But i think i know the way to get both base and enchanted item, seems that it's possible to get base from the enchantment menu upon triggering onEnchant event, but i'm not sure if that'll work with sigil stones, would be better if there's some kind of more universal solution.

 

And thanks a lot for taking time and checking it, appreciate.

Edited by SinnerSmile
Link to comment
Share on other sites

But i think GetLastEnchantedItem returns only enchantedItem and there's no way to get base from it?

ref item . Right?) - right.

let item := GetLastEnchantedItem - that piece of code "sits" in the quest and awaits for when the Enchanting menu provides the item. Now item is that enchanted item. Next, let's check it:

if ( item.GetBaseObject == BaseOfYourFist )

item.CopyIR Player

item.RemoveMeIR

(or it might be that after this, there could be a two of items in the one reference, and after RemoveMeIR they both will be removed - in that case CopyIR to some container instead of as to the Player, RemoveMeIR, select the item in that container you copied previously to and CopyIR back to the Player)

endif

i'm not sure if that'll work with sigil stones

For the case of sigil stone enchanting, in the same quest's script you can place a check nearby after the above:

let item := GetLastSigilStoneCreatedItem

if ( item.GetBaseObject == BaseOfYourFist )

same actions

(the) endif

Edited by Stealth21
Link to comment
Share on other sites

 

But i think GetLastEnchantedItem returns only enchantedItem and there's no way to get base from it?

ref item . Right?) - right.

let item := GetLastEnchantedItem - that piece of code "sits" in the quest and awaits for when the Enchanting menu provides the item. Now item is that enchanted item. Next, let's check it:

if ( item.GetBaseObject == BaseOfYourFist )

item.CopyIR Player

item.RemoveMeIR

(or it might be that after this, there could be a two of items in the one reference, and after RemoveMeIR they both will be removed - in that case CopyIR to some container instead of as to the Player, RemoveMeIR, select the item in that container you copied previously to and CopyIR back to the Player)

endif

i'm not sure if that'll work with sigil stones

For the case of sigil stone enchanting, in the same quest's script you can place a check nearby after the above:

let item := GetLastSigilStoneCreatedItem

if ( item.GetBaseObject == BaseOfYourFist )

same actions

(the) endif

 

I haven't checked but i'm 95% sure that GetBaseObject will return a base that will not match any of my fists, from what i understand stuff created with enchantment is a cloned form, i.e it was cloned from my item but now it's completely different thing in it's own.

But approach seems to be solid nevertheless, i got an idea that i can check for the attached script as well, I hope it's actually present on an item although not activated.

Thanks :smile:

Edited by SinnerSmile
Link to comment
Share on other sites

  • Recently Browsing   0 members

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