개인 자료란 (JE)

  서버 커뮤니티

Profile 한양123 대표칭호 없음
Profile

질문하기 스크립트

무적이 되는 갑옷 스텟 스크립트 오류

2021.11.28 조회 수 209 추천 수 0
이해도 초보자(스크립트 구성요소나 기본문법은 알아요) 
게임버전 (JE) 1.17.1 
게임버전 (BE) 관련없음 
스크립트 버전 2.6 
스크립트 애드온 글에 파일 있음 

새 폴더.zip command /좀비갑옷:

    trigger:

        set {_염색.%player%} to 1 leather chestplate

        colour {_염색.%player%} (0, 161, 16)

        give {_염색.%player%} with no nbt named "&a좀비 흉갑" with lore "&4힘: &f+3" and "&c체력: &f+15 " and "&a방어력: &f+1" and "&b이동속도: &f+0.05" to player


        set {_염색.%player%} to 1 leather leggings

        colour {_염색.%player%} (0, 161, 16)

        give {_염색.%player%} with no nbt named "&a좀비 레깅스" with lore "&4힘: &f+3" and "&c체력: &f+5 " and "&a방어력: &f+3" and "&b이동속도: &f+0.05" to players


        set {_염색.%player%} to 1 leather boots

        colour {_염색.%player%} (0, 161, 16)

        give {_염색.%player%} with no nbt named "&a좀비 신발" with lore "&4힘: &f+3" and "&c체력: &f+5 " and "&a방어력: &f+1" and "&b이동속도: &f+0.5" to player


        give 1 zombie head with no nbt named "&a좀비 투구" with lore "&4힘: &f+10" and "&c체력: &f+5 " and "&a방어력: &f+1" and "&b이동속도: &f+0.05" to player


