The_Dream Posted August 8, 2022 Share Posted August 8, 2022 Hello! I'm newbie to modding. I will be grateful for any advice. I edited some medical groups, but did`t get the desired result. If I understood correctly then propery <trader_items count="all"> is spawning each groups in trader list. And that <item group="rareMedicine" count="2"> means a two random items spawning from group="rareMedicine"? I have tried many variations but the result isn`t what I expected. Including complete replacement names group with medicine/rareMedicine and commenting on other groups who may including medicine or rareMedicine group. Who know whats need do?My randoms roll list: no any item from group="rareMedicine" bigger than 2 items from group="rareMedicine" (3-6 items) bigger than 5 different item and different/same items from group="medicine". My traders.xml: <trader_info id="2" full_reset="true" min_inventory="50" max_inventory="100" min_items_swapped="20" max_items_swapped="20" reset_interval="4" open_time="4:05" close_time="21:55"> <trader_items count="all"> <item group="rareMedicine" count="2" prob="1"/> <item group="medicine" count="5" prob="1"/> <item group="traderGeneral" count="4,8"/> <item group="generalResources" count="9,14"/> <item group="constructionSupplies" count="2,8"/> <item group="decorativeBlocks" count="2,7"/> <item group="tools" count="1,2"/> <item group="weaponsMeleeAll" count="1"/> <item group="weaponsGunsAll" count="1"/> <item group="weaponsGunParts" count="1"/> <item group="clothes" count="1,4"/> <item group="groupArmorLightMixed" count="1,2"/> <item group="groupArmorHeavyMixed" count="1,2"/> <item group="traderElectrical" count="1,2"/> <item group="modAllT1SecretStash" count="1,2"/> </trader_items> </trader_info> Goup lists: <trader_item_group name="rareMedicine" count="1"> <item name="medicalFirstAidKit"/> <item name="drugAntibiotics"/> <item name="drugFortBites"/> <item name="drugRecog"/> <item name="drugSteroids"/> <item name="drinkJarGrandpasMoonshine"/> <item name="drinkJarGrandpasAwesomeSauce"/> <item name="drinkJarGrandpasLearningElixir"/> </trader_item_group> <trader_item_group name="medicine" count="1"> <item name="medicalBloodBag" count="5"/> <item name="medicalFirstAidBandage" count="5"/> <item name="medicalBandage" count="5"/> <item name="medicalSplint" count="5"/> <item name="drugPainkillers" count="1"/> <item name="drugVitamins" count="1"/> <item name="medicalPlasterCast" count="1"/> <item name="medicalSewingKit" count="1"/> </trader_item_group> Link to comment Share on other sites More sharing options...
Gamida Posted August 9, 2022 Share Posted August 9, 2022 I have never edited the traders loot but am wondering if you started a new game when you made changes or if you played past the traders new loot respawn day. Link to comment Share on other sites More sharing options...
khzmusik Posted August 10, 2022 Share Posted August 10, 2022 On 8/8/2022 at 12:22 PM, The_Dream said: Hello! I'm newbie to modding. I will be grateful for any advice. I edited some medical groups, but did`t get the desired result. If I understood correctly then propery <trader_items count="all"> is spawning each groups in trader list. And that <item group="rareMedicine" count="2"> means a two random items spawning from group="rareMedicine"? I have tried many variations but the result isn`t what I expected. Including complete replacement names group with medicine/rareMedicine and commenting on other groups who may including medicine or rareMedicine group. Who know whats need do? Well, it's hard to know what's wrong when you say "did`t get the desired result" and "the result isn`t what I expected" - but you never say what you expect, vs. what actually happens. As far as I can tell, from looking in the C# code, this is how it works (I'm using XPath syntax, hopefully that's easier to understand): trader_items[@count="all"] seems to be ignored. The count is determined by the min_inventory and max_inventory values in the trader_info tag. The game simply picks a random entry from trader_items until a random number between min_inventory and max_inventory is reached. The prob attributes are taken into account, where no prob attribute translates to a probability of 1. (That doesn't mean "guaranteed," it means it has an equal "weight" against other entries with a probability of 1.) trader_items/item[@count="X"] will spawn X items from the matching trader_item_group. Note that the trader_item_group must come before the trader_items in the XML file. I think that trader_item_group[@count="Y"] will determine how many items are spawned for each X in trader_items/item[@count="X"]. I think that trader_item_group/item[@count="Z"] will determine how many items are spawned for each Y in trader_item_group[@count="Y"]. Every item entry in trader_item_group has a random chance to spawn whenever an item from that group is spawned - meaning there could easily be duplicates depending on RNG. I could easily be wrong about this, but that's how I interpret the code. What are you seeing that you aren't expecting? Link to comment Share on other sites More sharing options...
The_Dream Posted August 11, 2022 Author Share Posted August 11, 2022 On 8/9/2022 at 4:31 PM, Gamida said: I have never edited the traders loot but am wondering if you started a new game when you made changes or if you played past the traders new loot respawn day. I didn't start a new game. But all tests i checked in a new spawned trader (with help spawner) or reset a new assortment with admin commands (in trader menu). Link to comment Share on other sites More sharing options...
The_Dream Posted August 11, 2022 Author Share Posted August 11, 2022 (edited) On 8/10/2022 at 6:16 AM, khzmusik said: Well, it's hard to know what's wrong when you say "did`t get the desired result" and "the result isn`t what I expected" - but you never say what you expect, vs. what actually happens. I mean if I set Two items from my group="rare Medicine" I expect to receive two random item from this group. But i get (3-6 items or no any item). Or 5-items from my group="medicine" I expect to receive max 25-items (beacose in this group some items has multiply 5-items). But i get bigger items. (15-medicalBloodBag, 10-medicalBandage, and few item drugVitamins/drugPainkillers). Edited August 11, 2022 by The_Dream (see edit history) Link to comment Share on other sites More sharing options...
The_Dream Posted August 11, 2022 Author Share Posted August 11, 2022 (edited) On 8/10/2022 at 6:16 AM, khzmusik said: trader_items[@count="all"] seems to be ignored. The count is determined by the min_inventory and max_inventory values in the trader_info tag. The game simply picks a random entry from trader_items until a random number between min_inventory and max_inventory is reached. The prob attributes are taken into account, where no prob attribute translates to a probability of 1. (That doesn't mean "guaranteed," it means it has an equal "weight" against other entries with a probability of 1.) If this so then all becomes clearer. Each random spawn trader has random multiply count. This count depends from my values( min_inventory="50" max_inventory="100"). In one case it`s 55 but in another case this may is 95. Then according to probabilities in my group="rareMedicine" all items has similar chanse. And this make strage spaw items (no any item or 3-6 items). I assumed that somewhere there is a multiplier all items. But didn`t think if this values (min_inventory="50" max_inventory="100" ). It think need find optimal values from min_inventory and max_inventory. Thanks for explanations. Edited August 11, 2022 by The_Dream (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now