shoot
概要
shoot は、発射物をスポーンして飛ばす ScriptEvent です。
矢や火の玉などの発射物を指定した方向に発射できます。
構文
/scriptevent capi:shoot <パラメータ>
パラメータ
パラメータはJSON形式またはESON形式で指定できます:
- ESON
- JSON
{id=エンティティID,nameTag=名前,fire=秒数,location=[x,y,z],vector=[vx,vy,vz],speed=速度,dimension=ディメンション名}
{
"id": "エンティティID",
"nameTag": "名前",
"fire": 秒数,
"location": [x, y, z],
"vector": [vx, vy, vz],
"speed": 速度,
"dimension": "ディメンション名"
}
| パラメータ | 説明 | 必須 |
|---|---|---|
id | 発射物のエンティティID | ✓ |
nameTag | エンティティの名前 | × |
fire | 炎上させる秒数 | × |
location | 発射位置 [x, y, z] | ✓ |
vector | 発射方向 [vx, vy, vz] | ✓ |
speed | 発射速度 | × |
dimension | ディメンション名 | × |
使用例
シンプルな矢の発射
プレイヤーの前方に矢を発射します。
- ESON
- JSON
/execute as @a run scriptevent capi:shoot {id=arrow,location=["~","~1.5","~"],vector=[<!score=capi:direction_x>,<!score=capi:direction_y>,<!score=capi:direction_z>],speed=3}
/execute as @a run scriptevent capi:shoot {
"id": "arrow",
"location": ["~", "~1.5", "~"],
"vector": [<!score=capi:direction_x>,<!score=capi:direction_y>,<!score=capi:direction_z>],
"speed": 3
}
炎上する矢
999秒間炎上した状態の矢を発射します。
- ESON
- JSON
/execute as @a run scriptevent capi:shoot {id=arrow,location=["~","~1.5","~"],vector=[0,0,1],speed=2,fire=999}
/execute as @a run scriptevent capi:shoot {
"id": "arrow",
"location": ["~", "~1.5", "~"],
"vector": [0, 0, 1],
"speed": 2,
"fire": 999
}
名前付き発射物
カスタム名を付けた発射物を発射します。
- ESON
- JSON
/scriptevent capi:shoot {id=arrow,nameTag=§c特殊な矢,location=[100,65,100],vector=[0,0,1],speed=3}
/scriptevent capi:shoot {
"id": "arrow",
"nameTag": "§c特殊な矢",
"location": [100, 65, 100],
"vector": [0, 0, 1],
"speed": 3
}
上方向への発射
真上に発射します。
- ESON
- JSON
/scriptevent capi:shoot {id=arrow,location=[~,~,~],vector=[0,1,0],speed=2}
/scriptevent capi:shoot {
"id": "arrow",
"location": [~,~,~],
"vector": [0, 1, 0],
"speed": 2
}
斜め方向への発射
斜め上に発射します。
- ESON
- JSON
/scriptevent capi:shoot {id=arrow,location=[~,~,~],vector=[1,1,0],speed=2}
/scriptevent capi:shoot {
"id": "arrow",
"location": [~,~,~],
"vector": [1, 1, 0],
"speed": 2
}
高速発射
非常に速い速度で発射します。
- ESON
- JSON
/scriptevent capi:shoot {id=arrow,location=[~,~,~],vector=[0,0,1],speed=5}
/scriptevent capi:shoot {
"id": "arrow",
"location": [~,~,~],
"vector": [0, 0, 1],
"speed": 5
}
相対座標での発射
プレイヤーの目の高さから発射します。
- ESON
- JSON
/execute as @a run scriptevent capi:shoot {id=arrow,location=["~","~1.6","~"],vector=[0,0,1],speed=2}
/execute as @a run scriptevent capi:shoot {
"id": "arrow",
"location": ["~", "~1.6", "~"],
"vector": [0, 0, 1],
"speed": 2
}
ベクトルの説明
ベクトルは実行前に正規化されるため、速度に影響しません。
方向のみを指定します。
注意事項
id、location、vectorは必須ですlocationとvectorは3つの数値の配列である必要がありますspeedのデフォルト値は 1 ですspeedは 0 より大きい必要がありますdimensionを省略した場合、実行者のディメンションが使用されますfireはtickではなく秒数で指定します- ベクトルは方向のみを表し、速度は
speedで指定します
関連項目
- spawn_entity - エンティティをスポーン
- impulse - エンティティに衝撃を与える