Jump to content

how to stop multiple chances of happening


SavageCabage619

Recommended Posts

so im trying to make a code so whenever i jump, i spawn a random mob

so i have it so that every mob have a certain amount of chance of spawning, but sometimes when i jump, i spawn 2 mobs not 1. I want it to spawn 1 mob only.

Here is my code if you need (its long):on player jump:
    loop all players:
        chance of 4%:
            spawn bat
        chance of 4%:
            spawn cat
        chance of 4%:
            spawn chicken
        chance of 4%:
            spawn cod
        chance of 4%:
            spawn cow
        chance of 4%:
            spawn donkey
        chance of 4%:
            spawn fox
        chance of 4%:
            spawn horse
        chance of 4%:
            spawn mooshroom
        chance of 4%:
            spawn mule
        chance of 4%:
            spawn ocelot
        chance of 4%:
            spawn parrot
        chance of 4%:
            spawn pig
        chance of 4%:
            spawn puffer fish
        chance of 4%:
            spawn rabbit
        chance of 4%:
            spawn salmon
        chance of 4%:
            spawn sheep
        chance of 4%:
            spawn skeleton horse
        chance of 4%:
            spawn snow golem
        chance of 4%:
            spawn squid
        chance of 4%:
            spawn strider
        chance of 4%:
            spawn tropical fish
        chance of 4%:
            spawn turtle
        chance of 4%:
            spawn villager
        chance of 4%:
            spawn wandering trader
        chance of 4%:
            spawn bee
        chance of 4%:
            spawn cave spider
        chance of 4%:
            spawn dolphin
        chance of 4%:
            spawn enderman
        chance of 4%:
            spawn iron golem
        chance of 4%:
            spawn llama
        chance of 4%:
            spawn piglin
        chance of 4%:
            spawn panda
        chance of 4%:
            spawn polar bear
        chance of 4%:
            spawn spider
        chance of 4%:
            spawn wolf
        chance of 4%:
            spawn zombified piglin
        chance of 4%:
            spawn blaze
        chance of 4%:
            spawn creeper
        chance of 4%:
            spawn drowned
        chance of 4%:
            spawn elder guardian
        chance of 4%:
            spawn endermite
        chance of 4%:
            spawn evoker
        chance of 4%:
            spawn ghast
        chance of 4%:
            spawn guardian
        chance of 4%:
            spawn hoglin
        chance of 4%:
            spawn husk
        chance of 4%:
            spawn magma cube
        chance of 4%:
            spawn phantom
        chance of 4%:
            spawn piglin brute
        chance of 4%:
            spawn ravager
        chance of 4%:
            spawn shulker
        chance of 4%:
            spawn silverfish
        chance of 4%:
            spawn skeleton
        chance of 4%:
            spawn slime
        chance of 4%:
            spawn stray
        chance of 4%:
            spawn vex
        chance of 4%:
            spawn vindicator
        chance of 4%:
            spawn witch
        chance of 4%:
            spawn wither skeleton
        chance of 4%:
            spawn zoglin
        chance of 4%:
            spawn zombie
        chance of 4%:
            spawn zombie villager
        chance of 4%:
            spawn enderdragon
        chance of 4%:
            spawn wither
        chance of 4%:
            spawn giant
        chance of 4%:
            spawn zombie horse
        chance of 4%:
            spawn illusioner
 

Link to comment
Share on other sites

22 minutes ago, SavageCabage619 said:

so im trying to make a code so whenever i jump, i spawn a random mob

so i have it so that every mob have a certain amount of chance of spawning, but sometimes when i jump, i spawn 2 mobs not 1. I want it to spawn 1 mob only.

Here is my code if you need (its long):on player jump:
    loop all players:
        chance of 4%:
            spawn bat
        chance of 4%:
            spawn cat
        chance of 4%:
            spawn chicken
        chance of 4%:
            spawn cod
        chance of 4%:
            spawn cow
        chance of 4%:
            spawn donkey
        chance of 4%:
            spawn fox
        chance of 4%:
            spawn horse
        chance of 4%:
            spawn mooshroom
        chance of 4%:
            spawn mule
        chance of 4%:
            spawn ocelot
        chance of 4%:
            spawn parrot
        chance of 4%:
            spawn pig
        chance of 4%:
            spawn puffer fish
        chance of 4%:
            spawn rabbit
        chance of 4%:
            spawn salmon
        chance of 4%:
            spawn sheep
        chance of 4%:
            spawn skeleton horse
        chance of 4%:
            spawn snow golem
        chance of 4%:
            spawn squid
        chance of 4%:
            spawn strider
        chance of 4%:
            spawn tropical fish
        chance of 4%:
            spawn turtle
        chance of 4%:
            spawn villager
        chance of 4%:
            spawn wandering trader
        chance of 4%:
            spawn bee
        chance of 4%:
            spawn cave spider
        chance of 4%:
            spawn dolphin
        chance of 4%:
            spawn enderman
        chance of 4%:
            spawn iron golem
        chance of 4%:
            spawn llama
        chance of 4%:
            spawn piglin
        chance of 4%:
            spawn panda
        chance of 4%:
            spawn polar bear
        chance of 4%:
            spawn spider
        chance of 4%:
            spawn wolf
        chance of 4%:
            spawn zombified piglin
        chance of 4%:
            spawn blaze
        chance of 4%:
            spawn creeper
        chance of 4%:
            spawn drowned
        chance of 4%:
            spawn elder guardian
        chance of 4%:
            spawn endermite
        chance of 4%:
            spawn evoker
        chance of 4%:
            spawn ghast
        chance of 4%:
            spawn guardian
        chance of 4%:
            spawn hoglin
        chance of 4%:
            spawn husk
        chance of 4%:
            spawn magma cube
        chance of 4%:
            spawn phantom
        chance of 4%:
            spawn piglin brute
        chance of 4%:
            spawn ravager
        chance of 4%:
            spawn shulker
        chance of 4%:
            spawn silverfish
        chance of 4%:
            spawn skeleton
        chance of 4%:
            spawn slime
        chance of 4%:
            spawn stray
        chance of 4%:
            spawn vex
        chance of 4%:
            spawn vindicator
        chance of 4%:
            spawn witch
        chance of 4%:
            spawn wither skeleton
        chance of 4%:
            spawn zoglin
        chance of 4%:
            spawn zombie
        chance of 4%:
            spawn zombie villager
        chance of 4%:
            spawn enderdragon
        chance of 4%:
            spawn wither
        chance of 4%:
            spawn giant
        chance of 4%:
            spawn zombie horse
        chance of 4%:
            spawn illusioner
 

if youre just going to spawn any mob, try
 

set {Mob} to random mob out of all mobs
summon {Mob}

or use random integers instead of chances
 

set {MobChance} to random integer between <MIN> and <MAX>

 

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

16 minutes ago, AgentGamerPro said:

if youre just going to spawn any mob, try
 


set {Mob} to random mob out of all mobs
summon {Mob}

or use random integers instead of chances
 


set {MobChance} to random integer between <MIN> and <MAX>

 

how would i use the set {Mob} to random mob out of all mobs

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...