-
Notifications
You must be signed in to change notification settings - Fork 6
libraries
ChenCMD edited this page Jan 25, 2021
·
47 revisions
乱数を取得します
execute store result ... run function lib:random/
乱数として生成される値は
0~65535までの範囲です。
# 30%の確率で「pass!」と出力するコマンド
execute if predicate lib:random_pass_per/30 run say pass!指定した確率でtrueを返すpredicateです。
execute if predicate lib:random_pass_per/<確率>
@a[predicate=lib:random_pass_per/<確率>
確率に指定可能な値は
1~99までの範囲です。
# 30%の確率で「pass!」と出力するコマンド
execute if predicate lib:random_pass_per/30 run say pass!そのtickにそのプレイヤーを攻撃したEntityを特定する実装です。
execute as @e[type=#lib:living,type=!player,tag=AttackedEntity,distance=..150] if score @s AttackedEntity = @a[tag=this,limit=1] AttackedEntity# 攻撃してきたEntityが「attack!」と出力するコマンド
execute as @e[type=#lib:living,type=!player,tag=AttackedEntity,distance=..150] if score @s AttackedEntity = @a[tag=this,limit=1] AttackedEntity run say attack!対象のプレイヤーが死亡中の場合trueを返すpredicateです。
execute if predicate lib:is_death
@a[predicate=lib:is_death
# 生存者のみが「alive!」と出力するコマンド
execute as @a unless predicate lib:is_death run say alive!
execute as @a[predicate=!lib:is_death] run say alive!天候が指定した天候の場合trueを返すpredicateです。
execute if predicate lib:weather/is_<sunny|raining|thundering>
# 天候が雨の場合のみ「rain!」と出力するコマンド
execute if predicate lib:weather/is_raining run say rain!Work In Progress...