오늘은 마지막 남은 9개 무기를 완성시키겠습니다!
오늘도 소스 코드입니다
#킬백
on right click:
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 바라보는 적 뒤로 갑니다":
set {_cooldown} to difference between {킬백.%player%} and now
if {_cooldown} is less than 60 seconds:
set {_text} to "%difference between 60 seconds and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " and " with " " in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {킬백.%player%} to now
teleport player to block behind target player's location #플레이어가 타켓 플레이어에 블럭 뒤로 이동합니다
#Trace On
on damage of player:
if name of attacker's held item contains "&b&l[ &f&lTrace On &b&l]": #공격자에 들고있는 아이템에 해당 문자열이 포함되어 있다면
if held item of victim is not air: #피해자에 들고 있는 아이템이 공기가 아니라면
remove 1 of attacker's tool from attacker's inventory # 공격자에 무기 1개를 인벤토리에서 삭제시킵니다
set {_copy} to held item of victim #임시변수에 피해자에 들고있는 아이템을 담습니다
give {_copy} to attacker #담은 임시변수 아이템을 공격자에게 줍니다
send "{@r} %victim%님의 아이템을 복사하였습니다" to attacker
send "{@r} %attacker%님이 무기를 복사해갔습니다" to victim
else:
send "{@r} 상대방이 무기를 들고 있지 않습니다!" to attacker #피해자가 아무것도 들고있지 않는다면 해당 문구를 보여줍니다
stop #그대로 멈춘다
#Trace On무기는 1회성 아이템입니다 피해자가 무기를 들고있을 경우에만 사용이 가능합니다
#피해자가 무기를 들고있는 상태로 해당 아이템으로 타격시 피해자에 무기를 복사하는 기능입니다
21개 무기를 만들면서 쿨타임류 무기는 대부분 비슷합니다
그냥 우리가 원하는 능력 구문 한줄만 추가되는게 끝입니다
이번에도 간단한 무기입니다
#아마테라스
on right click:
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 바라보는 적을 붙태웁니다":
set {_cooldown} to difference between {아테.%player%} and now
if {_cooldown} is less than 60 seconds:
set {_text} to "%difference between 60 seconds and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " and " with " " in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {아테.%player%} to now
set fire to the target player #바라보는 플레이어를 불태웁니다
#토르
on right click:
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 바라보는 적에게 번개를 내려칩니다":
set {_cooldown} to difference between {토르.%player%} and now
if {_cooldown} is less than 60 seconds:
set {_text} to "%difference between 60 seconds and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " and " with " " in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {토르.%player%} to now
strike lightning at target player #바라보는 플레이어에게 번개를 내려칩니다
진짜 우리가 만들고자 하는 능력 구문 한줄씩만 추가되었습니다
여기서
set fire to the target player 뒤에 for 3 seocnds를 추가하면
3초동안 상대 플레이어를 불태웁니다
번개 구문도 마찬가지입니다
이번엔 재밌는 무기 입니다
#중력 시계
on right click:
if player is in world "random":
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 바라보는 적을 띄웁니다":
if {juncount.%player%} >= 3:
set {_cooldown} to difference between {중시.%player%} and now
if {_cooldown} is less than 60 seconds:
set {_text} to "%difference between 60 seconds and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " and " with " " in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {중시.%player%} to now
delete {juncount.%player%}
else:
push target player upwards at speed 1 #바라보는 플레이어를 1에 속도로 위쪽 방향으로 띄웁니다
add 1 to {juncount.%player%}
#중력 시계 무기는 앞에서 만든 CP9무기를 응용하여 만들었습니다
#3번이상 띄울시 쿨타임이 걸립니다
#지폭천성
on right click:
if player is in world "random":
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 주위에 모든 적들을 끌어당깁니다":
add players in radius 20 of player to {_천성::*} #이 무기를 사용한 플레이어 주위에 20칸 안에 있는 모든 플레이어들을 임시배열 변수에 담습니다
remove player from {_천성::*} #해당 무기 주인도 배열에 변수에 들어갔으니 다시 임시배열에서 제거합니다
send "{@r} 지폭천성에 효과로 끌려다닙니다" to {_천성::*} #임시배열에 있는 플레이어들에게 이 문구를 보여줍니다
set {_cooldown} to difference between {지폭.%player%} and now
if {_cooldown} is less than 2 minute:
set {_text} to "%difference between 2 minute and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " minute" with "분 " in {_text}
replace all " and " with "" in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {지폭.%player%} to now
loop 200 times: #200번 반복합니다
wait a tick # 1 tick 당 0.05초(지난 강좌 참고)
teleport {_천성::*} to location +2 horizontally forward player #임시배열에 있는 모든 플레이어들을 이 무기를 사용한 플레이어 앞쪽 2칸 방향으로 이동시킵니다
#이 작업을 200번 수행합니다
#해당 지폭천성 무기는 앞에서 만든 바이러스 무기를 응용하여 만들었습니다
# 0.05 x 200 = 10초동안 플레이어들을 끌고다닐 수 있습니다
대부분 앞에서 만든 무기를 응용하여 새롭게 다른 무기들로 구현할 수 있습니다
지폭천성에서 배열변수를 처음 사용하였는데 배열변수에 대해 알아봅시다
배열변수는 값을 여러개 담을 수 있는 변수입니다
배열변수 형태는 {변수명::*} 쓰입니다 변수명 뒤에 ::*가 붙습니다
배열 변수 명령어 | 기능 설명 |
set {변수명::*} to "a","b" set {변수명::*} to 1,2,3,4 and 5 |
배열변수에 a와 b를 추가합니다 즉 {변수명::1} = a , {변수명::2} =b 입니다 숫자도 추가할 수 있습니다 배열변수에 1,2,3,4 와 5를 추가합니다 |
add "a" to {변수명::*} add 1,2,3,4 and 5 to {변수명::*} |
배열변수에 a를 추가합니다 배열변수에 1,2,3,4 와 5를 추가합니다 |
remove "a" from {변수명::*} | 배열변수에서 a를 삭제합니다 |
send "%{변수명::*}%" | 배열변수 안에 모든 값을 봅니다 ( a와 b가 할당되어있으면 a and b로 출력됩니다) |
보통 배열변수는 상점이나 경매장 같은 시스템을 구현할때 많이 사용됩니다
앞에서 만든 지폭천성도 20칸 안에 있는 플레이어들을 모두 담기 위하여 배열 변수를 사용하였습니다
명령어는 일반 변수랑 똑같지만, 변수랑 다르게 값을 여러개 담을 수 있습니다
set {변수명::*} to "a","b","c" and "d"
loop {변수명::*}: #배열 변수에 크기 만큼 반복합니다
send "%loop-index% : %loop-value%"
#loop-index는 해당 배열변수에 할당된 값에 위치값
#loop-value는 해당 배열변수에 할당된 값
즉 1 : a {변수명::1} = a
2 : b {변수명::2} = b
3 : c {변수명::3} = c
4 : d {변수명::4} = d 로 출력됩니다
이런식으로 응용해서 사용할 수 있습니다
미러링만 새로운 구문입니다
#자석
on right click:
if player is in world "random":
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 바라보는 적을 끌어당깁니다":
set {_cooldown} to difference between {자석.%player%} and now
if {_cooldown} is less than 1 minute:
set {_text} to "%difference between 1 minute and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " minute" with "분 " in {_text}
replace all " and " with "" in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {자석.%player%} to now
teleport target player to location +2 horizontally forward player #바라보는 플레이어를 이 무기를 사용한 플레이어 앞쪽 2칸 방향으로 이동시킵니다
#미러링
on death of player: #플레이어가 죽을때 작동되는 이벤트
loop all items in victim's inventory: #피해자에 인벤토리에 모든 아이템을 반복시킵니다
if name of loop-item contains "&b&l[ &f&l미러링 &b&l]": #아이템을 반복시키면서 해당 이름에 아이템이 포함되어있다면
remove loop-item from drops # 그 아이템을 피해자 인벤토리에서 제거합니다
send "{@r} 미러링 효과로 당신은 죽습니다" to attacker
send "{@r} 미러링 효과를 발휘했습니다." to victim
make attacker run cmd "/kill %attacker%" as op #그리고 피해자를 죽인 공격자는 자동으로 kill 명령어를 입력하여 사망합니다
#미러링에서 자연사는 능력이 작동되지 않습니다
#미러링 아이템은 서버내에서 소지한 채로 사망할시 이 능력이 작동됩니다
마지막 무기인 소환술사 입니다
앞에서 만든 마이크 무기를 응용하여 새롭게 만들어 봤습니다
#소환술사
on right click:
if player is in world "random":
if "%lore of player's tool%" contains "&e&l[&f&l설명&e&l] &f&l우클릭시 랜덤으로 플레이어를 소환합니다":
delete {소환목록.%player%::*} #소환목록 배열변수를 삭제합니다
set {_cooldown} to difference between {소술.%player%} and now
if {_cooldown} is less than 2 minute:
set {_text} to "%difference between 2 minute and {_cooldown}%"
replace all " seconds" and " second" with "초" in {_text}
replace all " minute" with "분 " in {_text}
replace all " and " with "" in {_text}
send "{@r} &f&l재사용 까지 &e&l%{_text}% &f&l남았습니다."
exit
set {소술.%player%} to now
loop all players in world "random": #random 맵안에 있는 모든 플레이어들을 반복시킵니다
add loop-player to {소환목록.%player%::*} #반복된 모든 플레이어들을 배열변수에 담습니다
remove player from {소환목록.%player%::*} #스킬을 사용한 플레이어만 배열변수에서 삭제합니다
set {_p} to random element out of {소환목록.%player%::*} #배열변수에서 랜덤으로 1명 뽑습니다
send "{@r} %{_p}%님을 랜덤으로 소환했습니다"
send "{@r} 당신은 소환술사 능력으로 소환 당하였습니다" to {_p}
teleport {_p} to player #랜덤으로 뽑은 사람은 능력을 사용한 플레이어로 이동합니다
지금까지 총 30개의 무기를 만들어봤습니다 (무기 밸런스는 서버에 맞게 수정하시면 됩니다)
이를 바탕으로 또 다른 무기를 만들어 가는 능력을 키우면 좋겠습니다
정말 고생많으셨습니다
다음 강좌에서는 시스템 부분 위주로 개발하겠습니다