Jump to content

Making a perk/ability that increases amount of crafted item?


Recommended Posts

If you want the player to get twice as much XP for crafting the items (or if XP isn't a concern), you can use the SKSE functions SetResultQuantity()

 

http://www.creationkit.com/index.php?title=SetResultQuantity_-_ConstructibleObject

 

There are some drawbacks to this method. The quantity will reset every time the player exits the game, so you'll have to have a maintenance script that fires every time the game starts. And of course you will require SKSE.

 

Another method is to use OnSit or some other method to detect when the player is using your workbench

 

http://www.creationkit.com/index.php?title=OnSit_-_Actor

 

Then you can assume that as long as the player is using the workbench, any items that are added to their inventory are probably items they crafted (especially if you have exclusive control of what appears in this crafting list). Then you can simply add a second copy of the item.

 

Finally a third option is to use the Story Manager. However the function that you would need has a note on the wiki that says it crashes the game:

 

http://www.creationkit.com/index.php?title=OnStoryCraftItem_-_Quest

 

However, I have found erroneous information on the wiki often enough before that I would recommend testing that yourself if this method appeals.

Edited by lofgren
Link to comment
Share on other sites

I already have both a maintenance script and a function to detect when the player receives an item while crafting, so I could use either of those.

But there are different downsides to either method, and I'm not sure which is the best

 

The pros of SetResultQuantity() is that it will (if I understand it correctly) show the quantity before you craft the item.

Downsides is that I don't want the extra XP, plus that I would need to directly reference every recipe in the script.

 

The pros of detecting new items in the player's inventory while crafting is that recipes don't need to be specifically referenced, so it's more versatile and less work when adding new recipes.

The downside is that it doesn't show extra quantities beforehand.

This is the method I'm leaning towards, but the biggest problem is that different recipes should give different amount of items (between 1 to 5 extra). These recipes all have one certain ingredient in common depending on how many extra items they should produce, so if I can just check the ingredients used I can give the correct amount of items. But I don't know how I can reference the recipe used (without creating properties) to create the item when just detecting an item appearing in the inventory.

 

 

(Edit: I'm too sceptical about using the potentially crashing option)

Edited by Mornedil
Link to comment
Share on other sites

Well just as any item added to the inventory was likely crafted when the player is sitting in a crafting station, any item removed from the inventory was likely used as an ingredient.

 

With regard to the SKSE method, you can create a formlist of the recipes and then iterate through it to double the output of all of the items in the list. That way you only have to reference the formlist in the script and you can modify it on the fly through scripts.

 

You can use a perk with the modify skill use entry point to halve the experience gained. Refer to any of the rested or standing stone perks for examples.

Edited by lofgren
Link to comment
Share on other sites

Could you not... Create a duplicate recipe that provides twice the result and have it conditioned to only appear when the player has the perk. While the first recipe is conditioned to disappear when the player has the perk? At the same time use the perk entry point method that lofgren suggested to halve the experience gained.

 

End result should be the same without all the extra scripting.

Link to comment
Share on other sites

Well just as any item added to the inventory was likely crafted when the player is sitting in a crafting station, any item removed from the inventory was likely used as an ingredient.

 

With regard to the SKSE method, you can create a formlist of the recipes and then iterate through it to double the output of all of the items in the list. That way you only have to reference the formlist in the script and you can modify it on the fly through scripts.

 

You can use a perk with the modify skill use entry point to halve the experience gained. Refer to any of the rested or standing stone perks for examples.

 

Thank you, creating form lists was a great idea. I made 5 different lists, and added the recipes to those lists depending on how many extra items they should receive. And then it was as simple as looping through those lists and changing quantities depending on whether the player has the right perks.

Could you not... Create a duplicate recipe that provides twice the result and have it conditioned to only appear when the player has the perk. While the first recipe is conditioned to disappear when the player has the perk? At the same time use the perk entry point method that lofgren suggested to halve the experience gained.

 

End result should be the same without all the extra scripting.

 

Thank you, but in my case that would take hours (or days) of extra work. I have 68 recipes that can gain between 1 and 5 extra quantity depending on 5 different perk ranks. So I would need hundreds of extra recipes for that.

But 25 lines of code solved it and won't need to be edited further as I add more recipes :>

 

 

The only Question left is the XP. Is there a way to set the "Use Skill" of the furniture without actually rewarding XP?

I currently have it set to "None" and handling the XP myself when the items are added to the player's inventory (which works fine). The only problem with this is that there is no skill progress bar in the lower right corner while crafting.

But by setting "Use Skill" to "Enchanting", the player gets around 10 levels when crafting items with only 1 quantity. So I really need to handle the XP myself, but still want to show the skill progress bar in the crafting menu.

Edited by Mornedil
Link to comment
Share on other sites

Your items might be too expensive, afaik xp gain is based on item value. So even if you handle xp gain separately the items crafted might be unbalanced, right?

Also, I think there is a perk entry to modify skill usage, it could be activated when crafting your items and adjust xp gain to a reasonable level.

Edited by FrankFamily
Link to comment
Share on other sites

Your items might be too expensive, afaik xp gain is based on item value. So even if you handle xp gain separately the items crafted might be unbalanced, right?

Also, I think there is a perk entry to modify skill usage, it could be activated when crafting your items and adjust xp gain to a reasonable level.

 

That's the weird part, the values of the items have been balanced. They're worth 25, 50, 100, 200, and 400 respectively depending on the level of the created item. even the 25g recipes jump enchantment level from 15 to 50 after one created item if I'm allowing the game to automatically award XP.

 

Thanks for the tip! I'll look into that modify skill usage perk entry, if it multiplies awarded XP then maybe I can set it to 0 while the player is crafting!

 

Edit: Hmm, that didn't work out well, multiplying skill use by 0 also disabled XP awarded manually with the AdvanceSkill() function.

I figured maybe I could multiply it by 0.01 and manually award 100 times more XP to make up for it, but even at a 0.01 multiplier the auto awarded XP has too much impact. And somehow floats in the entry point has a 2 decimal limit, so can't set it to 0.0001

Edited by Mornedil
Link to comment
Share on other sites

  • Recently Browsing   0 members

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