車両を1両編成にする
TCMB車輛工場で作成した車両の場合、ビヘイビアーパック内の、functions/spawn_(車両ID).mcfunctionを編集することで、1両編成の車両を作ることができます。
Scrapboxの仕様上mcfunctionには構文ハイライトがありません。ご了承ください。
code:spawn_tcmb_example_130.mcfunction
#tcmb_carを召喚
summon tcmb:tcmb_car
tag @etype=tcmb:tcmb_car,c=1 add voltage_1
tag @etype=tcmb:tcmb_car,c=1 add dest1
tag @etype=tcmb:tcmb_car,c=1 add seat1
tag @etype=tcmb:tcmb_car,c=1 add max_80km
tag @etype=tcmb:tcmb_car,c=1 add eb
scoreboard players set @e type=tcmb:tcmb_car,c=1 speed 0
#1号車を召喚
summon tcmb_example_130:car1
tag @etype=tcmb_example_130:car1,c=1 add body
tag @etype=tcmb_example_130:car1,c=1 add car1
tag @etype=tcmb_example_130:car1,c=1 add voltage_1
tag @etype=tcmb_example_130:car1,c=1 add dest1
tag @etype=tcmb_example_130:car1,c=1 add pt0
event entity @etype=tcmb_example_130:car1,c=1 seat1
tp @etype=tcmb_example_130:car1,c=1 ~~~ 0
#2号車を召喚 ここから削除
summon tcmb_example_130:car2
tag @etype=tcmb_example_130:car2,c=1 add body
tag @etype=tcmb_example_130:car2,c=1 add car2
tag @etype=tcmb_example_130:car2,c=1 add voltage_1
tag @etype=tcmb_example_130:car2,c=1 add dest1
tag @etype=tcmb_example_130:car2,c=1 add pt0
event entity @etype=tcmb_example_130:car2,c=1 seat1
tp @etype=tcmb_example_130:car2,c=1 ~~~ 0 # この行まで削除
#回転
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~1~~ rail -1 tp @e tag=body,r=1 ~~~ 90
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~1~~ golden_rail -1 tp @e tag=body,r=1 ~~~ 90
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~1~~ detector_rail -1 tp @e tag=body,r=1 ~~~ 90
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~~~1 rail -1 tp @s ~~~ 270
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~~~1 golden_rail -1 tp @s ~~~ 270
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~~~1 detector_rail -1 tp @s ~~~ 270
tcmb_example_130の部分は車両IDになっています。
編集後のコードの例
code:spawn_tcmb_example_130.mcfunction
#tcmb_carを召喚
summon tcmb:tcmb_car
tag @etype=tcmb:tcmb_car,c=1 add voltage_1
tag @etype=tcmb:tcmb_car,c=1 add dest1
tag @etype=tcmb:tcmb_car,c=1 add seat1
tag @etype=tcmb:tcmb_car,c=1 add max_80km
tag @etype=tcmb:tcmb_car,c=1 add eb
scoreboard players set @e type=tcmb:tcmb_car,c=1 speed 0
#1号車を召喚
summon tcmb_example_130:car1
tag @etype=tcmb_example_130:car1,c=1 add body
tag @etype=tcmb_example_130:car1,c=1 add car1
tag @etype=tcmb_example_130:car1,c=1 add voltage_1
tag @etype=tcmb_example_130:car1,c=1 add dest1
tag @etype=tcmb_example_130:car1,c=1 add pt0
event entity @etype=tcmb_example_130:car1,c=1 seat1
tp @etype=tcmb_example_130:car1,c=1 ~~~ 0
#回転
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~1~~ rail -1 tp @e tag=body,r=1 ~~~ 90
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~1~~ golden_rail -1 tp @e tag=body,r=1 ~~~ 90
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~1~~ detector_rail -1 tp @e tag=body,r=1 ~~~ 90
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~~~1 rail -1 tp @s ~~~ 270
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~~~1 golden_rail -1 tp @s ~~~ 270
execute @etype=tcmb:tcmb_car,c=1 ~~~ detect ~~~1 detector_rail -1 tp @s ~~~ 270
#車両製作者向け