개인 자료란 (JE)

  서버 커뮤니티

Profile 마린잉엥 대표칭호 없음
Profile

질문하기 스크립트

두더지잡기 최신판을 구현중 질문입니다.

2020.10.24 조회 수 192 추천 수 0
이해도 1.16 

요즘 스크립트 보는 게 너무 좋아서 공부도 할 겸 

아이디어를 더하고 더해서 좋은 스크립트가 나올 수 있게 노력하고 있습니다.

Gui로 간단하게 두더지 잡기 게임을 구현할 수 있지만, 너무 실감이 안나서

블럭 실화형 두더지게임을 구현하려고 합니다.


[전체 스크립트] 입니다.

options:

    두더지: &6&l<두더지>&f

command /두더지잡기 [<text>] [<integer>] [<integer>]:

    trigger:

        player is op

        if arg 1 is not set:

            send "{@두더지} /두더지잡기 도구"

            send "{@두더지} /두더지잡기 구역설정"

            send "{@두더지} /두더지잡기 표지판설정"

            send "{@두더지} /두더지잡기 보상설정 [마리] - N마리의 두더지를 잡을 시 들고 있는 아이템을 줍니다."

            send "{@두더지} /두더지잡기 설정 [마리] [틱] - 게임의 난이도를 설정합니다."

        if arg 1 is "보상설정":

            if arg 2 is not set:

                send "{@두더지} /두더지잡기 보상설정 [마리] - N마리의 두더지를 잡을 시 들고 있는 아이템을 줍니다."

                stop

            if held item is air:

                send "{@두더지} 아이템을 들어 주세요."

                stop

            if {mc.mole} is not set:

                send "{@두더지} 게임이 설정되어 있지 않습니다"

                stop

            if {mc.mole} < arg 2:

                send "{@두더지} 게임에 나오는 두더지 수보다 보상에 필요한 두더지 수가 더 많습니다."

                stop

            set {mc.prize} to held item

            set {mc.prizei} to arg 2

            send "{@두더지} %arg 2%마리의 두더지를 잡으며 들고 있는 아이템을 주게 설정하였습니다."

            stop

        if arg 1 is "설정":

            if arg 3 is not set:

                send "{@두더지} /두더지잡기 설정 [마리] [틱] - 게임의 난이도를 설정합니다."

                stop

            set {mc.mole} to arg 2

            set {mc.tick} to arg 3

            send "{@두더지} %arg 2%마리의 두더지가 나오게 설정하였습니다."

            stop

        if arg 1 is "도구":

            give stick named "{@두더지} 막대기" to player

            stop

        if arg 1 is "구역설정":

            if {mc.pos1::%player%} is not set:

                send "{@두더지} 위치 1이 설정되어 있지 않습니다."

                stop

            if {mc.pos2::%player%} is not set:

                send "{@두더지} 위치 2가 설정되어 있지 않습니다."

                stop

            set {mc.pos1} to {mc.pos1::%player%}

            set {mc.pos2} to {mc.pos2::%player%}

            send "{@두더지} 구역이 설정되었습니다."

        if arg 1 is "표지판설정":

            if targeted block is not sign:

                send "{@두더지} 보고 있는 블럭이 표지판이 아닙니다."

                stop

            set {mc.sign} to targeted block

            send "{@두더지} 표지판을 설정하였습니다."

            stop

on leftclick:

    player is op

    if held item's name is "{@두더지} 막대기":

        cancel event

        set {mc.pos1::%player%} to event-block

        send "{@두더지} 위치1이 설정되었습니다."

        stop

on rightclick:

    player is op

    if held item's name is "{@두더지} 막대기":

        cancel event

        set {mc.pos2::%player%} to event-block

        send "{@두더지} 위치2가 설정되었습니다."

        stop

on skript start:

    delete {mc.stats}

    delete {mc.point}

on rightclick on sign:

    if event-block's location is {mc.sign}'s location:

        if {mc.stats} is set:

            send "{@두더지} %{mc.stats}%님이 게임을 진행 중입니다."

            stop

        set {mc.stats} to player

        send "{@두더지} 두더지 깨우는 중..."

        loop blocks within {mc.pos1} to {mc.pos2}:

            wait 10 tick

            set loop-block to white wool

        set {_pl} to player's level

        set {_pp} to player's level progress

        loop 3 times:

            send "{@두더지} %4-loop-number%초 후 시작합니다."

            set player's level to 4-loop-number

            loop 10 times:

                set player's level progress to (100-(loop-number-2)*10)/100

                wait 2 tick

        set player's level to {_pl}

        set player's level progress to {_pp}

        loop blocks within {mc.pos1} to {mc.pos2}:

            wait 10 tick

            set loop-block to flower pot

        set {_time} to {mc.mole}

        set {_loc::*} to blocks within {mc.pos1} to {mc.pos2}

        while {mc.stats} is set:

            set {_r} to random integer between 0.9 and size of {_loc::*}

            set {_bl} to {_loc::%{_r}%}

            set block at {_bl}'s location to flower pot with cactus

            remove 1 from {_time}

            if {_time} is 0:

                delete {mc.stats}

            set {_tick} to 0

            while block at {_bl}'s location is flower pot with cactus:

                add 1 to {_tick}

                if {_tick} is {mc.tick}:

                    set block at {_bl}'s location to flower pot

                    send "{@두더지} 푸풉! 그걸 못 잡냐!"

                    spawn 10 of particle spell offset by 0, 0, 0 at {_bl}'s location

                wait 1 tick

            set block at {_bl}'s location to flower pot

            wait 1 tick

        send "{@두더지} 두더지 %{mc.mole}%마리 중에 %{mc.point}%마리의 두더지를 잡음."

        if {mc.point} >= {mc.prizei}:

            give {mc.prize} to player

            send "{@두더지} 두더지를 %{mc.prizei}%마리이상 잡아 보상이 지급되었습니다."

        delete {mc.point}

