LootBags

LootBags

31M Downloads

random damage values mess up the weight (mc 1.7.10 lootbags 2.0.17)

brokenhappy opened this issue ยท 8 comments

commented

I disabled general loot and added a whitelist to add my own loot, and it worked fine,
after a while i found out on your amazing documentation page how i can add random damage values.
But once i inserted these, the weight of items were incorrect. (i got 95% of the armor pieces which had very large parameters for the metadata.

ps,
first post, inexperienced coder and not native english, still hope someone can help me ;)

here is what i did

`$STARTBAG:lootbagLegendary:4
$ISSECRET:false
$BAGTEXTCOLOR:$GOLD
$BAGTEXTUNOPENED:$AQUA:Ooh, what could be inside?
$BAGTEXTOPENED:What's inside is not as interesting as not knowing.
$BAGTEXTSHIFT:$DROPCHANCES
$WEIGHT:256000
$CRAFTEDFROM:lootbagEpic
$PASSIVESPAWNWEIGHT:5
$PLAYERSPAWNWEIGHT:254
$MOBSPAWNWEIGHT:10
$BOSSSPAWNWEIGHT:15
$USEGENERALLOOTSOURCES:false
$MAXIMUMITEMS:5
$MINIMUMITEMS:1
$MAXIMUMGENERALLOOTWEIGHT:5
$MINIMUMGENERALLOOTWEIGHT:-1
$PREVENTITEMREPEATS:item
$EXCLUDEENTITIES:false
$STARTWHITELIST
Techguns:grimreaper:0&2:1:1:1
Techguns:grenadelauncher:0&6:1:1:1
Techguns:chainsaw:0&150:1:1:4
Techguns:blasterRifle:0&50:1:1:1
Techguns:t3_combat_chestplate:1400&3250:1:1:1
Techguns:t3_combat_leggings:1400&3250:1:1:1
Techguns:t3_combat_boots:1400&3250:1:1:1
Techguns:t3_combat_helmet:1400&3250:1:1:1
Techguns:steam_chestplate:1200&2735:1:1:1
Techguns:steam_leggings:1200&2735:1:1:1
Techguns:steam_boots:1200&2735:1:1:1
Techguns:steam_helmet:1200&2735:1:1:1
Techguns:alienBlaster:0&10:1:1:1
Techguns:as50:0&10:1:1:2
Techguns:TechgunsAmmo:17:1:2:4
Techguns:TechgunsAmmo:19:1:4:6
Techguns:TechgunsAmmo:7:1:4:10
Techguns:TechgunsAmmo:15:1:1:5
Techguns:TechgunsAmmo:39:2:8:4
Techguns:TechgunsAmmo:23:1:1:4
Techguns:TechgunsAmmo:22:1:4:6

Techguns:nukelauncher:0:1:1:1
$ENDWHITELIST
$ENDBAG:lootbagLegendary`
pulls
here you can see my first 10 pulls, but from the piece of the config i should get about 3 times as many ammo types then each piece of armor

commented

i am in quite a hurry as i need this project done in 2 days, i don't mean to pressure anyone, but i'd like to know if it could be fixed easily, or if it needs some time, as i could stall this and try finding other ways, or dropping this feature

commented

So how the damage range works is it's a shortcut to add a large number of different entries that are identical except for damage values to the whitelist, so when you add in Techguns:chainsaw:0&150:1:1:4, you are adding 151 chainsaws with each damage value from 0 to 150 to the whitelist, each at a weight of 4, for a total of 604 of the bag weight dedicated to chainsaws of various damage values, compared to the ammo, which are of weights of 4-10. If you increase the ammo weight to account for this and exclude some of the damage values (for instance you could do Techguns:chainsaw:0#10#20#30#40#50#60#70#80#90#100#110#120#130#140#150:1:1:4 to trim the number of chainsaws down to 11 total). This would also help with loading times a bit if that has been a problem, the code works on a polynomial order, which is fine for smaller numbers of items (<500 or so), but starts to clog up when you start going over several thousand entries to process.

commented

first off, thanks for this very detailed and clear answer, I admire you for taking so much time, even for people like me.

I'd also like to ask you something a bit off topic, i use just another spawner mod too, which i use to spawn specific mobs in specific biomes, which i made into area's with different difficulties, but i cannot figure out a way to make specific mobs drop specific lootbags to create more difficult area's drop better lootbags. The only way i found is making mobs spawn as passive mobs and increase the weight on passive mobs, but this not only screws with the mob cap and has unwanted results, but it also only has 2 groups (passive and monster), which is too little for me

I hope i made clear what i mean with this, and i hope you can help

commented

