• Mods are now organized as resources. Use the Mods link above to browse for or submit a mod, tool, or prefab.

    The TFP Official Modding Forum Policy establishes the rules and guidelines for mod creators and mod users.

Help: Is there any way to create multiple items from a single action or recipe?

shinnlly

Refugee
I'd like to make a modlet to take arrows apart and receive both the feather and arrow head.

I did not see any examples of this in recipes.xml, so I assume it is not possible there.

I know you get an empty jar when you drink a jar of water, so I tried adding multiple property name="Create_item" to the items.xml, but you only get the last one defined.

Thanks!

 
Workaround:

Loot Container: Iron Arrow Box

Recipe: Iron Arrow Box - 10 Iron Arrows

Loot Container properties for 'Iron Arrow Box' - Destroy on Close - Iron Arrow head QTY 10, Feathers QTY 10.

Use Arrows to craft box, place box, retrieve arrowheads and feathers.

Probably other ways to creatively work around it as well.

 
Last edited by a moderator:
Maybe make the arrows scrapable/craftable to the "ArrowHead" and make a repeating quest that's objective is to craft "Arrowhead". Then make the reward for the quest a feather and to start the same quest again.

This way every time your broke down an arrow you would get both the head and feather.

 
I believe the issue is a limitation of the Unity engine.
Please stop. If you have no idea how game engines work, what part is game engines code, what part is game logic coded by the developers of the game, then don't post your 'ideas', because what you just said is absolute nonsense and it's not nice to mislead people with disinformation.
You don't have to be game engine specialist to understand, that this isn't an issue of the game engine they are using, because many, many other games made in unity support that feature.

 
Last edited by a moderator:
To explain in a more friendly tone, the way recipes are handled internally by 7d2d is to load all ingredients into an ordered dictionary (a kind of list that remembers what order things are in, and each item has a name called the key, and a value) with the item or block as the key, and amount as the value. The output is the first thing added to the dictionary, so when it comes time to use the recipe, the code returns the first item as the output.

Codewise, changing this is pretty easy and there are many ways to do it. The simplest change would be to have the first item be 'numoutputs' = x (default 1), the next items being the output/s, then the rest of the ingredients. Internally, the data structure is exactly the same. The only change would be that when reading inputs numoutputs would be checked and that many items +1 skipped from the beginning of the list, and a similar thing would happen with the outputs.

The main problems would be: checking for space in inventory and what do you call the recipe?

Currently the recipe name is just ripped from the output item, and doesn't even include amount. A simple solution would be to make it 'firstitemname + next item name + etc'.

Hell, if someone could point me to a good tutorial on how to make .dll patches for SMX I could do it myself.

 
Last edited by a moderator:
Stop blaming game engine, it has nothing to do with game logic, that the fun pimps coded in. Bottom line is, that without serious C# rewriting of the recipe code, that the fun pimps wrote (not Unity creators), we can't have multiple outputs.

 
Subquake, stop....just Stop :)

This cannot be done without a major rewrite of the Unity code.

 
Last edited by a moderator:
Subquake, stop....just Stop :)
This cannot be done without a major rewrite of the Unity code.
Where is the basis of your assumption, that it's unity fault? You do realize, that blaming a game engine for game logic code, that wasn't written by the creators of the game engine is absurd?

Now if you are referring to C# code itself, that was used to write game logic, then you should have specified that. C# isn't unique to Unity, many other game engines support C# programming language and it's up to the game developers to develop game logic code and how they write game logic code is totally up to them, it has nothing to do with the game engines base code, how the game engine operates etc.

I actually have discussed possibilities to rewrite the recipe code with sphereii and TormentedEmu, in theory multiple recipe outputs are possible, but without serious changes for the recipe controller C# code, it's not going to happen any time soon. You can't blame Unity for that, that's just ignorance.

 
Last edited by a moderator:
Maybe I should be more clear. It's been stated more than once over the years that this wasn't possible with the way Unity works with the XML files. It's also been stated that it's not something they (TFP) care to focus on.

From a13...

So, MM, with the change on the UI and the workstations, isn't possible yet to recipes to output two (or more) different items? So, boiled meat and corn bread recipes, could also return an empty jar, for example?
It doesn't bother me that much, I'm just really curious, because I think you said that, once workstations were in, we could have recipes with more than 1 output...

Also, why the Corn Meal Recipe still uses 2 corns to make 2 Corn meals?

