Jump to content

how to place modded items in vanilla-type loot?


fireidar

Recommended Posts

Hi guys I have a question I was asking for help on. I have two modded folders with MULTIPLE fruit\vegetable\nuts in. It one folder (the one with the most) has it that you can punch grass to loot them, the other is random loot you can pick up. HOWEVER even though punching grass is CONVENIENT, I think it's stupid, since the game has produce baskets, the sort you'd get in any supermarket, a place you'd EXPECT to get such things from. I looked through the files and found that the lootgroup 'shamway produce' is what determines the things going inside (rotten flesh, seeds, wood and polymers). I want to change this into the fruits and vegetables from the mods (the nuts can stay on the grass), but don't want to touch the vanilla files-me editing vanilla files, no matter HOW accurate never seems to work. I have another mod (lootable shelves, bookshelves, cabinets and more) that allows more looting options and HAS those baskets, but it keeps to the vanilla, only using the vanilla file. So to make any difference I'd have to add some sort of loot override for the baskets? copy the 'shamway produce' and just delete the current items and put the new in and place in the loot of another\lootable shelves file of a mod? Any ideas?

Link to comment
Share on other sites

Since you don't want to touch the vanilla files (which is a good idea), I assume you want to use XPath in your own modlet - either the one you have now, or a new one.

 

There are two solutions you could use:

  1. Insert the items from the other mod, into the vanilla "shamwayProduce" loot list.
  2. Change the vanilla produce basket blocks (the ones that start with "cntStoreProduceBasket") so they use a different loot group - either from the other mod, or from your own.

I would personally go with the first option since it's easier. (But there are some limitations - see below.)

 

Let's say the other mod had items named "foodApple", "foodGourd", "foodLettuce", and "foodMelon". Here's how you would add it to the existing, vanilla loot list.

 

<!-- loot.xml -->
<append xpath="//lootgroup[@name='groupShamwayProduce01']">
    <!-- Use whatever counts and probability templates you think are reasonable -->
    <item name="foodApple" count="2,4" loot_prob_template="low" />
    <item name="foodGourd" count="2,4" loot_prob_template="low" />
    <item name="foodLettuce" count="2,4" loot_prob_template="low" />
    <item name="foodMelon" count="2,4" loot_prob_template="low" />
</append>

 

But, remember that I said there were some limitations. And from the foods I chose, you can probably guess what it is.

 

In vanilla, all the produce baskets use the same loot group - even though they ostensibly contained different kinds of produce. So if you want to put the other mod's foods into only some kinds of produce basket, then you're out of luck with this solution.

 

If that doesn't bother you, then you should probably use this solution, since it's easier.

 

If it's not what you want, you would have to go with the second solution. But instead of assigning each basket to the same loot group, you would create different loot groups for each kind of produce basket.

 

<!--
    in loot.xml
-->

<!-- Loot groups -->
<insertAfter xpath="//lootgroup[last()]">
    <lootgroup name="groupProduceBasketApples" count="all">
        <!-- Include the vanilla produce basket group -->
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodApple" count="2,4" loot_prob_template="low" />
    </lootgroup>
    <lootgroup name="groupProduceBasketGourds" count="all">
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodGourd" count="2,4" loot_prob_template="low" />
    </lootgroup>
    <lootgroup name="groupProduceBasketLettuce" count="all">
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodLettuce" count="2,4" loot_prob_template="low" />
    </lootgroup>
    <lootgroup name="groupProduceBasketMelons" count="all">
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodMelon" count="2,4" loot_prob_template="low" />
    </lootgroup>
</insertAfter>

