DieSeegurke23 0 Posted November 9, 2023 I try to add Euro notes as loot to the zombies (In this case from Trader Plus Mod). This workes but there is a problem with the amount of notes that get added to the loot of the zombies. Sometimes it spawns 100 to 400 notes instat of 1 to 15 like i set in the quantmin (0.2% ~ 1 note) and quantmax (3% ~ 15 notes). Did someone already done this and can help me out to get this working? :) In example the 20 Euro note: Types.xml: <type name="TraderPlus_Money_Euro20"> <nominal>0</nominal> <lifetime>10800</lifetime> <restock>1800</restock> <min>1</min> <quantmin>0.2</quantmin> <quantmax>3.0</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> <category name="tools"/> <usage name="Military"/> </type> cfgrandompresets.xml: <cargo chance="0.30" name="MoneyLow_Custom"> <item name="TraderPlus_Money_Euro20" chance="0.20" /> </cargo> cfgspawnabletypes.xml: <type name="ZmbF_PoliceWomanNormal"> <cargo preset="toolsPolice" /> <cargo preset="toolsPolice" /> <cargo preset="ammoPolice" /> <cargo preset="MoneyLow_Custom" /> </type> Share this post Link to post Share on other sites
Sid Debian 132 Posted November 9, 2023 (edited) 1 hour ago, DieSeegurke23 said: I try to add Euro notes as loot to the zombies (In this case from Trader Plus Mod). This workes but there is a problem with the amount of notes that get added to the loot of the zombies. Sometimes it spawns 100 to 400 notes instat of 1 to 15 like i set in the quantmin (0.2% ~ 1 note) and quantmax (3% ~ 15 notes). Did someone already done this and can help me out to get this working? 🙂 In example the 20 Euro note: Types.xml: <type name="TraderPlus_Money_Euro20"> <nominal>0</nominal> <lifetime>10800</lifetime> <restock>1800</restock> <min>1</min> <quantmin>0.2</quantmin> <quantmax>3.0</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> <category name="tools"/> <usage name="Military"/> </type> cfgrandompresets.xml: <cargo chance="0.30" name="MoneyLow_Custom"> <item name="TraderPlus_Money_Euro20" chance="0.20" /> </cargo> cfgspawnabletypes.xml: <type name="ZmbF_PoliceWomanNormal"> <cargo preset="toolsPolice" /> <cargo preset="toolsPolice" /> <cargo preset="ammoPolice" /> <cargo preset="MoneyLow_Custom" /> </type> You are using wrong quantity values. If game can't get value of quality in Integer for item in types.xml it sets from 1 up to max quantity. How to solve your trouble: Inside of types.xml for 20 € change the quantity from: <quantmin>0.2</quantmin> <quantmax>3.0</quantmax> To: <quantmin>0</quantmin> <quantmax>1</quantmax> That would means that item would has quantity in range between 2 items in stack (40 €) up to 3 items in stack (60 €). How quantity works: Quantity value is range between 0% and 100%, for 20€ it's maybe maximum 400 items per stack. Now get some math: 2 * 100% / 400 = 0.5% O.5 is Double and not an Integer, it should be rounded to Integer so would be 1. Same for quantity max: 3 * 100% / 400 = 0.75% Rounded up to 1. Now checking how many would be that 1% in items: 400 * 1 / 100% = 4 ( * 20€ per one item) = 80€ total. Legend: Formula 1: 2 = items quan that we want; 400 = max items per stack. Formula 3: 400 = max items per stack; 1 = % from stack. Another way to solve is override with your mod amount of stack but it's another way. Edited November 9, 2023 by Sid Debian Share this post Link to post Share on other sites
DieSeegurke23 0 Posted November 10, 2023 On 11/9/2023 at 8:50 AM, Sid Debian said: You are using wrong quantity values. If game can't get value of quality in Integer for item in types.xml it sets from 1 up to max quantity. How to solve your trouble: Inside of types.xml for 20 € change the quantity from: <quantmin>0.2</quantmin> <quantmax>3.0</quantmax> To: <quantmin>0</quantmin> <quantmax>1</quantmax> That would means that item would has quantity in range between 2 items in stack (40 €) up to 3 items in stack (60 €). How quantity works: Quantity value is range between 0% and 100%, for 20€ it's maybe maximum 400 items per stack. Now get some math: 2 * 100% / 400 = 0.5% O.5 is Double and not an Integer, it should be rounded to Integer so would be 1. Same for quantity max: 3 * 100% / 400 = 0.75% Rounded up to 1. Now checking how many would be that 1% in items: 400 * 1 / 100% = 4 ( * 20€ per one item) = 80€ total. Legend: Formula 1: 2 = items quan that we want; 400 = max items per stack. Formula 3: 400 = max items per stack; 1 = % from stack. Another way to solve is override with your mod amount of stack but it's another way. Makes sense and seems to work, thanks. 🙂 Share this post Link to post Share on other sites
Sid Debian 132 Posted November 10, 2023 9 hours ago, DieSeegurke23 said: Makes sense and seems to work, thanks. 🙂 Fine. So wish you luck. Also those math stuff you may use for adjusting others items inside types.xml. Share this post Link to post Share on other sites