every 1 tick:

    loop all players:

        if loop-player's chestplate is not air:

            set {_lore::*} to uncolored lore of loop-player's chestplate

            loop {_lore::*}:

                if {_lore::%loop-index%} contains "힘":

                    set {_Strength} to "%{_lore::%loop-index%}%"

                    replace all "힘" and ":" and " " and "+" with "" in {_Strength}

                    set {chestplate::%loop-player%::Strength} to {_Strength} parsed as number


                if {_lore::%loop-index%} contains "체력":

                    set {_Health} to "%{_lore::%loop-index%}%"

                    replace all "체력" and ":" and " " and "+" with "" in {_Health}

                    set {chestplate::%loop-player%::Health} to {_Health} parsed as number


                if {_lore::%loop-index%} contains "방어력":

                    set {_Defense} to "%{_lore::%loop-index%}%"

                    replace all "방어력" and ":" and " " and "+" with "" in {_Defense}

                    set {chestplate::%loop-player%::Defense} to {_Defense} parsed as number


                if {_lore::%loop-index%} contains "이동속도":

                    set {_Speed} to "%{_lore::%loop-index%}%"

                    replace all "이동속도" and ":" and " " and "+" with "" in {_Speed}

                    set {chestplate::%loop-player%::Speed} to {_Speed} parsed as number


        else:

            delete {chestplate::%loop-player%::Strength}

            delete {chestplate::%loop-player%::Speed}

            delete {chestplate::%loop-player%::Defense}

            delete {chestplate::%loop-player%::health}


        if loop-player's leggings is not air:

            set {_lore::*} to uncolored lore of loop-player's leggings

            loop {_lore::*}:

                if {_lore::%loop-index%} contains "힘":

                    set {_Strength} to "%{_lore::%loop-index%}%"

                    replace all "힘" and ":" and " " and "+" with "" in {_Strength}

                    set {leggings::%loop-player%::Strength} to {_Strength} parsed as number


                if {_lore::%loop-index%} contains "체력":

                    set {_Health} to "%{_lore::%loop-index%}%"

                    replace all "체력" and ":" and " " and "+" with "" in {_Health}

                    set {leggings::%loop-player%::Health} to {_Health} parsed as number


                if {_lore::%loop-index%} contains "방어력":

                    set {_Defense} to "%{_lore::%loop-index%}%"

                    replace all "방어력" and ":" and " " and "+" with "" in {_Defense}

                    set {leggings::%loop-player%::Defense} to {_Defense} parsed as number


                if {_lore::%loop-index%} contains "이동속도":

                    set {_Speed} to "%{_lore::%loop-index%}%"

                    replace all "이동속도" and ":" and " " and "+" with "" in {_Speed}

                    set {leggings::%loop-player%::Speed} to {_Speed} parsed as number


        else:

            delete {leggings::%loop-player%::Strength}

            delete {leggings::%loop-player%::Speed}

            delete {leggings::%loop-player%::Defense}

            delete {leggings::%loop-player%::health}


        if loop-player's boots is not air:

            set {_lore::*} to uncolored lore of loop-player's boots

            loop {_lore::*}:

                if {_lore::%loop-index%} contains "힘":

                    set {_Strength} to "%{_lore::%loop-index%}%"

                    replace all "힘" and ":" and " " and "+" with "" in {_Strength}

                    set {boots::%loop-player%::Strength} to {_Strength} parsed as number


                if {_lore::%loop-index%} contains "체력":

                    set {_Health} to "%{_lore::%loop-index%}%"

                    replace all "체력" and ":" and " " and "+" with "" in {_Health}

                    set {boots::%loop-player%::Health} to {_Health} parsed as number


                if {_lore::%loop-index%} contains "방어력":

                    set {_Defense} to "%{_lore::%loop-index%}%"

                    replace all "방어력" and ":" and " " and "+" with "" in {_Defense}

                    set {boots::%loop-player%::Defense} to {_Defense} parsed as number


                if {_lore::%loop-index%} contains "이동속도":

                    set {_Speed} to "%{_lore::%loop-index%}%"

                    replace all "이동속도" and ":" and " " and "+" with "" in {_Speed}

                    set {boots::%loop-player%::Speed} to {_Speed} parsed as number


        else:

            delete {boots::%loop-player%::Strength}

            delete {boots::%loop-player%::Speed}

            delete {boots::%loop-player%::Defense}

            delete {boots::%loop-player%::health}


        if loop-player's helmet is not air:

            set {_lore::*} to uncolored lore of loop-player's helmet

            loop {_lore::*}:

                if {_lore::%loop-index%} contains "힘":

                    set {_Strength} to "%{_lore::%loop-index%}%"

                    replace all "힘" and ":" and " " and "+" with "" in {_Strength}

                    set {helmet::%loop-player%::Strength} to {_Strength} parsed as number


                if {_lore::%loop-index%} contains "체력":

                    set {_Health} to "%{_lore::%loop-index%}%"

                    replace all "체력" and ":" and " " and "+" with "" in {_Health}

                    set {helmet::%loop-player%::Health} to {_Health} parsed as number


                if {_lore::%loop-index%} contains "방어력":

                    set {_Defense} to "%{_lore::%loop-index%}%"

                    replace all "방어력" and ":" and " " and "+" with "" in {_Defense}

                    set {helmet::%loop-player%::Defense} to {_Defense} parsed as number


                if {_lore::%loop-index%} contains "이동속도":

                    set {_Speed} to "%{_lore::%loop-index%}%"

                    replace all "이동속도" and ":" and " " and "+" with "" in {_Speed}

                    set {helmet::%loop-player%::Speed} to {_Speed} parsed as number


        else:

            delete {helmet::%loop-player%::Strength}

            delete {helmet::%loop-player%::Speed}

            delete {helmet::%loop-player%::Defense}

            delete {helmet::%loop-player%::health}


