egocarib / EnchantmentFramework

SKSE Plugin for Skyrim
6 stars 5 forks source link

Base Enchantment Detection #1

Closed egocarib closed 10 years ago

egocarib commented 10 years ago

I realized the current method I'm using to detect base enchantments won't work when the user combines more than one enchantment onto a weapon. The new created effect's MagicItem::EffectItem list won't match any existing base enchantment.

This isn't a huge deal, since it's only used for applying conditions to the new enchantment, not for any of the "important" bugfix stuff, but the conditionalizing won't work for multi-enchanted items until I come up with a new way of finding base enchantments.

This seems like it would require scaleform listening to the user's actual interaction with the menu itself (case-in-point: fire damage + soul trap Versus fiery soul trap), which is probably beyond the scope of this project (maybe for enchanting awakened, though, when I integrate this fix into it -- since I'm already going to be injecting a menu swf for other purposes in that project)

egocarib commented 10 years ago

See post 2 in issue #2 for a workaround

egocarib commented 10 years ago

Will also save this for a bigger update if I can figure out how to mess with the crafting UI (see #2, again)

egocarib commented 10 years ago

I should really solve this problem (most likely using the workaround referenced above).

I need to figure out how to do this for Enchanting Awakened anyway, if I want to implement learn capabilities for player-enchanted items with multiple enchantments combined on them.

egocarib commented 10 years ago

Have been working on this for a few days. Tested quite a few methods but nothing really worked very well. This data just evaporates into thin air internally, even hooking the CreateEnchantment function didn't work to detect things as I thought it would. Also tried injecting a new flash menu to track enchanting choices but that was a bit too sloppy for my tastes.

Now I've managed to decode TESTrackedStatsEvent and set up and event sink which can be used in conjunction with monitoring CreateEnchantment parameters to determine the base enchantments used. (CreateEnchantment is actually called by the game every time an enchantment is even selected in the menu, not just when it's finally crafted, which is why the Tracked Stats event is needed to correlate with when the item is actually created by the player).

It seems clear this new method will work now, I have to do some garbage collection on all the other attempts I've made over the past few days and then I'll start building out the new methods that can handle this issue.

egocarib commented 10 years ago

gibberish

code

debug log

/*

Each CostliestEffect event can push its enchantment to the CreateEnchantment hook class, which will add it to a vector or list

Then when the CreateEnchantment hook class has it's event, it will flip a bit to indicate that vector should be cleared and restarted the next time a push comes from CostliestEffect event.

When magicItemsMade is incremented, it grabs the current vector from CreateEnchantment hook class, which will be the exact order & number of base enchantments for the created enchantment at that time.

COUNTERPOINT:

CreateEnchantment event wont be recieved for armor enchantment which will fck this up. Need to either hook that or do something... (maybe... need to think about it some more) Could maybe just have magicItemsMade event clear the vector too, that way armor enchant would clear it too, and it would all be good....

but would be better to build the framework to work for armor enchants too in addition to weapon enchants...

*/

egocarib commented 10 years ago

Need to ensure I'm only listening for these events at the enchanting table.

egocarib commented 10 years ago

kid tested and approved!