何ゴールド持ってたらというシステムを作りたい

一応今は特定のコマンドを実行した時1200個金インゴッドを持っていたらコマンドを正常に実行、持っていなければキャンセルというところまで書いててエラーもなく動いたんですが次の問題として1200個の “金インゴッド”でないといけないので金インゴッドと金ブロックを合わせてなどができません。そしてできればシュルカーボックスの中に入っている金も検知できるようにしたいです。 現在の構文: command /Moon: trigger: remove 1200 of Gold Ingot from player's inventory execute player command "/mvtp Moon" ←1200個プレイヤーのインベントリに金インゴッドがあれば/mvtp Moonを実行 on command "/Moon": If the player does not have 1200 Gold Ingots in their inventory: ←もしプレイヤーインベントリに1200個金インゴッドがなければイベントをキャンセルし、メッセージを送信する cancel event send "&4 I don't have enough gold ingots, I need 1200 gold to go to the moon!" on command "/Moon": ←ここからは気にしなくて大丈夫だと思います。 If the player has 1200 Gold Ingots in their inventory:
execute player command "/mvtp Moon" execute player command "/mvconfirm"
7 Replies
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
まず初めにSkriptを用いたコマンドの作成方法についてお話します Skriptでコマンドを作成する場合、その処理の実装にon commandを使う必要はありません。 また、過度に処理を分割すると不具合の原因となるので避けるべきです したがって
command /Moon:
trigger:
If the player has 1200 Gold Ingots in their inventory:
remove 1200 of Gold Ingot from player's inventory
execute player command "/mvtp Moon" ←1200個プレイヤーのインベントリに金インゴッドがあれば/mvtp Moonを実行
else:
send "&4 I don't have enough gold ingots, I need 1200 gold to go to the moon!"
command /Moon:
trigger:
If the player has 1200 Gold Ingots in their inventory:
remove 1200 of Gold Ingot from player's inventory
execute player command "/mvtp Moon" ←1200個プレイヤーのインベントリに金インゴッドがあれば/mvtp Moonを実行
else:
send "&4 I don't have enough gold ingots, I need 1200 gold to go to the moon!"
このようなコードで同様の動作をします 次に金の換算について、
#インベントリ内の金インゴットの数を取得
set {_var1} to number of gold ingot in player's inventory
#インベントリ内の金ブロックの数を取得
set {_var2} to number of gold block in player's inventory
#金ブロックを考慮した数を計算
set {_var3} to {_var1} + {_var2}*9
#インベントリ内の金インゴットの数を取得
set {_var1} to number of gold ingot in player's inventory
#インベントリ内の金ブロックの数を取得
set {_var2} to number of gold block in player's inventory
#金ブロックを考慮した数を計算
set {_var3} to {_var1} + {_var2}*9
とりあえず金ブロックを考慮するにはこのコードで大丈夫です シュルカーボックス内のアイテムはこの関数を用いて取得できます https://discord.com/channels/545926404785569793/587090563074097199/1072855822121570324
.rot2
.rot210mo ago
ご回答ありがとうございます! やり方が違うのかもしれないのですがskunityで試してみて以下のようなエラーが出てきます…エラーの意味がよくわからないです '{_var1} をプレイヤーのインベントリのゴールドインゴットの数に設定する' はエントリではありません (例: '名前 : 値') {_var1} をプレイヤーの所持品にあるゴールドインゴットの数に設定します エラーオン 12号線 '{_var2}をプレイヤーのインベントリのゴールドブロックの数に設定します'はエントリではありません(「名前:値」など) {_var2} をプレイヤーのインベントリ内のゴールドブロックの数に設定します エラーオン 14号線 '{_var3} を {_var1} + {_var2}9' に設定 はエントリではありません ('名前 : 値' など) {_var3} を {_var1} + {_var2}9 に設定します。 構文
command /Moon:
trigger:
If the player has 1200 Gold Ingots in their inventory:
remove 1200 of Gold Ingot from player's inventory
execute player command "/mvtp Moon"
else:
send "&4 I don't have enough gold ingots, I need 1200 gold to go to the moon!"

