스크립트에서 /시작을 치면 전체 플레이어를 4팀으로 나누고싶은데
팀을 만드는것부터 어렵네요
https://www.koreaminecraft.net/qna/3205007#comment_3205151 여기에 제가 단 댓글 참고하세요.
원리는 플레이어 배열변수를 만들고 랜덤 배치 후 하나씩 빼는 겁니다.
command /시작:
trigger:
if player is op:
loop all players:
send title "3" to loop-player for 1 seconds
wait 1 second
send title "2" to loop-player for 1 seconds
send title "1" to loop-player for 1 seconds
send title "시작" to loop-player for 1 seconds
execute console command "/clear @a"
execute console command "/effect clear @a"
execute console command "/give @a iron_sword{Unbreakable:1b}"
execute console command "/give @a bow{Unbreakable:1b}"
execute console command "/give @a cooked_beef 64"
execute console command "/give @a iron_shovel{Unbreakable:1b}"
execute console command "/give @a snow_block 128"
equip loop-player with unbreakable iron helmet
equip loop-player with unbreakable iron chestplate
equip loop-player with unbreakable iron leggings
equip loop-player with unbreakable iron boots
play sound "ENTITY_ENDER_DRAGON_GROWL" with volume 1 and pitch 1 at loop-player
set {_players::*} to all players
set {_halfTeamSize} to round(number of all players/2)
set {_loop} to 0
loop size of {_players::*} times:
set {_player} to random element of {_players::*}
remove {_player} from {_players::*}
if {_loop} < {_halfTeamSize}:
set {user::%{_player}%.team} to "blue"
else:
set {user::%{_player}%.team} to "red"
execute console command "/give @a arrow 64"
execute console command "/kill @e[type=item]"
set {블록설정} to true
if {user::%player%.team} is "red":
teleport loop-player to location(304.500,28,753.500)
set loop-player's default nametag to "[&c%{user::%loop-player%.team}%&f] %loop-player%"
set loop-player's tablist name to "[&c%{user::%loop-player%.team}%&f] %loop-player%"
execute console command "/spawnpoint %loop-player% 304.500 28 753.500"
else if {user::%player%.team} is "blue":
teleport loop-player to location(454.500,28,753.500)
set loop-player's default nametag to "[&9%{user::%loop-player%.team}%&f] %loop-player%"
set loop-player's tablist name to "[&9%{user::%loop-player%.team}%&f] %loop-player%"
execute console command "/spawnpoint %loop-player% 454.500 28 753.500"
이렇게 사용하는데 blue팀에 몰리네요.
뭐가 문제인지는 대충 알겠는데 수정이 어렵습니다;;
loop size of {_players::*} times: 에서 {_loop} 에 1 씩 추가하는 거 까먹으신 것 같습니다. 그거 까먹으면 카운트가 안돼서 몰리게 됩니다.
혹시 어디다가 add 1 to {_loop}를 붙여야할까요.어디다가 붙혀도 같은팀이 걸리는 에러가 계속됩니다.같은팀 걸리는 팀만 blue팀에서 red팀으로 바뀌었네요.혹시 테스트 인원이 둘이면 문제가 생기나요?
loop size of {_players::*} times: 맨 밑입니다.
그리고 if {_loop} < {_halfTeamSize}: 에서 부등호를 <= 로 변경해보세요.
레드스톤
노트블럭전문가
2024-11-27
0
건축
팀뉴일리시
2024-11-23
4
KHC
2024-10-25
2
2024-10-10
dbasd12
2024-10-09
qsef1256
2022.04.27https://www.koreaminecraft.net/qna/3205007#comment_3205151 여기에 제가 단 댓글 참고하세요.
원리는 플레이어 배열변수를 만들고 랜덤 배치 후 하나씩 빼는 겁니다.
감파르다
2022.04.27command /시작:
trigger:
if player is op:
loop all players:
send title "3" to loop-player for 1 seconds
wait 1 second
send title "2" to loop-player for 1 seconds
wait 1 second
send title "1" to loop-player for 1 seconds
wait 1 second
send title "시작" to loop-player for 1 seconds
execute console command "/clear @a"
execute console command "/effect clear @a"
execute console command "/give @a iron_sword{Unbreakable:1b}"
execute console command "/give @a bow{Unbreakable:1b}"
execute console command "/give @a cooked_beef 64"
execute console command "/give @a iron_shovel{Unbreakable:1b}"
execute console command "/give @a snow_block 128"
loop all players:
equip loop-player with unbreakable iron helmet
equip loop-player with unbreakable iron chestplate
equip loop-player with unbreakable iron leggings
equip loop-player with unbreakable iron boots
play sound "ENTITY_ENDER_DRAGON_GROWL" with volume 1 and pitch 1 at loop-player
set {_players::*} to all players
set {_halfTeamSize} to round(number of all players/2)
set {_loop} to 0
loop size of {_players::*} times:
set {_player} to random element of {_players::*}
remove {_player} from {_players::*}
if {_loop} < {_halfTeamSize}:
set {user::%{_player}%.team} to "blue"
else:
set {user::%{_player}%.team} to "red"
execute console command "/give @a arrow 64"
execute console command "/kill @e[type=item]"
set {블록설정} to true
loop all players:
if {user::%player%.team} is "red":
teleport loop-player to location(304.500,28,753.500)
set loop-player's default nametag to "[&c%{user::%loop-player%.team}%&f] %loop-player%"
set loop-player's tablist name to "[&c%{user::%loop-player%.team}%&f] %loop-player%"
execute console command "/spawnpoint %loop-player% 304.500 28 753.500"
else if {user::%player%.team} is "blue":
teleport loop-player to location(454.500,28,753.500)
set loop-player's default nametag to "[&9%{user::%loop-player%.team}%&f] %loop-player%"
set loop-player's tablist name to "[&9%{user::%loop-player%.team}%&f] %loop-player%"
execute console command "/spawnpoint %loop-player% 454.500 28 753.500"
이렇게 사용하는데 blue팀에 몰리네요.
뭐가 문제인지는 대충 알겠는데 수정이 어렵습니다;;
qsef1256
2022.04.27loop size of {_players::*} times: 에서 {_loop} 에 1 씩 추가하는 거 까먹으신 것 같습니다. 그거 까먹으면 카운트가 안돼서 몰리게 됩니다.
감파르다
2022.04.28혹시 어디다가 add 1 to {_loop}를 붙여야할까요.
어디다가 붙혀도 같은팀이 걸리는 에러가 계속됩니다.
같은팀 걸리는 팀만 blue팀에서 red팀으로 바뀌었네요.
혹시 테스트 인원이 둘이면 문제가 생기나요?
qsef1256
2022.04.28loop size of {_players::*} times: 맨 밑입니다.
qsef1256
2022.04.28그리고 if {_loop} < {_halfTeamSize}: 에서 부등호를 <= 로 변경해보세요.