Jump to content

[LE] Crafting scripts


Recommended Posts

So I'm sticking my nose back into modding a bit and this one's got me chasing my tail.

 

I'm trying to find if there's a script that I can hook onto when an item is crafted in order to fire some code. Whether it's specific to the crafting type (smithing, enchanting, etc) or not doesn't really matter, because I want to hook into all of them. I just can't find what actually creates the item to place into the player's inventory.

 

Anybody got an idea of what I should be looking for?

Link to comment
Share on other sites

Crafting is done by the game engine and not papyrus, as a result there is no scripting event that will catch specifically when an item is crafted.

 

Without SKSE you can run a script on a player alias that listens for the OnItemAdded event and checks if the parameter for the source container has an empty value. An empty value means that the item added did not come from a container. However, it would trigger anytime the player picks an item up off the ground and possibly whenever items are added by other means.

 

With SKSE you can take it a step further and check to see if the player has the crafting menu open. If the menu is open and the item did not come from a container then logic dictates that the item was crafted.

 

That is about the best that you can do to obtain when an item is crafted.

 

 

If you don't care about whether an item is crafted or not and just want some code to run when the player accesses a workstation, you can use the perk system to add a perk entry point which can either add an option to select when the station is accessed or replace the default behavior.

Link to comment
Share on other sites

Crafting is done by the game engine and not papyrus, as a result there is no scripting event that will catch specifically when an item is crafted.

 

Without SKSE you can run a script on a player alias that listens for the OnItemAdded event and checks if the parameter for the source container has an empty value. An empty value means that the item added did not come from a container. However, it would trigger anytime the player picks an item up off the ground and possibly whenever items are added by other means.

 

With SKSE you can take it a step further and check to see if the player has the crafting menu open. If the menu is open and the item did not come from a container then logic dictates that the item was crafted.

 

That is about the best that you can do to obtain when an item is crafted.

 

 

If you don't care about whether an item is crafted or not and just want some code to run when the player accesses a workstation, you can use the perk system to add a perk entry point which can either add an option to select when the station is accessed or replace the default behavior.

Hmmm, that would explain why I couldn't find it :laugh:. The SKSE option may do it, I haven't looked into SKSE yet for my own projects. It's probably worth considering now that SKSE64 has arrived in alpha.

 

Thanks for the assist. I may put this on ice for a bit until I get time to dig into SKSE a bit more.

Link to comment
Share on other sites

There's a Story Manager node for crafting. You should be able to hook into it to have it fire a quest that will then execute your code. This is how the blacksmith tutorial is triggered, for example.

The story manager event is bugged though. The quest event will cause the game to crash. This severely limits the usefulness of the node, though it might still be the best method depending on what exactly you are trying to accomplish.

Link to comment
Share on other sites

 

There's a Story Manager node for crafting. You should be able to hook into it to have it fire a quest that will then execute your code. This is how the blacksmith tutorial is triggered, for example.

The story manager event is bugged though. The quest event will cause the game to crash. This severely limits the usefulness of the node, though it might still be the best method depending on what exactly you are trying to accomplish.

 

 

Really? That sucks. What triggers it exactly, since it can't happen in all circumstances or the vanilla 'make me an iron dagger' quest wouldn't work and you wouldn't be saying it might have some use?

Link to comment
Share on other sites

It's the script event that is bugged, so you can start a quest and use conditions to limit when it gets started, you just have no way of passing that information to the quest script. Definitely not useless, but much less useful than it would be if that event was working.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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