Jump to content

Is it possible to get the RefID of a player enchanted item?


Recommended Posts

I've been toying with my scripts for a growth weapon for a while and one bug is if the player enchants the item, the quest script (which handles stat changes) cannot find the item. The object script still functions because of GetSelf in the OnEquip and OnUnEquip blocks, but if I shift the stat manager code over to the object script and use GetSelf in a GameMode block, Oblivion CTDs once the script runs. I recently tried using Player.GetEquipmentSlot 16 as the RefID to update the stats when the Equip flag is set, but it didn't work (saw no changes ingame).

Link to comment
Share on other sites

Would OBSE's GetBaseObject work?

 

- Edit - Perhaps you may find some ideas or clues how from kuertee's Magicka-based enchantment limits ... I use it to create items with more than one enchantment (so you are enchanting an item that is already enchanted, without losing the original enchantment).

Edited by Striker879
Link to comment
Share on other sites

That is probably due to the weapon becoming a new unique dynamic ID/item (ffxxxxxx = stored in save game) once it gets enchanted.

 

GetEquipmentSlot is probably not the function you are looking for, it does something else than I think you want it to do. I think what you wanted is GetEquippedObject.

But GetEquippedObject wouldn't help you here anyway because it only returns the base object, which is probably useless if you want to modify the enchanted item (Due to how it changes mentioned above).

 

If you don't yet, use the TES CS Wiki to look up OBSE functions, many of them are explained there in more detail than on OBSEs Command Documentation page.

(Old links from OBSEs documentation page are broken, you need to search for the commands manually.)

 

Maybe you can move the stat manager code to the object script and not have it CTD if you try and adjust the stats/run the stat manager code within a while loop:

 

[...]

set ThisSword to GetSelf

 

[...]

 

while (ThisSword)
apply stat changes
loop

[...]

Edited by mixxa77
Link to comment
Share on other sites

GetEquippedObject and GetSelf (that doesn't CTD) don't work either, but glancing over kuertee's re-enchanting scripts... I need to approach this from a completely different angle. Kuertee gets the objectID while you're in the enchanting menu, while I was trying to get it either OnEquip or in GameMode. Storing the ID is also going to be a challenge... I think adding an .ini file to save the new ID to is a workable approach (since past attempts at storing IDs in globals didn't work out).

 

I think I'll release what I have after a few tweaks and get on to adding .ini support in V3.

 

 

 

Edit: A new relevant question: How do you get if the player chose "Create" on the enchantment menu? GetButtonPressed only returns values from MessageBox, which the enchant menu is not; GetActiveMenuSelection seems to update every half second, so I don't trust it to catch a player clicking quickly.

 

Edit II: Found OnEnchant event handler, got what I wanted working.

Edited by VencGanence
Link to comment
Share on other sites

  • Recently Browsing   0 members

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