mnmn102030 21481da6061b41109425ca94be366a4d
게임버전 (JE) | 1.12.2 |
---|---|
게임버전 (BE) | 관련없음 |
command /방어구설정 [<integer>] [<integer>]:
trigger:
if player is op:
if arg-1 is not set:
message "&6/방어구설정 <방어력> <체력>"
else:
if player's tool is air:
message "&c손에 장비를 들어주세요."
else:
if arg-1 is not 0:
add "&3■방어력: %arg-1%" to lore of player's tool
if arg-2 is not 0:
add "&6■체력: %arg-2%" to lore of player's tool
every 1 second:
loop all players:
if loop-player's chestplate is not air:
set {_lore::*} to uncolored lore of loop-player's helmet
loop {_lore::*}:
if loop-value-1 contains "■체력:":
set {_lr} to loop-value-1
replace all "■체력: " and ":" and " " with "" in {_lr}
set {_lr} to {_lr} parsed as number
add {_lr} to {_hp}
set {_lore::*} to uncolored lore of loop-player's chestplate
loop {_lore::*}:
if loop-value-1 contains "■체력:":
set {_lr} to loop-value-1
replace all "■체력: " and ":" and " " with "" in {_lr}
set {_lr} to {_lr} parsed as number
add {_lr} to {_hp}
set {_lore::*} to uncolored lore of loop-player's leggings
loop {_lore::*}:
if loop-value-1 contains "■체력:":
set {_lr} to loop-value-1
replace all "■체력: " and ":" and " " with "" in {_lr}
set {_lr} to {_lr} parsed as number
add {_lr} to {_hp}
set {_lore::*} to uncolored lore of loop-player's boots
loop {_lore::*}:
if loop-value-1 contains "■체력:":
set {_lr} to loop-value-1
replace all "■체력: " and ":" and " " with "" in {_lr}
set {_lr} to {_lr} parsed as number
add {_lr} to {_hp}
every 1 tick:
loop all players:
set loop-player's max health to 10 + {_hp}*0.5
적용이 안되는 이유 좀 알려주세요.
코코냐
2022.08.19파싱한 값이 뭔지 확인해보세요.
qwesx
2022.08.19command /방어구설정 [] []:
trigger:
if player is op:
if arg-1 is not set:
message "&6/방어구설정 <방어력> <체력>"
else:
if player's tool is air:
message "&c손에 장비를 들어주세요."
else:
if arg-1 is not 0:
add "&3■방어력: %arg-1%" to lore of player's tool
if arg-2 is not 0:
add "&6■체력: %arg-2%" to lore of player's tool
every 1 second:
loop all players:
if loop-player's helmet is not air:
set {_lore::*} to uncolored lore of loop-player's helmet
loop {_lore::*}:
if loop-value-2 contains "■체력:":
set {_hp} to loop-value-2
replace all "■체력: " and ":" and " " with "" in {_hp}
set {_hp1} to {_hp} parsed as number
add {_hp1} to {hp4}
else:
delete {hp4}
every 1 second:
loop all players:
if loop-player's chestplate is not air:
set {_lore::*} to uncolored lore of loop-player's chestplate
loop {_lore::*}:
if loop-value-2 contains "■체력:":
set {_hp} to loop-value-2
replace all "■체력: " and ":" and " " with "" in {_hp}
set {_hp2} to {_hp} parsed as number
add {_hp2} to {hp3}
else:
delete {hp3}
every 1 second:
loop all players:
if loop-player's leggings is not air:
set {_lore::*} to uncolored lore of loop-player's leggings
loop {_lore::*}:
if loop-value-2 contains "■체력:":
set {_hp} to loop-value-2
replace all "■체력: " and ":" and " " with "" in {_hp}
set {_hp3} to {_hp} parsed as number
add {_hp3} to {hp2}
else:
delete {hp2}
every 1 second:
loop all players:
if loop-player's boots is not air:
set {_lore::*} to uncolored lore of loop-player's boots
loop {_lore::*}:
if loop-value-2 contains "■체력:":
set {_hp} to loop-value-2
replace all "■체력: " and ":" and " " with "" in {_hp}
set {_hp4} to {_hp} parsed as number
sdd {_hp4} to {hp1}
else:
delete {hp1}
이렇게 바꿨는데 체력이 계속 올라가는 이유을 아시나요?
qsef1256
2022.08.19줄 맞춰서 올리세요. 스크립트는 들여쓰기가 매우 중요한 거 모르시나요?
qsef1256
2022.08.19그리고 맨 밑에
sdd {_hp4} to {hp1}
해 놓은 건 뭐에요? 스크립트 돌아가긴 하나요?qsef1256
2022.08.19알겠네요, hp가 계속 올라가는 건 님 구문대로 잘 돌아가고 있어서 그래요.
님 코드를 잘 보세요.
add {_hp4} to {hp1}
잘 보이시죠? 1초마다 add를 하고 있는데 안 올라가면 그게 더 이상한 거 아니에요?qsef1256
2022.08.191. every 1 tick/second 쓰지 마세요. 이 구문은 특수한 경우가 아니면 하등 쓸 데가 없고 렉만 늘리는 구문입니다, 보통 다른 방법이 있어요.
2. {_hp} 는 지역 변수라 저장 안됩니다, 맨 밑의 every 1 tick에서는 없는 변수란 소립니다. 다른 언어 같으면 컴파일 단계에서 걸렸는데, 스크립트는 이거 경고를 안 해줍니다.
qwesx
2022.08.19every 1 tick/second 대신 뭘 사용해야 하나요?
qsef1256
2022.08.19이 경우에는 on armor equip/unequip 쓰는 게 맞습니다
qsef1256
2022.08.19그리고 on death도 확인하시는 게 좋겠네요