0

So, what I want to make is a randomizer that constantly runs from 0-100 (which I already have) that at certain values swaps one mob with another. Simulating natural spawning for the mob. (It's for an RPG-ish special enemy system) So I have the whole thing done, but the issue is that I can't select multiple values of the same scoreboard: @e[scores={randomizer=1,randomizer=50,randomizer=99}] is supposed to summon the mob at three points (which is about 3% spawn chance), however they will only spawn at 99(only 1%). Does anyone know an answer to this that is NOT @e[scores={randomizer=0..20}] for 20% spawn chance, because this causes them to spawn in big groups at once.

If you'd want to know, the randomizer is an armor_stand with a specific name. Here's the exact command used for one of the mobs:

execute as @e[type=armor_stand,name="randomizerdummy",scores={randomizer=0,randomizer=5**(so on to 100, for the sake of saving some space)**}] run
    execute as @e[limit=1,sort=arbitrary,type=iron_golem,scores={lifetime=0..2},name=!"Peacekeeper"] at @s run
    scoreboard players set @s golemspawn 1

(Note that the above is a single command split over 3 lines to improve readability)

So it's executed from the armor stand at certain values to one random iron golem with a lifetime(dummy scoreboard that is constantly running) of 0..2

The name=!"Peacekeeper" is just to keep it from swapping an already swapped golem

4
  • You're probably going to have to run the command once for each randomizer value you want at a given time. Can you better articulate why you don't want to use ranges (even small ones that will give the proper spawn chance)?
    – MBraedley
    Mar 26 '19 at 15:01
  • 1
    So you want to do something if the random value is either 1 or 50 or 99? Why not just 1, 2 or 3? Mar 26 '19 at 15:01
  • Well, the reason that I don't just take 0..20 for example is because if there are skeletons spawning, they usually spawn in groups. And lets say they all spawn when the randomizer is at value 0 at this point. Then one skeleton would be swapped, it the goes to value 1 swapping another skeleton, and once more for value 2 (because the lifetime of 0..2) causing three of them to spawn within 0,1s. Although now that I think of it that may have led to answer my own question... Because I can just change the randomizer value to 0..20 and the lifetime value check to 0..0 causing it to only spawn one... Mar 26 '19 at 16:03
  • Your problem might be because I think only one score condition per objective is allowed. You said you did "scores={randomizer=0,randomizer=50,randomizer=99}". My theory is that it is ignoring all the score conditions before randomizer=99. Perhaps a solution would be to tag all skeletons with those scores and then target them with tag=<the tag you use>. Mar 26 '19 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.