耐久値でのクールタイムを成功させる方法を教えてください

質問失礼します。
on right click:
if name of event-player's tool contains "ジャンプロッド":
if damage of event-player's tool is 0:
apply potion of levitation of tier 23 to player for 1 seconds
damage event-player's tool by 24
wait 1 seconds
damage event-player's tool by -4
on right click:
if name of event-player's tool contains "ジャンプロッド":
if damage of event-player's tool is 0:
apply potion of levitation of tier 23 to player for 1 seconds
damage event-player's tool by 24
wait 1 seconds
damage event-player's tool by -4
この時耐久値を一秒待った時に使ったアイテムを回復させたいんですがこの場合だと一秒待つ間にアイテムを切り替えた時に別のアイテムが回復してしまいました。 それを直すために
on right click:
if name of event-player's tool contains "ジャンプロッド":
if damage of event-player's tool is 0:
apply potion of levitation of tier 23 to player for 1 seconds
damage event-player's tool by 24
set {_i} to event-player's tool
wait 1 seconds
damage {_i} by -4
on right click:
if name of event-player's tool contains "ジャンプロッド":
if damage of event-player's tool is 0:
apply potion of levitation of tier 23 to player for 1 seconds
damage event-player's tool by 24
set {_i} to event-player's tool
wait 1 seconds
damage {_i} by -4
のように一度アイテムを変数に入れてみたのですが回復しなくなってしまいました。 send "%{_i}%"と send "%event-player's tool%" を実行してデバッグしてみたのですがどちらも「carrot of stick named "ジャンプロッド"」でした 最後の
damage {_i} by -4
damage {_i} by -4
damage item of {_i} by -4
damage item of {_i} by -4
にしてみましたが変わらず回復しませんでした。 それを直すにはどうすればいいでしょうか
4 Replies
ぐううううう
サーバーのバージョンは1.19.2でSKのバージョンは2.6.3です。 アドオンはないです このコードの目的は"ジャンプロッド"をクリックしたときに高くジャンプさせる。 その時"ジャンプロッド"(人参付き棒)の耐久値をぎりぎりにして1秒ごとに4回復させる ことでクールタイムを作ることです。
soramame_256
soramame_2562y ago
多少ごり押していいならNBTに専用のデータ付けてloopするのが一番かなぁ...
soramame_256
soramame_2562y ago
もしくはhttps://skripthub.net/docs/?id=939 試してみるといいかも
Skript Hub - Documentation
Data/Damage Value (Expression) - Skript
The data/damage value of an item/block. Data values of blocks are only supported on 1.12.2 and below. You usually don't need this expression as you can check and set items with aliases easily, but this expression can e.g. be used to "add 1 to data of ", e.g. for cycling through all wool colours.
ぐううううう
すみません。
every 5 ticks:
loop all players:
loop all items in loop-player's inventory:
if loop-item's name contains "ジャンプロッド":
damage loop-item by -0.001
every 5 ticks:
loop all players:
loop all items in loop-player's inventory:
if loop-item's name contains "ジャンプロッド":
damage loop-item by -0.001
でごり押ししました 多分0.001意味ないけどいい感じのクールダウンを作ることができました ありがとうございます。