일상일지

[마인크래프트 스크립트] - 러시안룰렛 스크립트 본문

개발/마인크래프트

[마인크래프트 스크립트] - 러시안룰렛 스크립트

서호Seoho 2021. 1. 21. 20:23
반응형

캣서버 1.12.2 기준으로 제작되었습니다

 

기능 : region이라는 지역 내에 있는 버튼을 누를 시, 3초 뒤 knife에 있는 사람 중 한명이 랜덤으로 죽는다.

 

 

필수 조건 : 월드가드, 월드에딧

지역 : knife : 랜덤으로 사람이 죽을 공간

        region : 버튼을 누르는 공간. 운영진을 위한 공간으로 안전이 보장됨.

 

 

** 버튼을 op가 없는 일반 플레이어가 누르게 하고 싶으면,

/rg flag region build allow

 

 

 - op 전용 명령어

/러시안룰렛 시작 : 러시안룰렛 버튼을 이용하기 전에 치는 명령. 이용자들이 함부로 버튼을 눌러 명령어를 실행하지 않도록

/러시안룰렛 끝 : 러시안룰렛 게임이 끝나면 치는 명령.

 

 

 

 

function r_message(s : string):
	loop all players:
		if loop-player is in region "knife":
			message {_s} to loop-player

command /러시안룰렛 [<string>]:
	trigger:
		if player is op:
			if arg 1 is "시작":
				set {roulette} to true
				message "러시안룰렛이 작동합니다." to player
			if arg 1 is "끝":
				set {roulette} to false
				message "러시안룰렛을 끝냅니다." to player
		if arg 1 is not set:
			delete {러시안룰렛::*}
			loop all players:
				if loop-player is in region "knife":
					if loop-player is in region "rusian":
						message "당신은 안전 범위에 있습니다." to loop-player
					else:
						add loop-player to {러시안룰렛::*}
						add 1 to {_temp}
			set {_kill} to random integer between 1 and {_temp}
			loop all players:
				if loop-player is in region "knife":
					message "러시안 룰렛 당첨! %{러시안룰렛::%{_kill}%}%" to loop-player
			console command "kill %{러시안룰렛::%{_kill}%}%"
			
on right click:
	if event-block is stone button:
		if event-block is in "rusian":
			if {roulette} is true:
				r_message("러시안룰렛이 작동합니다!")
				wait 1 seconds
				r_message(".")
				wait 1 seconds
				r_message(".")
				wait 1 seconds
				r_message(".")
				wait 1 seconds
				console command "러시안룰렛"
			else:
				message "러시안룰렛을 작동시켜주세요." to player

 

 

 

 

반응형
Comments