#How to add %drop chance for mobs in my modpack?

36 messages · Page 1 of 1 (latest)

hollow kite
#

I'm looking to see how I can add a %drop chance for plushies in my modpack from it's correlating mob, like "1/1000 chance of creeper dropping a creeper plushie."

I'm understanding the basic of it but want to know if I'd need to make a script for each mob drop plushie, OR can I cram all the drops in one script. And how can one make such a script

vernal jettyBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

acoustic sentinelBOT
#

You sure you tried everything you possibly could to fix your issue? Perhaps not.

Make sure you have searched for issues similar to yours in #1047320998199955458 before posting. They might have the answer to your problem!

hollow kite
#

I've looked but seen nothing on how to make multipe actions such as I mentioned in a single script of very few scripts

marble crescent
#

You probably want to look into the LootJS addon. As long as you've tagged the relating entities correctly, it should work.

#

Unless the naming convention is super weird, it shouldn't be too hard.

hollow kite
#

Aka like write a scripte with for different drops for different entites in on lootjr file

#

Cause what I want to do will need well over a drop chance for each mob currently in the game

#

So idk if that's possible or not

marble crescent
#

I don't understand what you're asking.

hollow kite
#

So yk how one has to write a script like this

#

LootJS.modifiers((event) => {
event
.addLootTypeModifier(LootType.ENTITY) // or multiple LootType.BLOCK, LootType.ENTITY ...
.randomChance(0.3)
.addLoot("minecraft:gravel");
});

#

^this would go into 1 file for kubejs server script folder

#

But I need to write a script like this over 50+ times, so that means I'd have to have 50+ files in the server script folder

hollow kite
marble crescent
#

You can. The event is just an object you can call the functions multiple times on.

#
LootJS.modifiers(e => {
  e.addLootType(...)
      .randomChance(...)
      .addLoot()
  e.addLootType(...)
      .addLoot(...)
});

Though you should probably learn coding paradigms to do this efficiently.

hollow kite
#

Ahhh

#

Yeah I'm new to this all so it's a bit hard to learn where to get my info from lol

#

LootJS.modifiers((event) => {
event
.addLootTypeModifier(LootType.ENTITY) // or multiple LootType.BLOCK, LootType.ENTITY ...
.randomChance(0.3)
.addLoot("minecraft:gravel");
.addLootTypeModifier(LootType.ENTITY) // or multiple LootType.BLOCK, LootType.ENTITY ...
.randomChance(0.3)
.addLoot("minecraft:gravel");
.addLootTypeModifier(LootType.ENTITY) // or multiple LootType.BLOCK, LootType.ENTITY ...
.randomChance(0.3)
.addLoot("minecraft:gravel");
});

#

Like this^

marble crescent
#

Something like that

acoustic sentinelBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
hollow kite
# marble crescent Something like that

LootJS.modifiers((event) => {
event
.addLootTypeModifier(LootType."minecraft:cow")
.randomChance(0.001)
.addLoot("plushies:cow_plushie");
.addLootTypeModifier(LootType."minecraft:sheep")
.randomChance(0.001)
.addLoot("plushies:sheep_plushie");
.addLootTypeModifier(LootType."minecraft:pig")
.randomChance(0.001)
.addLoot("plushies:pig_plushie");
});

#

I tried this and it comes back as error

hollow kite
acoustic sentinelBOT
#

Paste version of plushiedrops.js from @hollow kite

acoustic sentinelBOT
#

Here's a list of some of the most common KubeJS errors and their fixes (WIP):

marble crescent
#

lol wtf that's not what i expected that command to do

#

what does the error say?

hollow kite
#

It's ok I got the hang of it all now

#

Thanks for the help @marble crescent