커맨드 질문 있는 게이는 여따 댓글로 달아줘라 질문글 쓰지 말고
내가 답해드림
이 글에선 시야에 들어온 엔티티 감지하는 방법 질문한 게이가 있어서 알려드림
> 조건적
| 무조건적
1.
[기본] execute as @p at @s anchored eyes run summon marker ^ ^ ^1 {Tags:["markers","marker1"]}
| execute as @p at @s anchored eyes positioned ^ ^ ^2 {Tags:["markers","marker2"]}
| execute as @p at @s anchored eyes positioned ^ ^ ^3 {Tags:["markers","marker3"]}
| execute as @p at @s anchored eyes positioned ^ ^ ^4 {Tags:["markers","marker4"]}
...
| execute as @p at @s anchored eyes positioned ^ ^ ^30 {Tags:["markers","marker30"]}
| scoreboard players set @e[tag=marker1] marker 1
| scoreboard players set @e[tag=marker2] marker 2
...
| scoreboard players set @e[tag=marker30] marker 30
이거 한번 작동시켜서 마커 소환하고
2.
[반복] execute as @p at @s anchored eyes run tp @n[tag=marker1] ^ ^ ^1
| execute as @p at @s anchored eyes run tp @n[tag=marker2] ^ ^ ^2
| execute as @p at @s anchored eyes run tp @n[tag=marker3] ^ ^ ^3
...
| execute as @p at @s anchored eyes run tp @n[tag=marker30] ^ ^ ^30
이걸로 플레이어 시선 앞으로 계속 마커 tp 시키고
(if entity 넣거나 해서 없는 마커는 작동 안 되게 하면 최적화에 좋긴 한데 그렇게까지 최적화를 할 필요는 없음)
3.
[반복] execute if entity @a[tag=you_shall_not_execute] run tag @a remove you_shall_not_execute
| execute if entity @etag=detected] run tag @e remove detected
| execute at @e[tag=markers] if entity @e[tag=entity,distance=0..1] run tag @s add detected
> execute at @p as @e[tag=markers] if score @s marker < @n[tag=detected] marker at @s unless block ~ ~ ~ #air run tag @p add you_shall_not_execute
> execute unless entity @a[tag=you_shall_not_execute] run function func:tion
이걸로 마커 주변에 엔티티가 있다면 명령어 실행하면 된다.
(만약 주변에 엔티티가 있는 마커의 앞을 어떤 블럭이 가로막고 있다면 실행하지 않기 위해 if score 저거 쓴 거)
만약 더 상세하게(?) 감지하고 싶으면 0.5칸씩 앞으로 가면서 소환하면 된다.
그럼 이제 활용을 해보자
"게임 시작"이라 써 있는 텍스트 디스플레이랑 인터렉션을 겹쳐 놓고
그 텍스트를 클릭하면 게임이 시작되는데
그 텍스트에 시선이 갔을 때 "게임 시작"의 글자 색을 바꾸는 걸 만들려면,
3번에 있는 func:tion의 내용을
execute at @e[tag=markers] if entity @e[tag=interaction,distance=0..1] at @n[tag=interaction] run data merge entity @n[tag=startgame] {text:'{"color":"yellow","text":"게임 시작"}'}
execute as @n[tag=startgame] at @s unless entity @e[tag=markers,distance=0..1] run data merge entity @s {text:'{"text":"계엄 시작"}'}
이렇게 쓰면 되겠지?
근데 텍스트 디스플레이는 옆으로 긴 경우가 많음. 그러므로
execute at @e[tag=markers] positioned ~-0.5 ~ ~ if entity @e[tag=interaction,distance=0..1] at @n[tag=interaction] run data merge entity @n[tag=startgame] {text:'{"color":"yellow","text":"게임 시작"}'}
execute at @e[tag=markers] positioned ~0.5 ~ ~ if entity @e[tag=interaction,distance=0..1] at @n[tag=interaction] run data merge entity @n[tag=startgame] {text:'{"color":"yellow","text":"계엄 시작"}'}
execute as @n[tag=startgame] at @s positioned ~0.5 ~ ~ unless entity @e[tag=markers,distance=0..1] positioned ~-1 ~ ~ unless entity @e[tag=markers,distance=0..1] run data merge entity @s {text:'{"text":"게임 시작"}'}
뭐.. 대충 이런 식으로 하면 된다. (당연히 z축으로 긴 경우엔 바꿔야 됨)
참고로 positioned 쓰면서 종종 나올 수 있는 실수인데,
positioned ~0.5 ~ ~를 한번 쓴 다음에 뒤에다가 positioned ~-0.5 ~ ~를 쓰면 제자리로 돌아온다.
~-1 ~ ~을 써야 0.5칸 뒤로 갈 수 있음
TMI ) 텍디플의 히트박스는 텍스트의 가운데 아래 있다.
커맨드로 텍디플을 감지하는 것 또한 히트박스를 감지하는 것이다.
근데 지금 내가 마크 켜고 쓰는 게 아니라서 버그가 있을 수도 있는데 뭐 나한테 버그 생기는 거 아니니까 괜찮음.
시가콰
원래는 이런 거 안 해주는데 특별히 해줬으니 한 30,000원이면 될 것 같음. 고맙다.
뭐야 이게이 생각보다 커맨드 고쉈네
똥맵검사기+커맨드 강의까지 하다니 대단함 선생
중간에 계엄 시작 뭔데ㅋㅋ
특정 좌표a에 있는사람을 특정 좌표b로 옮기는 명령어좀 알려줄 수 있냐..ㅠ 2년만에 마크해서 명령어를 잘 몰라..
/tp @a[x=12.0y=34.0z=56.0dx=0dy=0dz=0] [특정 좌표 b]소숫점은 웬만해선 그냥 .0 붙이면 됨( 12 34 56 = [특정 좌표 a] )이게 귀찮으면 그냥 이렇게.../execute positioned [특정 좌표 a] run tp @a[distance=0..0.5] [특정 좌표 b](이 경우엔 소숫점에 .5를 붙여줘라)여기에서 [특정 좌표 a]를 쓸 때는 f3 누르면 오른쪽에 나오는 "Targeted Block" 좌표를 이용해야 된다(아니면 그냥 "음수인 좌표에 1 빼기"만 기억해도 무방함.)참고로 dx dy dz를 사용하는 방법은 네모 모양으로 감지하고distance는 원 모양으로 감지한다는 차이점이 있으니 상황에 따라 적절한 거 쓰면 됨
고맙다 ㅜㅜ
12000원이 아니노 실망임
yes or no뜨게 하는 커맨드좀 알 수 있을까?
채팅 클릭
/tellraw @a [""{"text":"[ YES ]""color":"aqua""clickEvent":{"action":"run_command""value":"YES 했을 때 작동될 커맨드"}}" "{"text":"[ NO ]""color":"red""clickEvent":{"action":"run_command""value":"NO 했을 때 작동될 커맨드"}}] 저 두 커맨드 부분에 슬래쉬를 꼭 써야 작동이 된다 참고로 저 부분에 /say와 /tell은 못 쓰고 큰따옴표는 앞에 역슬래쉬를 붙여서 써야 된다
고맙다!
뭐가 문제냐?
저기에다가는 /function 또는 /setblock x y z redstone_block 쓰는 걸 추천함 그게 편해
고맙당
근데 이렇게 하면 벽 뒤에 있는 엔티티도 감지할 수 있는 거 아니냐?
그냥 엔티티 하나를 플레이어 시선 방향을 보도록 소환하고 앞으로 tp시키며 감지하는 게 낫지 않을까
그 방법도 알긴 하지만 최적화에 안 좋은 걸로 알고 있고 한 번도 안 써본 방법이라서 그냥 제대로 알려줄려면 써본 방법으로 하는 게 낫겠다 싶어서 이걸로 했음
오잉 마커 1개를 30번 tp시키는거보다 마커 30개를 30번 tp시키는게 최적화에 더 좋은 이유가 있을까?
그 아이템 설명 바꾸는 건 뭐냐? give로..
/give @s diamond[lore=['{"text":"줄 한 개 짜리 설명""italic":false"color":"gray"}']] /give @s diamond[lore=['{"text":"첫 번째 줄""italic":false"color":"gray"}''{"text":"두 번째 줄""color":"gray""italic":false}']] lore를 이용하면 되는데 이게 마소가 좀 이상하게 만들어놔서 두 줄 이상의 설명을 쓸려면 저따구로 해야 된다
고맙다!
그러면 특정 태그를 가진 몹이 죽었을 때 명령어를 작동시키는 명령어는 뭐냐?
고맙다 그리고 그 주민이 특정 물건을 사고 팔게 할 명령어 아나?
그건 mcstacker 이용하는 게 훨씬 편함 mcstacker.net 들어가서 /summon 누르고 Entity를 villager로 바꾼 뒤에 밑으로 내리면 Xp 밑에 Trades가 있음 그거 쓰면 된다 주의할 점은 maxUses에다가 좀 큰 수를 써야 된다
내가 미로를 봤는데 이 미로는 뒤로 가야 미로가 무한으로 반복되지 않고 앞으로 가면 미로가 무한으로 반복되는데 이 트릭도 시야를 감지해서 만드는 트릭이냐?
그럴 확률이 높지 키보드 입력 감지일려나..?
특정 태그를 가진 armor_stand 기준으로 x축 방향으로 앞에 엔티티가 있으면 그 엔티티까지의 거리를 반환하는 커맨드 있냐...?
아머스탠드의 x좌표에서 그 엔티티의 x좌표를 빼면 된다 /scoreboard objectives add distance dummy /scoreboard players set m1 distance -1 를 친 다음에 /execute store result score @n[tag=armorstand] distance run data get entity @n[tag=armorstand] Pos[0] 10 /execute store result score @n[tag=creeper] distance run data get entity @n[tag=creeper] Pos[0] 10 /scoreboard players operation @n[tag=armorstand] distance -= @n[tag=creeper
] distance /execute if score @n[tag=armorstand] distance matches ..-1 run scoreboard players operation @n[tag=armorstand] distance *= m1 distance /execute store result storage res ult float 0.1 run scoreboard players get @n[tag=armorstand] distance 순서대로 이걸 치면 저장소 res의 ult에 거리 값이 반환된다 참고로 아머스탠드의 distance 값은 거리에다가 10을 곱한 값임 아 그리고 "앞에 엔티티가 있으면"이라는 조건은 저 본문의 사진을 참고하면 되겠음
저장소에서 값은 어떻게 불러오냐...? 저장소 사용법을 몰라서
/execute store result score bo ard run data get storage res ult 스코어보드에다가 가져오기 /execute store result score bo ard run data get storage res ult 10 스코어보드에다가 10을 곱한 값을 가져오기 (스코어보드는 정수로 변환할 때 소숫점을 버리기 때문에 이렇게 하는 게 더 좋음) /execute store result entity @n[tag=asdf] Health float 1.0 run data get storage res ult 다른 엔티티의 데이터에다가 가져오기 그냥 가상의 엔티티 하나를 만들었다고 보면 된다
x-rotation y-rotation 으로는 만들 수 없냐
그건 고개를 어디로 돌렸나를 감지하는 거라서 저따가는 쓰지 못함
execute if score @ kill matches 10 run tellraw @a {"text":"테스트""color":"green"} 에서 @ 뒤에 뭘 붙여야할까?
/execute as @a if score @s kill matches 10 run ... 웬만해선 이렇게 쓰는 게 좋은데 1인용 맵이라면 그냥 /execute if score @p kill matches 10 run ... 이렇게 쓰면 된다 전자 : 어느 한 명이라도 조건을 만족시킨다면 해당 조건을 만족시킨 플레이어로서 뒤의 커맨드를 실행함 후자 : 가장 가까운 플레이어가 조건을 만족시킨다면 (커맨드 블럭이 직접) 뒤의 커맨드를 실행함
고맙다! 내가 맵을 처음 만들어봐서 execute 에 대해서 잘 몰랐노!
특정 위치에 가면 플레이어한테 스코어보드 안띄우고 랜덤으로 지정된 다섯 장소중 한 곳으로 보내고싶은데 어케해야함..? 아직 답해주는진 모르겠지만 일단 물어봄