Before, it conflicted with the seeds recipe. But now that the grid it's gone, can't you make it 1x1?
You can't create two items from one recipe. I could fix the corn meal now yes.
From a16...

I could go farther back, but searching in the archive is a PITA.

 
It has nothing to do how unity reads XML files, it's how you process the read information. I deal with XML stuff every day at my job.

The fact, that TFP don't want to focus their efforts on overwriting recipe code doesn't mean it's impossible to implement. Yes it might be difficult, but not impossible and who knows, some day you might see that in Undead Legacy, because it's something I want to get into at some point, though not a major priority atm.

 
You can also do it with quests... technically.

Bit of a pain but I think it was done in valmod to take ammo apart.

Side note: We used to be able to take ammo apart and get all 3 things back in around A12 (possibly earlier), so it CAN be done.

 
Really quick, not guaranteed to work example of using the quest system on the stone arrow.

items.xml

Code:
<item name="ammoArrowStone">
<property name="DisplayType" value="ammoArrow"/>
<property name="Tags" value="ranged,perkArchery"/>
<property name="Meshfile" value="Items/Weapons/Ranged/Bows/WoodenBow/Arrow"/>
<property name="HoldType" value="45"/>
<property name="HandMeshfile" value="Items/Misc/sackPrefab"/>
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/>
<property name="IsSticky" value="true"/>
<property name="StickyOffset" value="0.5"/>
<property name="Material" value="Mwood"/>
<property name="Stacknumber" value="250"/> <!-- STK ammo -->
<property name="FuelValue" value="25"/>
<property name="EconomicValue" value="12"/>
<property name="EconomicBundleSize" value="5"/>
<property class="Action0">
	<property name="Class" value="Quest"/>
	<property name="QuestGiven" value="disassembleStoneArrow"/>
	<property name="Delay" value="0"/>
</property>
<property class="Action1">
	<property name="Class" value="Projectile"/>
	<property name="Explosion.ParticleIndex" value="0"/> <!-- no expl. -->
	<property name="FlyTime" value="0"/>
	<property name="Gravity" value="-4"/>
	<property name="LifeTime" value="12"/>
</property>
<property name="Group" value="Ammo/Weapons,Basics"/>
<property name="CraftingSkillGroup" value="craftSkillWeapons"/>

<effect_group name="Base Effects" tiered="false"> <!-- ammoArrowStone -->
	<passive_effect name="EntityDamage" operation="base_set" value="25"/>
	<passive_effect name="BlockDamage" operation="base_set" value="1"/>
	<passive_effect name="DamageModifier" operation="perc_set" value="0.1" tags="wood"/>
	<passive_effect name="DamageModifier" operation="perc_set" value="0" tags="earth,metal,cloth"/>
	<passive_effect name="ProjectileVelocity" operation="base_set" value="45"/>
	<passive_effect name="ProjectileStickChance" operation="perc_set" value="0" tags="glass"/>
</effect_group>
</item>
Quests.xml

Code:
	<quest id="disassembleStoneArrow">
	<property name="group_name_key" value="disassembleStoneArrow_group" />
	<property name="name_key" value="disassembleStoneArrow_name" />
	<property name="subtitle" value="Disassemble Stone Arrow" />
	<property name="subtitle_key" value="disassembleStoneArrow_subtitle" />
	<property name="description_key" value="disassembleStoneArrow_description" />
	<property name="icon" value="ui_game_symbol_archery" />
	<property name="category_key" value="quest" />
	<property name="difficulty" value="veryeasy" />
	<property name="offer_key" value="disassembleStoneArrow_offer" />
	<property name="shareable" value="false" />

	<reward type="Item" id="resourceRockSmall" value="1" />
	<reward type="Item" id="resourceWood" value="1" />
	<reward type="Item" id="resourceFeather" value="1" />
   </quest>
 
Maybe make the arrows scrapable/craftable to the "ArrowHead" and make a repeating quest that's objective is to craft "Arrowhead". Then make the reward for the quest a feather and to start the same quest again.
This way every time your broke down an arrow you would get both the head and feather.
Its like no one saw my post explaining this already lol

 
Who are you again? :D
He isn't anyone important, he just made some mod that no one plays (well, aside from the extremely large amount of people who actually love TrueSurvival including all the people who log into my private server to play it).

:cocksure:

 
Back
Top