Jump to content

Can you make 2 schematics unlock a recipe?


Recommended Posts

Probably a dumb question, and I've been unsuccessful at implementing this but is there some way to implement 2 schematics unlocking a recipe?

 

<property name="UnlockedBy" value="Schematic1,Schematic2"/>

 

To this observer, the comma in the property "UnlockedBy" seems to refer to more of an OR function as it traditionally has "schematic, perk".  Any thoughts?

 

If this is impossible, what is involved in creating a new schematic for a recipe and making sure it's distributed in the usual places (loot, traders, etc.)?  Thanks in advance.

Link to post
Share on other sites

Should work just fine. That line is just to show on the UI what an item is unlocked by. The schematic itself is what allows you to unlock the recipe to craft something.

 

And to get a new item into loot, it needs to be added to whatever loot groups you'd like it to be found in. Check out loot.xml and search for schematics. Same with traders.xml.

  • Thanks 1
Link to post
Share on other sites

It seems like it should work just fine, but it doesn't.  I made a whole new map from scratch after reboot (edit on an otherwise completely vanilla 7d2d client), and it is still stuck on the unlock options showing both schematics even though I've read them multiple times.  Verdict not unlockable by 2 schematics given the code listed above.  It may be possible, but not as it is currently written and I'm not sure how to rewrite it any other way.  I'll probably just make up a new schematic and try to fit it into loot crates, traders, zed drops, book cases, etc.

 

I'm still open for any other suggestions.

Edited by 00Prescott (see edit history)
Link to post
Share on other sites

My suggestion is to post your code. How can we spot mistakes if you don't show what you were doing?

 

In your first post you talk about the comma being used as an "or". But you never really say whether you want an "or" or an "and" mechanic. So what is it?

 

And a third point: If it is an "or" you want, you might want to take a look at the vehicle schematics in items.xml and how it makes it that all of them also unlock the "wheels" recipe.

 

  • Thanks 1
Link to post
Share on other sites

Hi meganoth, I thought I had listed the code in question, however if you want to see the entire modlet that I'm attempting to get working, it is GC_IronBunkerBusterCombined at https://www.nexusmods.com/7daystodie/mods/614.  They don't seem to be developing it anymore and I'm not entirely sure it ever worked.

 

As for clarifying what I'm requesting, I thought the title, "Can you make 2 schematics unlock a recipe?" and lines like, "... is there some way to implement 2 schematics unlocking a recipe?" and "not unlockable by 2 schematics given the code listed above" would communicate the idea, however language is not my strong suit so I do apologize for confusing language.  Both schematics should be read then the (edit)item(/edit) would be available for crafting.

 

That wheel schematic using a dummy item is something I'll try to remember going forward, great tip!  

 

<configs>
    <append xpath="item_modifiers">
        <item_modifier name="Iron Bunker Buster" installable_tags="melee" modifier_tags="damageStone" type="attachment">
            <property name="CustomIcon" value="modMeleeBunkerBuster"/> <property name="CustomIconTint" value="ffb0b0"/>
            <property name="UnlockedBy" value="modMeleeBunkerBusterSchematic,modMeleeIronBreakerSchematic"/>
            <property name="Stacknumber" value="1"/> <property name="Group" value="Mods"/>
            <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
            <effect_group tiered="false">
                <passive_effect name="DamageModifier" operation="perc_add" value=".15" tags="stone"/>
                <passive_effect name="DamageModifier" operation="perc_add" value=".15" tags="metal"/>
                <triggered_effect trigger="onSelfEquipStart" action="AddBuff" buff="buffHarvestXPBalance"/>
                <triggered_effect trigger="onSelfEquipStop" action="RemoveBuff" buff="buffHarvestXPBalance"/>
            </effect_group>
            <property name="PickupJournalEntry" value="augmentGunsTip"/>
        </item_modifier>
    </append>
</configs>

 

Edited by 00Prescott (see edit history)
Link to post
Share on other sites

I created a schematic for it (items.xml):

 

<configs>
    <append xpath="/items">
        <!-- Iron Bunker Buster Schematic -->
        <item name="modIronBunkerBusterSchematic">
            <property name="Extends" value="schematicMaster"/>
            <property name="CreativeMode" value="Player"/>
            <property name="CustomIcon" value="modMeleeBunkerBuster"/>
            <property name="CustomIconTint" value="ffb0b0"/>
            <property name="Unlocks" value="modIronBunkerBuster"/>
            <effect_group tiered="false">
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="modIronBunkerBuster" operation="set" value="1"/>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="GiveExp" exp="500"/>
            </effect_group>
        </item>
    </append>
</configs>

 

Then made that schematic unlock the item (item_modifiers.xml):

<property name="UnlockedBy" value="modIronBunkerBusterSchematic"/>

