Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

Yo!
Quick 2 questions:
1) How do I check if the player just enchanted something? (finished enchanting and got the item)
2) How do I check how many enchantments the player knows? - The ones that show up in the arcane enchanter (just how many, no need to know which ones)

 

Thanks!

Link to comment
Share on other sites

#1 gets messy and unreliable. However, in theory, with SKSE you can register for the crafting menu, set a toggle variable (bool if on same script, global variable if on separate scripts) when crafting menu is opened, reset the toggle variable when the crafting menu is closed. Then during the OnItemAdded event you can check if the toggle variable indicates that the crafting menu is open. Should crafting menu be open, somehow figure out how to use GetEnchantment.

 

Notes say that GetEnchantment only runs on items outside of a container. Player inventory is a container so you might have to drop the item to the ground or do some other manipulation first. No idea for sure, never used GetEnchantment.

 

But this would become unreliable because once the player learns how to temper enchanted items, those situations would be considered valid as well as using the enchanter. That said, you might be able to filter out tempering station usage by listening to the OnItemRemoved event and comparing exiting items against a formlist of known materials used in the tempering process. I.e. if an iron ingot was removed, most likely at the temper station rather than the enchanter.

 

Take all that with a grain of salt, it is all speculative untested theory...

Link to comment
Share on other sites

 

I actually saw this, but it's not very useful... it only shows if you know a specific enchantment...

 

 

#1 gets messy and unreliable. However, in theory, with SKSE you can register for the crafting menu, set a toggle variable (bool if on same script, global variable if on separate scripts) when crafting menu is opened, reset the toggle variable when the crafting menu is closed. Then during the OnItemAdded event you can check if the toggle variable indicates that the crafting menu is open. Should crafting menu be open, somehow figure out how to use GetEnchantment.

 

Notes say that GetEnchantment only runs on items outside of a container. Player inventory is a container so you might have to drop the item to the ground or do some other manipulation first. No idea for sure, never used GetEnchantment.

 

But this would become unreliable because once the player learns how to temper enchanted items, those situations would be considered valid as well as using the enchanter. That said, you might be able to filter out tempering station usage by listening to the OnItemRemoved event and comparing exiting items against a formlist of known materials used in the tempering process. I.e. if an iron ingot was removed, most likely at the temper station rather than the enchanter.

 

Take all that with a grain of salt, it is all speculative untested theory...

 

Thanks! This gave me an idea: register for the "Skill Increase" from the story manager or use the "OnStoryIncreaseSkill" event - whenever an item is enchanted, the enchanting skill is increased so I'll just have to check that (I know that skill increasing from books will also do this, but that doesn't matter for what I need it for).

 

 

What I really want to know is how to check the number of known enchantments - I don't even need to know what they are.

Is there a variable or list that holds the known enchantments in the save files or is it something that just can't be checked?

Link to comment
Share on other sites

 

 

I actually saw this, but it's not very useful... it only shows if you know a specific enchantment...

You can try FrankFamily's suggestion(or also an array), and call the formlist on that function. As it returns a bool, you can just count how many times it returned true.

 

There is no easy way to get what you want, you're gonna need to jump through hoops unfortunately.

Edited by Rasikko
Link to comment
Share on other sites

 

 

 

I actually saw this, but it's not very useful... it only shows if you know a specific enchantment...

You can try FrankFamily's suggestion(or also an array), and call the formlist on that function. As it returns a bool, you can just count how many times it returned true.

 

There is no easy way to get what you want, you're gonna need to jump through hoops unfortunately.

 

 

I thought about making a global variable that I just increase it by 1 whenever an item is disenchanted - but it causes some issues (in my mod, not in running).

I just want to know how to access the list/array/whatever that the game itself saves for the enchantments.

Is it possible or is it a lost cause and I should start thinking about other options?

Link to comment
Share on other sites

I'm trying to make an aimed spell only fire-able when the caster is effected by a blessing. I was hoping I could just add a spell condition of HasKeyword or HasMagicEffectKeyword and run it on the player but that doesn't work. I have a feeling it's only doable if a change the spell into a self targeting spell and have the real spell effect cast through a script. Thought I'd ask here first.

 

Edit:Forgot to mention that checking the swap target box doesn't work either.

Edited by Elias555
Link to comment
Share on other sites

Hello everyone. I have some trouble with the editor. Recently It has been crashing when I try to open "Response" window in dialogue. I can create it but cant open. The problem has come from somewhere. It affects exactly my plagin. Please help me fix it

Link to comment
Share on other sites

  • Recently Browsing   0 members

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