#インベントリ内の金インゴットの数を取得
set {_var1} to number of Gold ingot in player's inventory
#インベントリ内の金ブロックの数を取得
set {_var2} to number of Gold block in player's inventory
#金ブロックを考慮した数を計算
set {_var3} to {_var1} + {_var2}*9

function shulkerParser(item: item, fillAir: boolean = false) :: items:
set {_nbt::*} to tag "BlockEntityTag;Items" of nbt compound of {_item}
loop {_nbt::*}:
if {_fillAir} is true:
add item from nbt loop-value to {_items::*}
continue
set {_slot} to tag "Slot" of loop-value
set {_items::%{_slot}%} to item from nbt loop-value
if {_fillAir} is false:
loop 27 times:
{_items::%loop-number -1%} is not set
set {_items::%loop-number -1%} to air
return {_items::*}
command /Moon:
trigger:
If the player has 1200 Gold Ingots in their inventory:
remove 1200 of Gold Ingot from player's inventory
execute player command "/mvtp Moon"
else:
send "&4 I don't have enough gold ingots, I need 1200 gold to go to the moon!"

#インベントリ内の金インゴットの数を取得
set {_var1} to number of Gold ingot in player's inventory
#インベントリ内の金ブロックの数を取得
set {_var2} to number of Gold block in player's inventory
#金ブロックを考慮した数を計算
set {_var3} to {_var1} + {_var2}*9

function shulkerParser(item: item, fillAir: boolean = false) :: items:
set {_nbt::*} to tag "BlockEntityTag;Items" of nbt compound of {_item}
loop {_nbt::*}:
if {_fillAir} is true:
add item from nbt loop-value to {_items::*}
continue
set {_slot} to tag "Slot" of loop-value
set {_items::%{_slot}%} to item from nbt loop-value
if {_fillAir} is false:
loop 27 times:
{_items::%loop-number -1%} is not set
set {_items::%loop-number -1%} to air
return {_items::*}
tanoKun
tanoKun10mo ago
skunityは かなり信用できないので 実際に動かしてみましょう
.rot2
.rot210mo ago
このようなエラーが出てきました。(翻訳) 予期しないエントリ「{_ver1} をプレイヤーのインベントリ内のゴールド インゴットの数に設定」。スペルが正しいことを確認し、すべてのコード情報をトリガーに設定していることを確認してください。
tanoKun
tanoKun10mo ago
英語のままにしてほしいです
Yeahn
Yeahn10mo ago
単純にtriggerと同じインデントのところに置いてるからだと思います
mirageeeeeeeeeeeeeeeeeeeeeeeeeee
使う構文はそれだけどコピペで動くわけが無い 条件文は適切な場所に書きましょう
Want results from more Discord servers?
Add your server
More Posts
GUIでクリックしたアイテムにエンチャントエフェクトをつけたい```make clicked slot with shiny clicked item```特定のアイテムを使用したクラフトを禁止したい新しく作ったアイテムを既存のクラフトで使えなくしたいのですがどうすればよいでしょうか?特別なアイテムを作りたい特別なアイテムを作りたい MC v1.20.1 purpur #2001 Skript v2.7.0 β3 利用用途: ・スキルカードを紙アイテムで作る ・右クリックで紙アイテムを消費して特定のススポーンさせたアマスタを最寄りの原木に向かせたい``` spawn an armor stand at {_loc} loop all blocks in radius 1 around the last spawned entity: iモブがプレイヤーを敵対したことを検知したいイベントを調べて見ましたが、それっぽいものが見つかりませんでした モブがプレイヤーを敵対したことを検知するイベントはありますでしょうか?nbt付きの矢のダメージ無効化```on damage of a player: if attacker is an arrow: if nbt compound of attacker has tag "チェストを使ったショップを作りたい``` on right click on emerald block: set {_chest} to block below clicked block if {_chest} iチャットで装飾コードを使えなくしたいskriptのon shatで通常チャットを変えてるのですがそれをすると装飾コードが使えるようになり&kでチャットをすると文字化けして統合版でプレイしてる人が落ちたりします なので装飾コードを打てなく参加した時のゲームモード変更```on join: set join message to "&7[&9&lSV&7] &e&l%player%&7さんが&a&lログイン&7しました。" teleport theアマスタを触った時のイベント```on armor stand interact: if player is not op: send "you are not op" cancel ev