Jump to content

Miscellaneous item scrapping without making Junk


Recommended Posts

I've made a mod that adds a Toolbox to the Miscellaneous tab in the Pip-Boy. It's simply there for immersion's sake and does nothing on its own. The item is made by collecting the in game tools and taking them to the chem bench to combine them and some components into a Toolbox.

 

The problem I'm having is that I still would like to have the option to scrap this item in workshop mode and have the tools used to make the item return to my inventory, minus some of the components. I imagine this can be done with a script, but I am not sure how to do this. I don't want to add scrapping components to the item itself, because if I'm not mistaken, this would turn it into a Junk item, which defeats the purpose of the mod. I've tried using a form list, and keywords to accomplish this, but to no avail, but maybe I am missing something. Maybe items of this nature can't be scrapped by that method, or maybe I'm simply over looking something.

 

If anyone has the knowledge, or an idea, on how I can keep an item in the Miscellaneous tab in the Pip-Boy, but still have it scrappable in workshop mode, I would greatly appreciate the know how. If it comes down to making a script, I don't mind trying it out with the proper guidance. Thank you in advance.

Link to comment
Share on other sites

Take a look at this.

 

It would be a bit long to write everything here and the script (.psc file) contains all details.

 

In short, the script has a Struct and a While loop. The loop adds every item (Form) found in the Struct to the Player's inventory when the MiscItem is scrapped.

 

The Struct is editable: Open "DummyToolbox_MiscItem" >> Right click on "DummyToolboxObjRefScript" >> Click "Edit Value" >> Click "Add".

 

Under Struct Variables, click "Object" >> Edit Value >> Pick Object. Choose a MiscItem (in Papyrus, it's called "MiscObject") from the dropdown menu. (I've already added a Duct Tape and a Hammer).

 

Under Struct Variables, click "Object Count" >> Edit Value >> next to "Int Value", specify the amount of "Object". (Currently 1 Hammer and 2 Duct Tapes).

 

The MiscItem has a Constructible Object (DummyToolbox_CO) but its "Required Item List" is empty. If you add items to this list, they won't be added to the Player's inventory but they will be required for crafting.

Edited by LarannKiar
Link to comment
Share on other sites

Thank you so much, LarannKiar! I just checked this out a little while ago and it works like a charm. Exactly what I was looking for. I've been hacking away at the mod for a few days, and I came up with a bit of a work around, but what you've showed me is what I had envisioned. I simply don't have the scripting knowledge to pull it off. Thanks again!

 

The mod is nearly completed at this point, but, with your permission, I may go back and implement your script on the toolboxes in my mod. If I decide to publish, would it be okay to use this script giving credit where it's due? If you'd rather see it first, I understand, or if you'd rather not have your work on someone else's mod, I can understand that as well. Either way, I am grateful for your response and for showing me the script!

Link to comment
Share on other sites

Well, this mod has grown beyond just a toolbox, and my head is full of ideas for more. It all started with a screwdriver, and it is now something of a quirky little role-playing immersion enhancer, with an attempt to keep it simple and lightweight. Hopefully I don't go overboard with it. I can't seem to find a mod like it on the Nexus, or anywhere else I've checked, so I decided to spend the time making it for myself. I think I may publish it to save others from having to go through the tedium of making these objects, but I haven't fully decided just yet.

 

I've been trying my best on making the mod in a way that doesn't add an XP gain loop cheat... if that makes any sense. I may have to backtrack and change a couple of minor things if I implement your script, with your permission of course, but don't mind doing so. Anyway, I also wanted to say that I'm a fan of your mods, and appreciate your reply and sharing of knowledge. Thank you again, and kudos!

Link to comment
Share on other sites

The mod is nearly completed at this point, but, with your permission, I may go back and implement your script on the toolboxes in my mod. If I decide to publish, would it be okay to use this script giving credit where it's due? If you'd rather see it first, I understand, or if you'd rather not have your work on someone else's mod, I can understand that as well. Either way, I am grateful for your response and for showing me the script!

 

Sure, you can use that script. No need to credit me but if you do, that's also okay.

 

If you haven't uploaded mods yet, it's worth mentioning that regardless of permissions Nexusmods obligates all users to credit users whose assets are used in the mod (Edit Mod Page >> Permissions >> Credits) but I gave you permission so I don't mind if you don't credit me.

 

Well, this mod has grown beyond just a toolbox, and my head is full of ideas for more. It all started with a screwdriver, and it is now something of a quirky little role-playing immersion enhancer, with an attempt to keep it simple and lightweight. Hopefully I don't go overboard with it. I can't seem to find a mod like it on the Nexus, or anywhere else I've checked, so I decided to spend the time making it for myself. I think I may publish it to save others from having to go through the tedium of making these objects, but I haven't fully decided just yet.

 

