• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Can you Salvage for specific items?

Orphen

Refugee
I seen some old guides on a function like

<property name="ScrapItems" value="itemName,amount,minTier,maxTier"/>

It doesn't seem to do anything when I add a scrapitem list to a custom item. Is this deprecated or incorrect formatting? If so is there another way to accomplish getting specific items when salvaging a quality tiered item at each tier?

Thank You.
 
Items scrap according to their material. The amount of scrap is dictated by the weight of the item.
e.g.
<item name="smallEngine">
<property name="Material" value="MmechanicalParts"/>
<property name="Weight" value="200"/>
</item>
e.g.2 You cant scrap the crucible in vanilla but if I add the following code to the crucible:
<set xpath="/items/item[@name='toolForgeCrucible']/property[@name='Material']/@value">Msteel</set>
<append xpath="/items/item[@name='toolForgeCrucible']">
<property name="Weight" value="667"/>
</append>
Above I changed the material to Msteel and added a weight. You can now scrap the crucible. Changing the weight will change the amount of scrap to get back (it will scrap to resourceScrapIron). The weight is not one-to-one with the amount of scrap received so will probably need to fiddle and test to get what you want.
If you are looking to scrap to a specific resource (e.g. resourceScrapPolymers), check out an item that scraps to that resource already and determine the correct Material for your item.
For more examples check out the code for https://community.thefunpimps.com/resources/scrap-weapon-tool-vehicle-parts.61/
cheers
 
Edit: so it seems I cant edit a post once its been made.
Just to add that due to the above, and referring to tiered items such as sniper rifle etc. The system determines the amount of scrap according to the tier of the item. (RifleParts in the case of the sniper rifle)
cheers
 
Thank you for the reply, so there wouldn't be any way to make a custom item you can only get from salvaging another item? Wanted to add a material you can only get from salvaging a weapon at a specific tier. Guess it's not doable then.
 
If you can change your approach/algorithm/model to use Blocks instead of Items, you can most likely do it with Blocks as they are different than Items:
<drop event="Harvest" name="resourceForgedSteel" count="2,4"/>
<drop event="Destroy" name="resourceSpring" count="1,5" />
Both Harvest and Destroy allow an Item as a harvest or destruction output.
To map to tiers you could have different blocks that extend a base block.

Another thought is that you could craft the material using the weapon as a component - but you cant specify item tiers in recipes, and this is a hurdle for anything that varies according to tiers. (recipes, harvest, destroy etc)

You could also maybe simplify the process, e.g. use the recipe components for a tier 6 sniper rifle as the recipe components for the material. (which is effectively the same as creating a tier 6 sniper rifle and then scrapping it for the material.) This will reflect the tier requirement to get the material.

Sticking to the sniper rifle example, you could create 6 different individual sniper rifles with increasingly better attributes. The rifles dont have tiers and then use the workbench to break them down to the respective material using recipes. This removes the tier level problem, instead of one sniper rifle with 6 tiers you have sniper1, sniper2, .... sniper6.

I'm not overly sure of how you are implementing the approach so the above are just suggestions.
cheers
 
Last edited:
Thank you for the reply, so there wouldn't be any way to make a custom item you can only get from salvaging another item? Wanted to add a material you can only get from salvaging a weapon at a specific tier. Guess it's not doable then.

@JoeSloeMoe did an excellent job of explaining on what you can do through xml coding alone

Just want to clarify - if you mean tiers like AK/AR/M60, then yes you can as you just need to change or add the material property for the higher tier item in the items file. If you mean quality level (1-6), then you cannot do it outside of c# coding.
 
I was referring to quality tiers not gear tiers. I was trying to make all the weapon and armor recipes require you to have the previous tier weapons to make the next. But without expanding on the number of recipes. I figured out how to just change the actual ingredients of each tier, was just getting a unique salvageable from each tier that held me up. I'll come up with another approach I guess. Thank you.
Post automatically merged:

Oh wait, is it possible to make an item place as a block? Like making it so I can somehow place a piece of armor or weapon on the ground and harvest it instead of salvaging to use the method you mentioned above 🤔?
 
>Oh wait, is it possible to make an item place as a block? Like making it so I can somehow place a piece of armour or weapon on the ground and harvest it instead of salvaging to use the method you mentioned above 🤔?

Unfortunately each 'type' is independent of other types. In the xml there is no support for object multiple inheritance, so a block is a block and cannot be an item - an item is an item and cannot be an block. I once tried to define a gardening vest, where each vest modifier could be a stack of seeds or veg. I tried to get the seeds to be an item_modifier. Even ignoring the stacking problem, it was not feasible.

The way the code has been defined is very linear, coded for very specific purposes and doesn't exhibit interface flexibility. If we can cajole the code to do something other than the exact intention its by more luck and perseverance than anything else. (and even then it may get coded out in the next release - see quest:giveItem without a trader giving the quest as the latest example :cautious:). But I'm rambling a bit here, usually the best approach is to change the algorithm/data structures to suit the framework rather than forcing the framework to fit out expectations.

cheers
 
Back
Top