【いろいろ作ってコマンドを覚えよう第一弾】銃を作ろう
コマンドを作ろうと思っても、無から作るのはとても難しいと思います。なので、この記事らをもとにたくさんのコマンドを作ってコマンドを覚えよう。では早速コマンド紹介に移る。
まず、コマンドの機構を考えよう。合理的に考えるなら下のようになるだろう。
1.リロード
2.発射機構
3.弾の当たり判定、パーティクル処理
4.弾の消える判定
こうなるだろう。一つ一つ教えていく。まず最初に
code:スコアボードを作るコマンド
scoreboard objectives add ReloadTime dummy ReloadTime
scoreboard objectives add BulletRest dummy BulletRest
scoreboard objectives add BulletTime dummy BulletTime
この3つのコマンドを実行しよう。これはスコアボードを作るコマンドだ。次は以下のコマンドタワーを建てよう。https://scrapbox.io/files/68d9252344ecc52b709a648f.png
完成したらこのような感じになるよ。
code:1番右のコマンドタワー
1.リピート 無条件 動力が必要
2.チェーン 無条件 動力が必要
execute as @atag=shot at @s run replaceitem entity @s slot.armor.head 0 air 1 1 3.チェーン 無条件 動力が必要
execute as @atag=shot at @s positioned ~~1000~ run summon ender_crystal ~~~ ~ ~ none bullet 4.チェーン 無条件 動力が必要
execute as @atag=shot at @s run scoreboard players remove @s BulletRest 1 5.チェーン 無条件 動力が必要
execute as @atag=shot at @s run tag @s remove shot code:右から2番目のコマンドタワー
1.リピート 無条件 動力が必要
2.チェーン 無条件 動力が必要
3.チェーン 無条件 動力が必要
4.チェーン 無条件 動力が必要
5.チェーン 無条件 動力が必要
code:右から3番目のコマンドタワー
1.リピート 無条件 動力が必要
2.チェーン 無条件 動力が必要
3.チェーン 無条件 動力が必要
4.チェーン 無条件 動力が必要
code:右から4番目のコマンドタワー
1.リピート 無条件 動力が必要
2.チェーン 無条件 動力が必要
3.チェーン 無条件 動力が必要
4.チェーン 無条件 動力が必要