개인 자료란 (JE)

  서버 커뮤니티

Profile 데빌하트 대표칭호 없음

D3VILH4RRT a4b5e1bfdef74b93af06cbd3c8b3f76b

Profile

질문하기 스크립트

상점 스크립트를 만드는데 도와주세요!!

2023.11.11 조회 수 91 추천 수 0
이해도 입문자 
게임버전 (JE) 1.20.1 
게임버전 (BE) 관련없음 
스크립트 버전 2.7.2 

command /광부상점:

    trigger:

        open chest with 6 row named "&1&1광부상점" to player

        set {_slot} to 0

        loop 54 times:

            set slot {_slot} of current inventory of player to black stained glass pane

            add 1 to {_slot}

        set slot 10 of current inventory of player to coal with lore "&b구매가격 : 구매불가" and "&c판매가격 : 40원" and "&e좌클릭 구매/우클릭 판매"

        set slot 11 of current inventory of player to raw copper with lore "&b구매가격 : 구매불가" and "&c판매가격 : 50원" and "&e좌클릭 구매/우클릭 판매"

        set slot 12 of current inventory of player to copper ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"

        set slot 13 of current inventory of player to raw iron with lore "&b구매가격 : 구매불가" and "&c판매가격 : 100원" and "&e좌클릭 구매/우클릭 판매"

        set slot 14 of current inventory of player to iron ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 150원" and "&e좌클릭 구매/우클릭 판매"

        set slot 15 of current inventory of player to raw gold with lore "&b구매가격 : 구매불가" and "&c판매가격 : 250원" and "&e좌클릭 구매/우클릭 판매"

        set slot 16 of current inventory of player to gold ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 300원" and "&e좌클릭 구매/우클릭 판매"

        set slot 19 of current inventory of player to lapis lazuli with lore "&b구매가격 : 구매불가" and "&c판매가격 : 120원" and "&e좌클릭 구매/우클릭 판매"

        set slot 20 of current inventory of player to diamond with lore "&b구매가격 : 구매불가" and "&c판매가격 : 3000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 21 of current inventory of player to redstone with lore "&b구매가격 : 구매불가" and "&c판매가격 : 30원" and "&e좌클릭 구매/우클릭 판매"

        set slot 22 of current inventory of player to emerald with lore "&b구매가격 : 구매불가" and "&c판매가격 : 15000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 23 of current inventory of player to ancient debris with lore "&b구매가격 : 구매불가" and "&c판매가격 : 2000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 24 of current inventory of player to netherite ingot with lore "&b구매가격 : 구매불가" and "&c판매가격 : 10000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 25 of current inventory of player to coal block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 360원" and "&e좌클릭 구매/우클릭 판매"

        set slot 28 of current inventory of player to copper block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 900원" and "&e좌클릭 구매/우클릭 판매"

        set slot 29 of current inventory of player to iron block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 1350원" and "&e좌클릭 구매/우클릭 판매"

        set slot 30 of current inventory of player to gold block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 2700원" and "&e좌클릭 구매/우클릭 판매"

        set slot 31 of current inventory of player to diamond block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 27000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 32 of current inventory of player to emerald block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 135000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 33 of current inventory of player to redstone block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 750원" and "&e좌클릭 구매/우클릭 판매"

        set slot 34 of current inventory of player to lapis lazuli block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 1080원" and "&e좌클릭 구매/우클릭 판매"

        set slot 38 of current inventory of player to netherite block with lore "&b구매가격 : 구매불가" and "&c판매가격 : 90000원" and "&e좌클릭 구매/우클릭 판매"

        set slot 39 of current inventory of player to quartz with lore "&b구매가격 : 구매불가" and "&c판매가격 : 30원" and "&e좌클릭 구매/우클릭 판매"

        set slot 41 of current inventory of player to iron nugget with lore "&b구매가격 : 구매불가" and "&c판매가격 : 13원" and "&e좌클릭 구매/우클릭 판매"

        set slot 42 of current inventory of player to gold nugget with lore "&b구매가격 : 구매불가" and "&c판매가격 : 33원" and "&e좌클릭 구매/우클릭 판매"

on inventory click:

    if inventory name is "&1&1광부상점":

        cancel event

        if clicked item is black stained glass pane:

        else:

            if click type is right mouse button:

                if clicked raw slot is smaller than 54:

                    set {_lore} to uncolored line 2 of lore of clicked item

                    replace all "판매가격 " and ":" and " " and "원" with "" in {_lore}

                    set {_lore} to {_lore} parsed as integer

                    set {_item} to clicked item

                    delete lore of {_item}

                    if player has 1 of {_item}:

                        remove 1 of {_item} from player's inventory

                        add {_lore} to {%uuid of player%.돈}

                        play sound "entity.experience_orb.pickup" with volume 0.5 and pitch 3 to the player

                        if {_item} is not set:

                            set {_item} to "default_item"

                        set {_item_count} to 0

                        if {%uuid of player%.판매량::%{_item}%} is not set:

                            set {%uuid of player%.판매량::%{_item}%} to 0

                        add 1 to {%uuid of player%.판매량::%{_item}%}

                        set {_item_count} to {%uuid of player%.판매량::%{_item}%}

                        if {%uuid of player%.판매량::%{_item}%} is greater than 100:

                            set {_lore} to {_lore} * 0.95

                        else if {%uuid of player%.판매량::%{_item}%} is less than 50:

                            set {_lore} to {_lore} * 1.1

                    else:

                        send "&c현재 해당 아이템을 가지고 있지 않아 판매할 수 없습니다." to player

                        play sound "UI_BUTTON_CLICK" with volume 0.3 and pitch 3 to the player

            if click type is right mouse button with shift:

                if clicked raw slot is smaller than 54:

                    set {_lore} to uncolored line 2 of lore of clicked item

                    replace all "판매가격 " and ":" and " " and "원" with "" in {_lore}

                    set {_lore} to {_lore} parsed as integer

                    set {_item} to clicked item

                    delete lore of {_item}

                    if player has 64 of {_item}:

                        remove 64 of {_item} from player's inventory

                        add {_lore}*64 to {%uuid of player%.돈}

                        play sound "entity.experience_orb.pickup" with volume 0.5 and pitch 3 to the player

                        if {_item} is not set:

                            set {_item} to "default_item"

                        set {_item_count} to 0

                        if {%uuid of player%.판매량::%{_item}%} is not set:

                            set {%uuid of player%.판매량::%{_item}%} to 0

                        add 64 to {%uuid of player%.판매량::%{_item}%}

                        set {_item_count} to {%uuid of player%.판매량::%{_item}%}

                        if {%uuid of player%.판매량::%{_item}%} is greater than 100:

                            set {_lore} to {_lore} * 0.95

                        else if {%uuid of player%.판매량::%{_item}%} is less than 50:

                            set {_lore} to {_lore} * 1.1

                    else:

                        send "&c현재 해당 아이템을 가지고 있지 않아 판매할 수 없습니다." to player

                        play sound "UI_BUTTON_CLICK" with volume 0.3 and pitch 3 to the player

                        

상점에서 판매량 따라 시세가 상향 하양되게 되도록 만들어봤는데 코드는 에러가 없는데 제대로 작동하는지 모르겠네요






Warning
댓글이 없습니다.

새로운 댓글을 등록해 주세요!