<!--
    Loot containers - starting at ID 271 to not conflict with vanilla
    (but as long as they don't conflict it doesn't matter, they're not used)
-->
<insertAfter xpath="//lootcontainer[last()]">
    <!-- cntStoreProduceBasketApples -->
    <lootcontainer id="271" name="produceBasketApples" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketApples" />
    </lootcontainer>
    <!-- cntStoreProduceBasketGourds -->
    <lootcontainer id="272" name="produceBasketGourds" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketGourds" />
    </lootcontainer>
    <!-- cntStoreProduceBasketLettuce -->
    <lootcontainer id="273" name="produceBasketLettuce" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketLettuce" />
    </lootcontainer>
    <!-- cntStoreProduceBasketMelons -->
    <lootcontainer id="274" name="produceBasketMelons" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketMelons" />
    </lootcontainer>
</insertAfter>

<!--
    In blocks.xml
-->
<set xpath="//block[contains(@name, 'cntStoreProduceBasketApples')]/property[@name='LootList']/@value">produceBasketApples</set>
<set xpath="//block[contains(@name, 'cntStoreProduceBasketGourds')]/property[@name='LootList']/@value">produceBasketGourds</set>
<set xpath="//block[contains(@name, 'cntStoreProduceBasketLettuce')]/property[@name='LootList']/@value">produceBasketLettuce</set>
<set xpath="//block[contains(@name, 'cntStoreProduceBasketMelons')]/property[@name='LootList']/@value">produceBasketMelons</set>

 

That should be enough to get you going, I hope.

Link to comment
Share on other sites

  • 2 weeks later...
On 3/20/2023 at 9:44 AM, khzmusik said:

Since you don't want to touch the vanilla files (which is a good idea), I assume you want to use XPath in your own modlet - either the one you have now, or a new one.

 

There are two solutions you could use:

  1. Insert the items from the other mod, into the vanilla "shamwayProduce" loot list.
  2. Change the vanilla produce basket blocks (the ones that start with "cntStoreProduceBasket") so they use a different loot group - either from the other mod, or from your own.

I would personally go with the first option since it's easier. (But there are some limitations - see below.)

 

Let's say the other mod had items named "foodApple", "foodGourd", "foodLettuce", and "foodMelon". Here's how you would add it to the existing, vanilla loot list.

 

<!-- loot.xml -->
<append xpath="//lootgroup[@name='groupShamwayProduce01']">
    <!-- Use whatever counts and probability templates you think are reasonable -->
    <item name="foodApple" count="2,4" loot_prob_template="low" />
    <item name="foodGourd" count="2,4" loot_prob_template="low" />
    <item name="foodLettuce" count="2,4" loot_prob_template="low" />
    <item name="foodMelon" count="2,4" loot_prob_template="low" />
</append>

 

But, remember that I said there were some limitations. And from the foods I chose, you can probably guess what it is.

 

In vanilla, all the produce baskets use the same loot group - even though they ostensibly contained different kinds of produce. So if you want to put the other mod's foods into only some kinds of produce basket, then you're out of luck with this solution.

 

If that doesn't bother you, then you should probably use this solution, since it's easier.

 

If it's not what you want, you would have to go with the second solution. But instead of assigning each basket to the same loot group, you would create different loot groups for each kind of produce basket.

 

<!--
    in loot.xml
-->

<!-- Loot groups -->
<insertAfter xpath="//lootgroup[last()]">
    <lootgroup name="groupProduceBasketApples" count="all">
        <!-- Include the vanilla produce basket group -->
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodApple" count="2,4" loot_prob_template="low" />
    </lootgroup>
    <lootgroup name="groupProduceBasketGourds" count="all">
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodGourd" count="2,4" loot_prob_template="low" />
    </lootgroup>
    <lootgroup name="groupProduceBasketLettuce" count="all">
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodLettuce" count="2,4" loot_prob_template="low" />
    </lootgroup>
    <lootgroup name="groupProduceBasketMelons" count="all">
        <item group="groupShamwayProduce01" loot_prob_template="high" />
        <item name="foodMelon" count="2,4" loot_prob_template="low" />
    </lootgroup>
</insertAfter>

<!--
    Loot containers - starting at ID 271 to not conflict with vanilla
    (but as long as they don't conflict it doesn't matter, they're not used)
-->
<insertAfter xpath="//lootcontainer[last()]">
    <!-- cntStoreProduceBasketApples -->
    <lootcontainer id="271" name="produceBasketApples" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketApples" />
    </lootcontainer>
    <!-- cntStoreProduceBasketGourds -->
    <lootcontainer id="272" name="produceBasketGourds" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketGourds" />
    </lootcontainer>
    <!-- cntStoreProduceBasketLettuce -->
    <lootcontainer id="273" name="produceBasketLettuce" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketLettuce" />
    </lootcontainer>
    <!-- cntStoreProduceBasketMelons -->
    <lootcontainer id="274" name="produceBasketMelons" count="1" size="6,2" sound_open="UseActions/open_shopping_basket" sound_close="UseActions/close_shopping_basket" loot_quality_template="qualBaseTemplate">
        <item group="groupProduceBasketMelons" />
    </lootcontainer>
</insertAfter>

<!--
    In blocks.xml
-->
<set xpath="//block[contains(@name, 'cntStoreProduceBasketApples')]/property[@name='LootList']/@value">produceBasketApples</set>
<set xpath="//block[contains(@name, 'cntStoreProduceBasketGourds')]/property[@name='LootList']/@value">produceBasketGourds</set>
<set xpath="//block[contains(@name, 'cntStoreProduceBasketLettuce')]/property[@name='LootList']/@value">produceBasketLettuce</set>
<set xpath="//block[contains(@name, 'cntStoreProduceBasketMelons')]/property[@name='LootList']/@value">produceBasketMelons</set>

 

That should be enough to get you going, I hope.

I saw the other ones, the apple and gourd ones, but couldn't figure a way to use them, so was ORIGINALLY thinking of the first way you suggested. HOWEVER I wanted to do the second. Thank you for your help in it, it really helped. I have been playing, trying to find Produce baskets but haven't found any yet so I can't say if it worked, but it was a help. The file I wanted to put it in (mod) wouldn't let me, and kept crashing, so I put it, quite reluctantly in the vanilla files and, for now, it seems to be working.

Link to comment
Share on other sites

What’s the load order of the various mods?  Adding new items to loot tables should not cause crashes if everything is ordered correctly.

 

The mods that add new items should load first, then create a modlet that loads last to add those new items to loot lists.  Note mods load in alphabetical order.

 

 So as an example:

 

Mod loads up new item say apple

Mod loads up new container say fruit basket

Modlet that adds apple to fruit basket container loot table

Edited by BFT2020 (see edit history)
Link to comment
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...