on quit:

    if {mc.stats} is player:

        delete {mc.stats}

        delete {mc.point}

on leftclick:

    {mc.stats} is player

    event-block is flower pot with cactus

    loop blocks within {mc.pos1} to {mc.pos2}:

        event-block is loop-block

        cancel event

        spawn 10 of particle red dust offset by 0, 0, 0 at event-block's location

        set event-block to flower pot

        play chicken egg pop at event-block with pitch 0.8

        add 1 to {mc.point}

        send "{@두더지} 으아앙 잡혀버렸당.."

        stop


[ 오류가 나는 부분은 우선, 크게 3가지 ]

1. loop-block 이 돌아가여 하얀 양털을 설치하는 부분 

2. 화분 및 선인장이 무적이 되는 부분 

3. 닭 사운드 효과


[log입니다]

[1]

 [Server thread/ERROR]: Can't understand this condition/effect: loop blocks within {mc.pos1} to {mc.pos2} (두더지잡기.sk, line 81: loop blocks within {mc.pos1} to {mc.pos2}')

 [2]

[Server thread/ERROR]: There's no loop that matches 'loop-block' (두더지잡기.sk, line 83: set loop-block to white wool')

[3]

 [Server thread/ERROR]: Can't understand this condition/effect: loop blocks within {mc.pos1} to {mc.pos2} (두더지잡기.sk, line 94: loop blocks within {mc.pos1} to {mc.pos2}')

[4]

 [Server thread/ERROR]: There's no loop that matches 'loop-block' (두더지잡기.sk, line 96: set loop-block to flower pot')

[5] 

[Server thread/ERROR]: {_loc::*} can't be set to 'blocks within {mc.pos1} to {mc.pos2}' because the latter is not an object (두더지잡기.sk, line 98: set {_loc::*} to blocks within {mc.pos1} to {mc.pos2}')

[6] 

[Server thread/ERROR]: Can't understand this condition/effect: spawn 10 of particle spell offset by 0, 0, 0 at {_bl}'s location (두더지잡기.sk, line 112: spawn 10 of particle spell offset by 0, 0, 0 at {_bl}'s location')

[7] 

[Server thread/ERROR]: Can't understand this loop: 'loop blocks within {mc.pos1} to {mc.pos2}' (두더지잡기.sk, line 128: loop blocks within {mc.pos1} to {mc.pos2}:')

[8]

play chicken egg pop at event-block with pitch 0.8


[오류 수정했지만 오류..]

[ 1~5, 7 구문 ]

변수 {mc.pos1} 와 {mc.pos2} 사이를 두더지막대기로 지정하고

 이 변수 사각형 전체 범위 변수 를 루프 블럭으로 탐색하여 

화분 그리고 하얀색 양털을 루프블럭 부분에 설치하는 건데 아에 작동이 안됩니다. 

전치사 between {변수} and {변수} 를 써서 바꾸면 작동하긴 하는데 범위가 아니라 변수를 포함하여 사이만 바뀌게 되네요ㅠㅠ


within ~ to 라는 부분이 전혀 작동하지 않는 거 같습니다.  

4874d6b0a58ea1fa8b4fd36692065ece.PNG 

제가 원하는 부분은 이 사각형 부분입니다. 


[6]

spawn 10 of particle spell offset by 0, 0, 0 at {_bl}'s location

이 스폰 파티클 구문은 두더지 잡기할 때 랜덤으로 화분에 선인장이 생성되어 바뀌는 부분을 

유저가 때리면 화분이나 선인장이 깨져서 드롭되거나 또는 화분 안에 꽃을 꽂아서 아이템 형태가 변해버리면 안되기에 

범위를 변수로 지정해서 무적이 되게 파티클을 설정한건데  

 이거 역시도 작동을 하지 않네요


[8]

play chicken egg pop at event-block with pitch 0.8

전치사 between and 를 써서 일단 작동하게 하고 선인장을 때리면 계란 효과음이 들려야 되는데

제 마크가 오류인건지 구문이 오류인건지 효과음이 들리지 않습니다.






1개의 댓글

스크립터브혼
2020.10.24

[1~5, 7]
[Blocks]의 패턴을 보면 within ~ and ~ 입니다.

 

[6]

스크립트의 파티클 이펙트를 지원하지 않습니다. [Potion Effects]는 있습니다.
애드온이 필요한 코드인것 같은데,
https://skripthub.net/docs/ 이곳에서 particle을 검색하시고 글자찾기(Ctrl+F)로 offset을 찾아서
맞는 애드온이 무엇인지 확인해보시기 바랍니다.

 

[8]
[Play Sound]이펙트 확인바랍니다.
사용하신 코드도 6번과 같이 애드온이 필요한 코드 같습니다.
스크립트 기본 이펙트로 충분히 구현 가능합니다.

뉴스 및 창작물
/files/thumbnails/115/774/003/262x150.crop.jpg?20240424234825

업데이트

마인크래프트 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

/files/thumbnails/932/765/003/262x150.crop.jpg?20240410124459

레드스톤

마인크래프트 노트블록으로 만든 『 밤양갱 (Bam Yang Gang) 』

노트블럭전문가

2024-04-10

0