개인 자료란 (JE)

  서버 커뮤니티

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

질문하기 스크립트

마법사 지팡이 마법 스크립트 1

2020.11.03 조회 수 661 추천 수 0
이해도 1.16 
게임버전 (JE) 스피곳 
스크립트 애드온 2.5 

안녕하세요 

항상 한마포에 진심으로 감사합니다.

이제껏 질문드린 내용은 모두 100% 정확히 구현에 성공했습니다.


오늘은 마법사 지팡이를 구현해보고 싶어서 구현했는데

일부는 되고 일부는 안되서 질문드립니다. 

잘 부탁드립니다.


1. 몬스터 엔티티에 우클릭하면 포션 효과 주는 스크립트

 

on right click:

    if name of player's tool contains "&e위치탐지 지팡이&f(우클릭)":

        loop all entities in world of player:

            if the distance between the player and entity is smaller than 10:

                if the entity is not player:

                    play sound "entity.bee.sting" with volume 1 and pitch 1 at player for player

                    apply glowing 10 to the entity for 420 seconds

                    remove glowing from player


> 우클릭했을 때, 위치 탐지 지팡이라면/ 

엔티티에 420초 동안 발광 효과를 주고 플레이어도 같이 걸려서 플레이어는 삭제하는 스크립트입니다.

스크립트가 지저분해 보여도 작동은 잘되는 데요.. 문제는 장거리일 때도 지팡이를 쏠 때 적용이 되었으면 좋겠습니다.

비교를 하자면, 먼저 우클릭했을 때 천둥 치는 스크립트입니다.

on right click:

    if name of player's tool contains "&b벼락맞은 지팡이&a(우클릭)":

        set {savel} to location of targeted block

        strike lightning at {savel}

        make player damage target entity by 30


벼락 맞은 지팡이를 우클릭하면 타겟 블럭의 위치를 저장해서 그 곳에 천둥이 치는 원리인데 

장거리에서도 그 위치에 천둥이 내려서 아주 만족스러운 구현이 되었습니다.


하지만 포션 효과는 그게 안되서 난감하네요..

apply glowing 10 to the entity for 420 seconds 여기서 entity를 victim 이라고 하면 

앞에 피해를 주는 대상의 구문이 없어서 오류가 뜹니다.


완전 가까이 붙어서 우클릭해야지만 발광효과를 줄 수 있고 

멀리서는 작동도 안됩니다..


우클릭하면 천둥이 나가는 것처럼..

엔티티에게 멀리서도 발광효과를 쏠 수 있는 스크립트를 구현하고 싶습니다.

감이 잘 안오네요 .. ㅠㅠ







9개의 댓글

스크립터브혼
2020.11.03

먼거리 떨어진 공간의 엔티티들에게 발광효과를 주고 싶은 건가요?

비교를 하자면 원거리 광역스킬 같은...?

마린잉엥
2020.11.03
@스크립터브혼

네 맞습니다!

해당 효과는 가까이에 몹을 클릭해야만 적용이 됩니다

원거리 발광효과 스킬을 만들고 싶습니다.

정확합니다.

스크립터브혼
2020.11.03
@마린잉엥

작성하신 코드에서 수정을 하자면

> if the distance between the player and entity is smaller than 10:
이것은 플레이어와 엔티티 사이의 거리가 10보다 작은 경우이기 때문에 가까이 있는 엔티티에게 적용되는 것입니다.
이것을 클릭한 위치(targeted block)와 엔티티의 거리를 비교하는 것으로 수정하시면 됩니다.

좀 더 간단한 코드는 사용하신 [Entities]익스프레션의 패턴 중에 특정 위치에서 일정거리만큼의 엔티티를 지정하는 패턴이 있습니다.
Pattern> [(all [[of] the]|the)] %entity types% (within|[with]in radius) %number% [(block[s]|met(er|re)[s])] (of|around) %location%

Pattern> [(all [[of] the]|the)] entities of type[s] %entity types% in radius %number% (of|around) %location%

ex> entities in radius 10 around location at clicked block


한가지 더 팁을 드리자면, 리스트 변수에서 조건에 맞는 항목만 추려내는 [Filter]익스프레션이 있습니다.
리스트의 마지막에 ~ where [ input 컨디션 ] 형태로 쓰입니다.
대괄호의 input은 앞문장에 오는 주어값 입니다.

> entities in radius 10 around location at clicked block where [ input is not player ]
여기서 input은 앞문장의 entities입니다. 엔티티들 중에 플레이어가 아닌 엔티티만 남습니다.

마린잉엥
2020.11.03
@스크립터브혼

감사합니다.

근데 해보니까 장거리 포션효과 주는 건

entities in radius 10 around location at clicked block

이 부분에서만 계속 오류가 나오더라고요

클릭시 클릭한 엔티티가 어떤 엔티티인지를 인식하는 게 없어서

만들 수가 없는 것 같아요

 

그래서 on damage로 만들려고 합니다.

우클릭시 플레이어로부터 눈덩이가 발사되고

그 눈덩이에 맞은 엔티티가 발광효과를 가지게 하려는 아이디어가 생각났는데

눈덩이가 발사되게는 어떤 구문으로 만들 수 있을까요?

스크립터브혼
2020.11.04
@마린잉엥

clicked block은 클릭이 된 블럭이여서 그렇습니다. targeted block, targeted entity로 하면 크로스헤어가 가르키는 블록이나 엔티티가 잡힙니다.

마린잉엥
2020.11.04
@스크립터브혼

답변 감사합니다! 여기서

on right click:

 

if name of player's tool contains "&e위치탐지 지팡이&f(우클릭)":

 

loop all entities in world of player:

 

if entities in radius 10 around location at targerted entity:

play sound "entity.bee.sting" with volume 1 and pitch 1 at player for player

 

apply glowing 10 to the entity for 420 seconds

 

remove glowing from player

 

if대신 loop도 넣어보고 if the distance between the player and entity is smaller than 10:를 빼고

play sound "entity.bee.sting" with volume 1 and pitch 1 at player for player

 

entities in radius 10 around location at targeted block 을 그대로 써봐도

항상 이 부분에 can't understand condition 오류가 뜨네용...

 

스크립터브혼
2020.11.04
@마린잉엥
name of player's tool contains "&e위치탐지 지팡이&f(우클릭)"

loop entities in radius 10 around location at targeted entity where [ input is not player ]:

    if {_play_music_only_once} is not set:
        play sound "entity.bee.sting" with volume 1 and pitch 1 at player for player
        set {_play_music_only_once} to true

    apply glowing 10 to the entity for 420 seconds
@스크립터브혼

감사합니다. 

물약 효과는 투사체나 어떠한 이벤트가 있어야만 적용이 되는 거 아닌가요?

그대로 스크립트에 적용해서 실행을 해보니 자기 자신에게 발광 효과가 적용되고 

멀리있는 엔티티에게는 적용이 안되네요6279ff3fa2dfbfa185e280b34dddfce0.PNG


마린잉엥
2020.11.04
@스크립터브혼

해결되었습니다. 감사합니다!

 

on right click:

if name of player's tool contains "&e위치탐지 지팡이&f(우클릭)":

make player shoot a snowball at speed 5

play sound "entity.bee.sting" with volume 1 and pitch 1 at player for player

on damage:

if attacker is player:

if name of shooter's held item is "&e위치탐지 지팡이&f(우클릭)":

if event-projectile is a snowball:

apply potion of glowing 10 to victim for 420 seconds

 

 

뉴스 및 창작물
/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