I've been trying my best on making the mod in a way that doesn't add an XP gain loop cheat... if that makes any sense. I may have to backtrack and change a couple of minor things if I implement your script, with your permission of course, but don't mind doing so. Anyway, I also wanted to say that I'm a fan of your mods, and appreciate your reply and sharing of knowledge. Thank you again, and kudos!

 

Thanks and glad I could help. :smile:

Edited by LarannKiar
Link to comment
Share on other sites

Excellent! Not sure when it will be done, but should be soon. The mod keeps growing, but I'm about ready to put the breaks on it as I believe I've been thorough enough with it and how to implement it in game. This mod has given me an idea for another too. That's the way these things go I suppose, lol. When it's done, I'm pretty sure I'll post it, and I'll credit you for the script when I do. Thank you, thank you, and wonderfully good tidings to you :smile:!

Link to comment
Share on other sites

Trying to figure out how to use this script with the use of a Potion Item as opposed to scrapping. If I make these changes:

 

Struct ObjectsToGetBack
MiscObject Object

 

To:

 

Struct ObjectsToGetBack
Potion Object

 

And:

 

Event OnWorkshopObjectDestroyed(ObjectReference akActionRef)

 

To:

 

Event OnEffectStart(ObjectReference akActionRef)

 

Would that allow a Potion item to return a different Potion item as long as it's added to the scripts properties attached to the item? Ugh... that question reads like word salad even to me. Basically, what I'm trying to do is set up a Potion with multiple uses. I know I can just use the bottlecap collector script that's provided in the CK to simply return an item upon Potion use, after making a few changes to it. I suppose I could just use multiple bottlecap collector scripts to simulate a multi use item, but was hoping I could handle it with this script if it were possible, simply because this seems like a cleaner way of implementing such an item, and it would mean less scripts packaged with the mod. Thanks in advance for any response :smile:.

Link to comment
Share on other sites

Trying to figure out how to use this script with the use of a Potion Item as opposed to scrapping. If I make these changes:

 

Struct ObjectsToGetBack

MiscObject Object

 

To:

 

Struct ObjectsToGetBack

Potion Object

 

And:

 

Event OnWorkshopObjectDestroyed(ObjectReference akActionRef)

 

To:

 

Event OnEffectStart(ObjectReference akActionRef)

 

Would that allow a Potion item to return a different Potion item as long as it's added to the scripts properties attached to the item?

 

Yes, it can.

 

1. Create a Quest
2. Create a Reference Alias ("Ref Alias"). (Quest >> Quest Aliases tab, right click to add "New Reference Alias").
3. Specify Fill Type >> Unique Actor >> choose the Player from the dropdown menu.
4. Click OK, close the Ref Alias and the Quest windows and save you plugin.
5. Navigate back to your Ref Alias.
6. Under "Papyrus Scripts", click Add >> New Script. Name: MyMod_PotionScript. Extends: ReferenceAlias. Const: checked.
7. Paste this code then press Ctrl+S to save.

Scriptname MyMod_PotionScript extends ReferenceAlias Const

Struct ObjectsToGetBack
	Potion Object
	Int ObjectCount = 1
EndStruct

ObjectsToGetBack[] Property ObjectData Auto Const

Potion[] Property Potions Auto Const	
{Array of Potions.
If a Potion from this array is consumed ("equipped"), another Potion or Potions (specified in Struct >> ObjectsToGetBack) will be added to the Player's inventory.}


Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)		; event recieved when akBaseObject is "equipped". If it's a Potion, equipped means consumed.
	If akBaseObject as Potion						; if this Form is a Potion
		If Potions.Find(akBaseObject as Potion) >= 0			; if element index of akBaseObject >= 0, then akBaseObject is in the array (otherwise Array.Find would return -1).
			If ObjectData.Length > 0
				Actor PlayerRef = Game.GetPlayer()
				Int Index = 0
				While ObjectData.Length > Index
					Form LoopForm = ObjectData[Index].Object as Form
					Int LoopFormCount = ObjectData[Index].ObjectCount as Int
					PlayerRef.AddItem(LoopForm, LoopFormCount)
					Index = Index + 1
				EndWhile
			EndIf
		EndIf
	EndIf
EndEvent

 

 

 

(You can rename the script later in Creation Kit >> Gameplay tab >> Papyrus Script Manager. Type the name of this script in the searcb bar >> right click >> Rename).

 

I know I can just use the bottlecap collector script that's provided in the CK to simply return an item upon Potion use, after making a few changes to it.

 

What's the name of this script?

Edited by LarannKiar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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