every 1 tick:

    loop all players:

        set {Strength.%loop-player%} to {helmet::%loop-player%::Strength}+{chestplate::%loop-player%::Strength}+{leggings::%loop-player%::Strength}+{boots::%loop-player%::Strength}

        set {Defense.%loop-player%} to {helmet::%loop-player%::Defense}+{chestplate::%loop-player%::Defense}+{leggings::%loop-player%::Defense}+{boots::%loop-player%::Defense}

        set {Health.%loop-player%} to {helmet::%loop-player%::Health}+{chestplate::%loop-player%::Health}+{leggings::%loop-player%::Health}+{boots::%loop-player%::Health}

        set {Speed.%loop-player%} to ({helmet::%loop-player%::Speed}+{chestplate::%loop-player%::Speed}+{leggings::%loop-player%::Speed}+{boots::%loop-player%::Speed})

        set loop-player's max health to {Health.%loop-player%}+10


on damage:

    if attacker is player:

        if {Strength.%attacker%} is set:

            set damage to damage+({Strength.%attacker%})

    if victim is player:

        if {Defense.%victim%} is set:

            set damage to damage/({Defense.%victim%}+0.1)


        else:

            set damage to damage


every 1 tick:

    loop all players:

        if {Speed.%loop-player%} is set:

            add {Speed.%loop-player%} to walk speed of loop-player


every 1 tick:

    loop all players:

        if {helmet::%loop-player%::Speed} is not set:

            if {chestplate::%loop-player%::Speed} is not set:

                if {leggings::%loop-player%::Speed} is not set:

                    if {boots::%loop-player%::Speed} is not set:

                        reset walk speed of loop-player




command /방어력:

    trigger:

        message {Defense.%player%}


command /체력:

    trigger:

        message ({Health.%player%}+10)


command /힘:

    trigger:

        message {Strength.%player%}


command /속도:

    trigger:

        message {Speed.%player%}



어떤 문제인지 모르겠지만  처음엔 괜찮았다가 갑자기 무적이 됩니다. 스피곳이랑 페이퍼 계속 바꿔가면서 서버열어도 둘다 똑같습니다. 사용한 애드온은 모두 넣어놨습니다.

            





3개의 댓글

qsef1256
2021.11.29

논리 오류로 추정됩니다. 이렇게 긴 코드는 어디가 문제인지 즉시 분석해드릴 수는 없습니다. 돈 주시면 해드리겠지만, 이렇게 긴 코드는 분석에 시간이 좀 걸립니다, 그리고 전 바빠요.


문제가 있다고 의심되는 부분의 값을 broadcast 명령어로 띄워보세요. 그게 어디에 문제가 생겼는지 파악하는 디버깅의 시작 점이 될 것입니다.

한양123
2021.11.29
@qsef1256

on damage:

 

if attacker is player:

 

if {Strength.%attacker%} is set:

 

set damage to damage+({Strength.%attacker%})

 

if victim is player:

 

if {Defense.%victim%} is set:

 

set damage to damage/({Defense.%victim%}+0.1)

지금 가장 의심되는 구문인데 방어력이 설정되고 다시 방어력이 줄어들어도 그대로 유지가 됩니다. 방어력 값이 0이라 표시되지만 적용된 방어력은 전에 적용됬던 방어력으로 적용되는것 같은데 고칠 방법을 도저히 모르겠습니다

 

qsef1256
2021.12.04
@한양123

그러면 방어력을 적용하는 구문을 살펴보셔야죠. 제대로 방어력이 적용이 안되어서 발생하는 문제로 보여요.

뉴스 및 창작물
/files/thumbnails/761/908/003/262x150.crop.jpg?20241025153749

건축

서울 숭례문(崇禮門) 4

KHC

2024-10-25

2

/files/thumbnails/578/899/003/262x150.crop.jpg?20241010142350

건축

경주 월정교 1

KHC

2024-10-10

2

/files/thumbnails/219/899/003/262x150.crop.jpg?20241009200950

건축

송전탑+도시 2

dbasd12

2024-10-09

2

/files/thumbnails/246/898/003/262x150.crop.jpg?20241008102328

레드스톤

단다단 - 오토노케(オトノケ) | 마인크래프트 노트블럭 커버

노트블럭전문가

2024-10-08

1

/files/thumbnails/348/896/003/262x150.crop.jpg?20241006103035

디도스/봇테러등등을 낚는 방법 4

물귀신

2024-10-06

3