スポーンさせたアマスタを最寄りの原木に向かせたい

spawn an armor stand at {_loc}
loop all blocks in radius 1 around the last spawned entity:
if loop-block is a oak log:
broadcast "%loop-block's location%"
exit loop
spawn an armor stand at {_loc}
loop all blocks in radius 1 around the last spawned entity:
if loop-block is a oak log:
broadcast "%loop-block's location%"
exit loop
16 Replies
ふぁたおくん
ふぁたおくんOP17mo ago
アマスタの向きを変える構文がわからなかったです
月猫ch
月猫ch17mo ago
armor standは向きとかnbtで設定してるらしい ちょい待ち前書いたやつ持ってくるわ こればっかりは勉強とかそういう次元じゃない気がする
function spawnStand(loc: location,yaw: number):
spawn armor stand at {_loc} ~ vector 0,-1,0 with nbt "{Invisible:1b,Rotation:[%{_yaw}%f]}"
set {_stand} to last spawned entity
# {ITEMS::*}に入ってるアイテムをランダムに頭に載せる構文
# 不必要
#set {_stand}'s helmet to random item of {ITEMS::*}

# 『この関数で作ったアマスタです!』って目印つける構文
# 不必要
#set metadata value "table" of {_stand} to 1

set {_v} to a random vector
set {_standLoc} to {_loc} ~ vector 0,-1,0
set {_standLoc}'s pitch to 30
teleport {_stand} to {_standLoc}

# 重力消去
set gravity of {_stand} to off

# 当たり判定消去
# CSとかの銃弾で壊れなくなるよ
set noclip state of {_stand} to true

# 出現させたアマスタ一覧に登録する
# まあ不必要
#add {_stand} to {stands::*}
function spawnStand(loc: location,yaw: number):
spawn armor stand at {_loc} ~ vector 0,-1,0 with nbt "{Invisible:1b,Rotation:[%{_yaw}%f]}"
set {_stand} to last spawned entity
# {ITEMS::*}に入ってるアイテムをランダムに頭に載せる構文
# 不必要
#set {_stand}'s helmet to random item of {ITEMS::*}

# 『この関数で作ったアマスタです!』って目印つける構文
# 不必要
#set metadata value "table" of {_stand} to 1

set {_v} to a random vector
set {_standLoc} to {_loc} ~ vector 0,-1,0
set {_standLoc}'s pitch to 30
teleport {_stand} to {_standLoc}

# 重力消去
set gravity of {_stand} to off

# 当たり判定消去
# CSとかの銃弾で壊れなくなるよ
set noclip state of {_stand} to true

