kamenai Posted March 26, 2017 Share Posted March 26, 2017 Hello, Nexus! I'm trying to figure out something and I'm honestly stumped on how to do it. I'm not even exactly sure if what I'm trying to do is possible, so Google hasn't been very helpful. I created a portable tea kettle mod, and included an optional file for iNeed compatibility. The mod adds bottled water to the game, but I wanted players to have the option of using the water from their waterskins to brew tea as well. However, just simply adding the filled waterskin to the recipe destroys the entire waterskin in the process. What I would like to happen instead is when the player uses the waterskin to craft tea, they receive the beverage plus an empty waterskin. All the assets are in the mod (waterskins, tea, recipes, etc). I just don't know how to make it so the player receives an empty waterskin and the tea they crafted at the same time. Link to comment Share on other sites More sharing options...
Pickysaurus Posted March 26, 2017 Share Posted March 26, 2017 Hello, Nexus! I'm trying to figure out something and I'm honestly stumped on how to do it. I'm not even exactly sure if what I'm trying to do is possible, so Google hasn't been very helpful. I created a portable tea kettle mod, and included an optional file for iNeed compatibility. The mod adds bottled water to the game, but I wanted players to have the option of using the water from their waterskins to brew tea as well. However, just simply adding the filled waterskin to the recipe destroys the entire waterskin in the process. What I would like to happen instead is when the player uses the waterskin to craft tea, they receive the beverage plus an empty waterskin. All the assets are in the mod (waterskins, tea, recipes, etc). I just don't know how to make it so the player receives an empty waterskin and the tea they crafted at the same time. A bit of a wild guess, but maybe you could add a script so that when you 'Tea' gets added to the players inventory it also adds an empty waterskin? Would only really work if using the waterskin is the only way to craft it though... Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 26, 2017 Share Posted March 26, 2017 The recipe can only provide one item as a result. Therefore you have to do some scripting to add the extra item. If you can verify that the tea can only be added to the player inventory from crafting then you use the following script This would go on an alias for the player on a quest used to manage your mod. ScriptName SomePlayerAliasScript Extends ReferenceAlias ;define properties and variables - adjust as needed for your object types ; Potion Property MyTea Auto MiscObject Property MyEmptyWaterskin Auto Actor PlayerRef ;add an inventory event filter so that OnItemAdded is only triggered with the tea object and nothing else ;no need to process when not needed ; Event OnInit() PlayerRef = Game.GetPlayer() AddInventoryEventFilter(MyTea) EndEvent ;if the added item is of the correct type and is the tea AND has no source container ;then add an empty waterskin to the player inventory ; Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If akBaseItem as Potion == MyTea && !akSourceContainer PlayerRef.AddItem(MyEmptyWaterskin,1,true) EndIf EndEvent If using SKSE you can add an additional check to the IF statement && UI.IsMenuOpen("Crafting Menu") this would limit the adding of an empty waterskin to when the crafting menus are open. Thus helping to reduce potential times of erroneous adding of the empty waterskin. The other option is to have the recipe create a token item instead and use script to replace the token item with both the empty waterskin and the tea. The token Item can be set to be not playable and thus hidden from the player's inventory. You would have more control over ensuring that no empty waterskins are added by accident due to overlooking any scenarios where the tea could be added when not crafting. Link to comment Share on other sites More sharing options...
Recommended Posts