Weights are integer values (no decimals), so 1 is the lowest value the mod accepts, since negative or 0 weight doesn't work for randomly pulling items out of a pool. Outside the minimum of 1 for any particular item and making sure the total weight of all items in the bag doesn't go over 2.147 billion and change (size of an integer), you can use any weight values. I just use the 1-40ish range as that is what the vanilla loot tables use. You could multiply the weights of ammo (along with anything else you're just using one damage value for) up so that things are more equal with the items with multiple damage values.

Pretty much anything related to the mod or using it can just be posted here.

commented

sorry for editing it completely, didnt know you would react this fast, but i figured how the weight worked, so i just edited my comment and asked anyways ^^

commented

Yes, there is a way to set up bags to only drop from certain creatures using the entity whitelist. Most of the secret bags in the default set do that, I'll use the Bat bag since it's the only one that looks for a creature type instead of just a name.
$EXCLUDEENTITIES:true
$STARTENTITYLIST
$VISIBLENAME:Batman
$INTERNALNAME:Bat
$ENDENTITYLIST
The important parts are setting $EXCLUDEENTITIES to true, so that the entity list functions as a whitelist instead of a blacklist, and getting the $INTERNALNAME correct. Visible name is what the entity is named, so a player or if you use a nametag on something. Usually the internal name is just the mob's name in english, although you'd want to check in the spawner mod's documentation to make certain, I've seen people do really odd things sometimes with internal registry names for things.
The entity list works just like any other whitelist, so it looks for any of the entries, letting you make the bags drop in the correct regions even if there are multiple different creatures. The bat bag in this case can drop from any bat or anything that's named Batman.

commented

thanks for helping, but i yet have issues figuring out how the entity list works
btw, the lan party is over, and i had to set priorities, so i didnt have time to go further into this at the time. (trying to explain why it took so long to react ^^)
but this is how i tried to do this, i set all the SPAWNWEIGHTS at 0 but MOBSPAWNWEIGHT, which was at 100 for common, uncommon, rare, epic and legendary, then i used the EXCLUDEENTITIES: true and used INTERNALNAME. i assumed all i needed was the names minecraft would give me if i were to press tab after typing /summon
image

in this list minecraft gave me, i could not find the mobs from the mod i needed, (it did show mobs from cofH), so i used the vanilla mobs instead.
is there a way to use Techguns:Outcast as an example? bacause i can summon the Techguns mobs with the /summon command
Also i multiplied the weighting resolution by 5
I:"1 Weighting Resolution"=5000
(which for as far as i know means it should be 50/50)
but when i tried this, none of the mobs dropped any bags at all (tried about 25)

here ill show you what i did
with the rare as example
and the pastebin's
lootbag_BagConfig.cfg
Lootbags.cfg
$STARTBAG:lootbagRare:2
$ISSECRET:false
$BAGTEXTCOLOR:$BLUE
$BAGTEXTUNOPENED:$AQUA:Ooh, what could be inside?
$BAGTEXTOPENED:What's inside is not as interesting as not knowing.
$BAGTEXTSHIFT:$DROPCHANCES
$WEIGHT:16000
$CRAFTEDFROM:lootbagUncommon
$PASSIVESPAWNWEIGHT:0
$PLAYERSPAWNWEIGHT:0
$MOBSPAWNWEIGHT:100
$BOSSSPAWNWEIGHT:0
$USEGENERALLOOTSOURCES:false
$MAXIMUMITEMS:5
$MINIMUMITEMS:1
$MAXIMUMGENERALLOOTWEIGHT:15
$MINIMUMGENERALLOOTWEIGHT:-1
$PREVENTITEMREPEATS:item
$EXCLUDEENTITIES:true
$STARTENTITYLIST
$INTERNALNAME:Skeleton
$INTERNALNAME:PigZombie
$INTERNALNAME:Villager
$ENDENTITYLIST
$STARTWHITELIST
Techguns:ak47:0#5#10#15#20#25#30:1:1:4
Techguns:thompson:0#5#10#15#20#:1:1:6
Techguns:m4:0#5#10#15#20#25#30:1:1:3
Techguns:powerHammer:0#25#50#75#100#125#150:1:1:3
Techguns:combatshotgun:0#2#4#6#8:1:1:6
Techguns:goldenrevolver:0#2#4#6:1:1:4
Techguns:t1_combat_leggings:700#750#800:1:1:6
Techguns:t1_combat_chestplate:700#750#800:1:1:6
Techguns:t1_combat_helmet:700#750#800:1:1:6
Techguns:t1_combat_boots:700#750#800:1:1:6
Techguns:TechgunsAmmo:7:1:5:135
Techguns:TechgunsAmmo:28:1:1:30
Techguns:TechgunsAmmo:5::1:1:60
Techguns:TechgunsAmmo:6:1:2:105
Techguns:TechgunsAmmo::1:2:4:135
Techguns:TechgunsAmmo:4:4:16:105
Techguns:TechgunsAmmo:12:1:1:45
Techguns:TechgunsAmmo:13:1:2:90
$ENDWHITELIST
$ENDBAG:lootbagRare

commented

The Weighting Resolution is used as a maximum random value for determining if a bag drops, the game rolls a random number up to the resolution, and if that number is less than the appropriate spawn weight for the bag, it'll drop the bag.
Your bag drop issues are caused by a couple things. First, you have a high Weighting Resolution (5000), which determines the maximum number that can be randomly determined, and a low spawn weight (100), which the random value has to be less than for the bag to drop (a 2% chance to drop). This itself isn't an issue, most of the packs that use my mod have values around that point for the common bags, but you're also trimming the entities that can drop the bag down to two, as Villagers are passive entities (there's not really a good way to learn what is passive or monster outside of digging in the code sadly, if you're using a entity whitelist it's usually easier to just set each of the spawn weights to the same value) and you're only allowing bags to drop from mobs.
As for getting a bag to drop off a specific mob, use the same text you used to summon it, so the outcast spawns with Techguns.Outcast.