개인 자료란 (JE)

  서버 커뮤니티

Profile ysj5896 대표칭호 없음
Profile

질문하기 스크립트

오랜 시간 고민해도 이유를 모르겠네요..

2023.12.03 조회 수 51 추천 수 0
이해도 초보자 
게임버전 (JE) 1.19.3 
게임버전 (BE) 관련없음 

코드 자체는 오류 없이 잘 돌아갑니다. 상대방에게 데미지를 입힐 때 attacker의 공격력 만큼 데미지를 입히되 상대방의 방어력 만큼 먼저 깎고 데미지가 들어가게 싶은데, 실제 상대방이 맞았을 때 데미지 값 과 제가 때릴 때 데미지 값이 다르게 들어가네요 이유가 뭘까요..?

on damage:

    if victim is a player:

        #cancel event

        set damage to 0

        if {attack.%uuid of attacker%} > 0:

            set {_int} to random number between ({attack.%uuid of attacker%}/2) and {attack.%uuid of attacker%}

            set damage to {_int}

            if {defense.%uuid of victim%} < damage:

                set victim's health to (victim's health - (damage - {defense.%uuid of victim%}))

            else:

                set damage to random number between 0 and 0.25

                set victim's health to (victim's health - damage)

        else:

            set {_int} to random number between 0 and 0.25

            set damage to {_int}

            set victim's health to (victim's health - damage)

        bind hologram "&8&l[&a&l%victim's health% &8&l/ &a&l%victim's max health%&8&l]" to victim for 1 second offset by -0.2, 2.8, 0 

        bind hologram "&c&l-%damage%" to victim for 1 second offset by 0, 2.5, 0

2개의 댓글

신이난케빈이
2023.12.03

체력에서 깎게 하지 말고 add 데미지 값 to damage를 써보세여

 

ysj5896
2023.12.03
@신이난케빈이

어.. 근데 상대방이 입고 있는 방어구를 무시하고 데미지를 넣고 싶어서 저렇게 한거라..

뉴스 및 창작물
/files/thumbnails/576/775/003/262x150.crop.jpg?20240426232553

아티클

이달의 블록: 단단한 진흙

학교가기싫다

2024-04-26

0

/files/thumbnails/115/774/003/262x150.crop.jpg?20240428135129

업데이트

마인크래프트 1.20.5 정식 업데이트

학교가기싫다

2024-04-24

0

/files/thumbnails/762/770/003/262x150.crop.jpg?20240418073724

레드스톤

T.B.H (고민중독) | 노트블럭 버전 | NoteBlock Cover [한국어 영어 중국어 가사 추가]

노트블럭전문가

2024-04-18

0

/files/thumbnails/218/767/003/262x150.crop.jpg?20240412130213

레드스톤

우리의 꿈 - 원피스 오프닝

노트블럭전문가

2024-04-12

0

/files/thumbnails/505/766/003/262x150.crop.jpg?20240411122306

레드스톤

기동전사 건담 수성의 마녀 | 노트블럭 커버 1

노트블럭전문가

2024-04-11

1