テレポートしたとき、元の位置からどれだけ離れたかを変数にぶち込む方法

お願いします
4 Replies
Yeahn
Yeahn13mo ago
on teleport:
set {_past} to past event-location
set {_future} to future event-location
set {_dist} to distance between {_past} and {_future}
on teleport:
set {_past} to past event-location
set {_future} to future event-location
set {_dist} to distance between {_past} and {_future}
{_dist}に距離が入ります。
makaronipizaa
makaronipizaaOP13mo ago
あ、すみません語弊ありました
on rightclick holding enchanted book:
if uncoloured name of player's tool is "test":
if {skill.last::%player%} is set:
difference of {skill.last::%player%} and now < 2 seconds
stop
set {_pos} to location of target block
set yaw of {_pos} to yaw of player
set pitch of {_pos} to pitch of player
add 0.5 to y-loc of {_pos}
teleport player to {_pos}
loop all entities in radius 4 around player:
if loop-entities isn't "%player%":
make player damage loop-entity by (ここに変数を入れたい)
execute console command "/playsound minecraft:entity.lightning_bolt.impact master %player% ~ ~ ~ 1 0.5 1"
set {_test} to location of the block 0 meter in front of player
show 500 "SPELL_INSTANT" particles at {_test} for player offset by 3, -1, 3
show 1000 "FIREWORKS_SPARK" particles at {_test} for player offset by 5, 0, 5
set {skill.last::%player%} to now
on rightclick holding enchanted book:
if uncoloured name of player's tool is "test":
if {skill.last::%player%} is set:
difference of {skill.last::%player%} and now < 2 seconds
stop
set {_pos} to location of target block
set yaw of {_pos} to yaw of player
set pitch of {_pos} to pitch of player
add 0.5 to y-loc of {_pos}
teleport player to {_pos}
loop all entities in radius 4 around player:
if loop-entities isn't "%player%":
make player damage loop-entity by (ここに変数を入れたい)
execute console command "/playsound minecraft:entity.lightning_bolt.impact master %player% ~ ~ ~ 1 0.5 1"
set {_test} to location of the block 0 meter in front of player
show 500 "SPELL_INSTANT" particles at {_test} for player offset by 3, -1, 3
show 1000 "FIREWORKS_SPARK" particles at {_test} for player offset by 5, 0, 5
set {skill.last::%player%} to now
このコードにどれだけ離れたかの変数をぶち込みたいんですよね やりたいこととしては、どれだけ離れたかでダメージが変わるスキルを作りたいんですけど...
Yeahn
Yeahn13mo ago
であれば同じように前と後の座標を保存するので
on rightclick holding enchanted book:
if uncoloured name of player's tool is "test":
if {skill.last::%player%} is set:
difference of {skill.last::%player%} and now < 2 seconds
stop
set {_pos} to location of target block
set yaw of {_pos} to yaw of player
set pitch of {_pos} to pitch of player
add 0.5 to y-loc of {_pos}
set {_loc} to player's location
teleport player to {_pos}
set {_dist} to distance between {_pos} and {_loc}
loop all entities in radius 4 around player:
if loop-entities isn't "%player%":
make player damage loop-entity by {_dist}
execute console command "/playsound minecraft:entity.lightning_bolt.impact master %player% ~ ~ ~ 1 0.5 1"
set {_test} to location of the block 0 meter in front of player
show 500 "SPELL_INSTANT" particles at {_test} for player offset by 3, -1, 3
show 1000 "FIREWORKS_SPARK" particles at {_test} for player offset by 5, 0, 5
set {skill.last::%player%} to now
on rightclick holding enchanted book:
if uncoloured name of player's tool is "test":
if {skill.last::%player%} is set:
difference of {skill.last::%player%} and now < 2 seconds
stop
set {_pos} to location of target block
set yaw of {_pos} to yaw of player
set pitch of {_pos} to pitch of player
add 0.5 to y-loc of {_pos}
set {_loc} to player's location
teleport player to {_pos}
set {_dist} to distance between {_pos} and {_loc}
loop all entities in radius 4 around player:
if loop-entities isn't "%player%":
make player damage loop-entity by {_dist}
execute console command "/playsound minecraft:entity.lightning_bolt.impact master %player% ~ ~ ~ 1 0.5 1"
set {_test} to location of the block 0 meter in front of player
show 500 "SPELL_INSTANT" particles at {_test} for player offset by 3, -1, 3
show 1000 "FIREWORKS_SPARK" particles at {_test} for player offset by 5, 0, 5
set {skill.last::%player%} to now
このようにすればよいかと思われます
makaronipizaa
makaronipizaaOP13mo ago
うおおおおお!!!! できました!!!! なんとお礼を言ったらいいか.... 本当にありがとうございます!!!!2時間ぐらい悩んでたので助かりました!!!!
Want results from more Discord servers?
Add your server