# 出現させたアマスタ一覧に登録する
# まあ不必要
#add {_stand} to {stands::*}
# 200秒で勝手に消える設定
# まあ不必要
loop 12000 times:
wait 1 tick
{_stand}'s helmet is air
play sound "item.armor.equip_iron" with volume 2 at {_stand}'s head
exit 1 section
kill {_stand}
remove {_stand} from {stands::*}
# 200秒で勝手に消える設定
# まあ不必要
loop 12000 times:
wait 1 tick
{_stand}'s helmet is air
play sound "item.armor.equip_iron" with volume 2 at {_stand}'s head
exit 1 section
kill {_stand}
remove {_stand} from {stands::*}
locとyawを引き数で渡すと、 locの1マス下にアマスタが出る関数 spawn armor stand at {_loc} ~ vector 0,-1,0 with nbt "{Invisible:1b,Rotation:[%{_yaw}%f]}" 実際にyawかえたりしてるのはここ with nbt "{Invisible:1b,Rotation:[%{_yaw}%f]}
ふぁたおくん
ふぁたおくんOP17mo ago
loop-blockの方向に向くようにyawを計算するのってどうしたらいいかな
月猫ch
月猫ch17mo ago
vectorとってyawとればいいんじゃね set {_vec} to vector from {_loc1} to {_loc2}
ふぁたおくん
ふぁたおくんOP17mo ago
ちょっと色々試してみる ありがとう 試行錯誤してみたけどvectorやらなんやらが理解できなかった これでloc1から見たloc2への向きがわかる?
月猫ch
月猫ch17mo ago
vector ベクトル 力の大きさや向きを所持するオブジェクト どこ向きにどれくらいの力 ってデータが入ってる ⇧はloc1からloc2に向かうvectorが入ってる
ふぁたおくん
ふぁたおくんOP17mo ago
そのvectorからyawを取り出すの?
月猫ch
月猫ch17mo ago
そっそ
ふぁたおくん
ふぁたおくんOP17mo ago
{_vec}からyawを取り出すのってどうしたらいい? set {_yaw} to yaw of {_vec}とかでできてるのかな
月猫ch
月猫ch17mo ago
できるで
ふぁたおくん
ふぁたおくんOP17mo ago
function spawnBug(loc: location, t: text):
spawn an armor stand at {_loc} with nbt "{NoGravity:1b}"
loop all blocks in radius 1 around the last spawned armor stand:
if loop-block is a oak log:
set {spawned::%{_loc}%} to true
set {_logloc} to loop-block's location
set {_vec} to vector from location of last spawned armor stand to {_logloc}
set {_yaw} to yaw of {_vec}
add "{Rotation:[%{_yaw}%f]}" to last spawned entity's nbt
set helmet of last spawned armor stand to random item of {Catching::Bugs::%{_t}%::*}
exit loop
else:
continue loop
function spawnBug(loc: location, t: text):
spawn an armor stand at {_loc} with nbt "{NoGravity:1b}"
loop all blocks in radius 1 around the last spawned armor stand:
if loop-block is a oak log:
set {spawned::%{_loc}%} to true
set {_logloc} to loop-block's location
set {_vec} to vector from location of last spawned armor stand to {_logloc}
set {_yaw} to yaw of {_vec}
add "{Rotation:[%{_yaw}%f]}" to last spawned entity's nbt
set helmet of last spawned armor stand to random item of {Catching::Bugs::%{_t}%::*}
exit loop
else:
continue loop
これでただのアマスタが出てくるので多分if文のところがなんかおかしいんだけどわかりますか {Catching::Bugs::%{_t}%::*}の中に入ってるアイテムを被せたい
月猫ch
月猫ch17mo ago
broadcastかなんかでチェックした?その変数 あとここたぶんいらない
else:
continue loop
else:
continue loop
ふぁたおくん
ふぁたおくんOP17mo ago
function spawnBug(loc: location, t: text):
spawn an armor stand at {_loc} with nbt "{NoGravity:1b}"
loop all blocks in radius 1 around the last spawned armor stand:
if loop-block is a oak log:
broadcast "aaa"
set {spawned::%{_loc}%} to true
set {_logloc} to loop-block's location
set {_vec} to vector from location of last spawned armor stand to {_logloc}
set {_yaw} to yaw of {_vec}
add "{Rotation:[%{_yaw}%f]}" to last spawned entity's nbt
set helmet of last spawned armor stand to random item of {Catching::Bugs::%{_t}%::*}
exit loop
function spawnBug(loc: location, t: text):
spawn an armor stand at {_loc} with nbt "{NoGravity:1b}"
loop all blocks in radius 1 around the last spawned armor stand:
if loop-block is a oak log:
broadcast "aaa"
set {spawned::%{_loc}%} to true
set {_logloc} to loop-block's location
set {_vec} to vector from location of last spawned armor stand to {_logloc}
set {_yaw} to yaw of {_vec}
add "{Rotation:[%{_yaw}%f]}" to last spawned entity's nbt
set helmet of last spawned armor stand to random item of {Catching::Bugs::%{_t}%::*}
exit loop
broadcastが実行されない
月猫ch
月猫ch17mo ago
半径1mだったら そもそもoak log見つかるのかそれ
ふぁたおくん
ふぁたおくんOP17mo ago
1.5にしたらできた(笑)
ふぁたおくん
ふぁたおくんOP17mo ago
あとはむかせたい
No description
Want results from more Discord servers?
Add your server