Added it to loot.xml

    <append xpath="lootcontainers/lootgroup[@name='schematicsModsAndGeneralT1']">
        <item name="modIronBunkerBusterSchematic" />
    </append>

And to traders.xml:

    <append xpath="/traders/trader_item_groups/trader_item_group[@name='rareBooks']">
        <item name="modIronBunkerBusterSchematic" />
    </append>

 

Maybe this will be useful for anyone else that wants to create items and or schematics.

Link to post
Share on other sites

Just FYI - the "UnlockedBy" property is only for the UI that tells the player what unlocks it. Meaning, if you don't know the recipe for some item, and click on that item, it shows you what will unlock it. That's why there are often two entries - the game wants to tell the player that the item's recipe can be unlocked by either a perk or a schematic.

 

But that's all it does. If you omit that "UnlockedBy" property altogether, then the schematic will still unlock the recipe.

 

What actually unlocks the recipe is the cvar. The name of the cvar is the name of the item. That's why you can't require two schematics to unlock the recipe for one item.

 

Also, in order for the recipe to be unlockable, it has to have the "learnable" tag. Otherwise the recipe is always available, it wouldn't require a schematic or perk to learn.

 

Hope that helps!

Edited by khzmusik
"schematics" not "recipes" - whoops (see edit history)
  • Like 1
Link to post
Share on other sites

Actually - I just looked in TFP code. I think it is possible to have one recipe unlocked by two schematics... but it's very complicated.

 

Basically, a learnable recipe is considered unlocked if it has a cvar matching its name, and that cvar's value is greater than zero.

 

So, what you could do, is set that cvar to -2 immediately when the player enters the game for the first time. Then, when you read a schematic, you add 1.5 to the cvar. The first schematic raises the value to -0.5 (so it's still not unlocked), and the next schematic raises it to 1 (which is now considered unlocked).

 

I used these values - and not -1, 1, etc. - because they're floats, and you want to avoid possible rounding errors.

 

It's just an idea. Feel free to experiment.

  • Like 1
  • Thanks 1
Link to post
Share on other sites
1 hour ago, khzmusik said:

Actually - I just looked in TFP code. I think it is possible to have one recipe unlocked by two schematics... but it's very complicated.

 

Basically, a learnable recipe is considered unlocked if it has a cvar matching its name, and that cvar's value is greater than zero.

 

So, what you could do, is set that cvar to -2 immediately when the player enters the game for the first time. Then, when you read a schematic, you add 1.5 to the cvar. The first schematic raises the value to -0.5 (so it's still not unlocked), and the next schematic raises it to 1 (which is now considered unlocked).

 

I used these values - and not -1, 1, etc. - because they're floats, and you want to avoid possible rounding errors.

 

It's just an idea. Feel free to experiment.

Man, I appreciate the effort on this and maybe some day I'll go back and look into it further, but something funky has happened to the iron breakers schematic (it's disappeared).  So, I'm putting out that fire.

Link to post
Share on other sites

If you want 2 unlocks required for 1 recipe you'll need 2 extra cvars but it's not very complicated or bulky.

 

Each unlock item sets 1 cvar but also unlocks the recipe... if both cvars are set after this.

Link to post
Share on other sites
  • 2 weeks later...

Perhaps another way to go about it is to have two (or more) "Schematic Remnants" be found in loot and together they are the components for a recipe to craft a single full schematic that unlocks the recipe you want.

 

So Iron Bunker Buster Remnant 1 and Iron Bunker Buster Remnant 2 can be crafted together to create Iron Bunker Buster Schematic which, when read, unlocks the recipe.

  • Like 1
  • Thanks 1
Link to post
Share on other sites
  • 3 weeks later...
<configs>
  <append xpath="/items/item[@name='modMeleeIronBreakerSchematic']/effect_group">
    <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="Iron Bunker Buster" operation="set" value="1">
      <requirement name="CVarCompare" cvar="modMeleeBunkerBuster" operation="GTE" value="1"/>
    </triggered_effect>
  </append>
  <append xpath="/items/item[@name='modMeleeBunkerBusterSchematic']/effect_group">
    <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="Iron Bunker Buster" operation="set" value="1">
      <requirement name="CVarCompare" cvar="modMeleeIronBreaker" operation="GTE" value="1"/>
    </triggered_effect>
  </append>
</configs>

I figured I'd try write and test the idea Gazz suggested, this seems to work. Based on the code I downloaded from GG2015's mod which seems to use a different name than then the recipe you posted.

 

I also noted you had an item called "Iron Bunker Buster" but your recipe unlocks an item called "modIronBunkerBuster".

By the way I don't think anyone would want to combine the mods, since having them installed as two separate mods gives you a bigger damage boost. But I guess if you have a lot of mods you want to install it could be interest. I can only think of 5 mods that are useful in pickaxes and the burning shaft is probably not needed by the time you find both of schematics because of helmet lights.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...