Pets
in world code put:
var egg = (pets, mutations) => {
let nameD, rarityD, descD, itemD, tierD = null, mutationsD = [], r = Math.random(), a = 0
for (let pet of pets) {
a += pet.chance
if (r <= a) {
nameD = pet.petName
rarityD = pet.rarity
itemD = pet.item
break
}
}
for (let mutation of mutations) {
r = Math.random()
if (r <= mutation.chance) {
mutationsD.push(mutation.mName)
tierD = mutation.tier
}
}
api.sendMessage(myId, `You got a ${rarityD} ${nameD}`)
descD = rarityD
for (let m of mutationsD) {
descD += "\n" + m
}
api.giveItem(myId, itemD, 1, { customDisplayName: nameD, customDescription: descD, customAttributes: { enchantmentTier: tierD } })
}
then in a code block put this:
const petsR = [
{ petName: "Dog", item: "Brown Paintball", chance: 0.45, rarity: "Common" },
{ petName: "Cat", item: "Yellow Paintball", chance: 0.45, rarity: "Common" },
{ petName: "Red Dragon", item: "Red Paintball", chance: 0.1, rarity: "Epic" },
]
const mutationsR = [
{ mName: "[Glowing]", chance: 0.05, tier: "Tier 1" },
{ mName: "[Golden]", chance: 0.01, tier: "Tier 5" },
{ mName: "[Radioactive]", chance: 0.001, tier: "Tier 2" },
]
egg(petsR, mutationsR)
u can edit this to add mutations, more pets, just make sure the pets chances add up to 1
Posted Dec 6, 2025, 4:54 PM UTC
11