阡喏
本帖最后由 阡喏 于 2023-4-4 21:41 编辑

用 箱子-战利品表(物品个数) 做的随机数生成如何只在几个值内随机?
如把随机范围限制在 1  5  10 三个数之间
json
{
    "pools": [
      {
        "rolls": 1,
        "entries": [
          {
            "type": "minecraft:item",
            "name": "minecraft:stone",
            "functions": [
              {
                "function": "minecraft:set_count",
                "count": {
                  "min": 1,
                  "max": 18
                }
              }
            ]
          }
        ]
      }
    ]
  }复制代码




命令
execute if score #random_effect option matches 1 run loot insert ~ 255 ~ loot custom_play:random_effect/buff
execute if score #random_effect option matches 2 run loot insert ~ 255 ~ loot custom_play:random_effect/debuff
execute if score #random_effect option matches 3 run loot insert ~ 255 ~ loot custom_play:random_effect/all
execute store result score #random_effect random_value run data get block ~ 255 ~ Items[0].Count
setblock ~ 255 ~ air
复制代码

第一页 上一页 下一页 最后一页