Skocz do zawartości
  • 0

/bloki - prosba o przerobienie skryptu v2


SkrytyZiomus
 Udostępnij

Pytanie

function exchangeToBlocks(p: player, 1: item, 2: item):
	set {_n} to amount of {_1} in {_p}'s inventory
	if {_n} >= 9:
		set {_n} to rounded down {_n} / 9
		remove ({_n} * 9) of {_1} from {_p}'s inventory
		add {_n} of {_2} to {_p}
        
function exchangeToKox(p: player):
	set {_n} to amount of apples in {_p}'s inventory
	set {_n1} to amount of gold blocks in {_p}'s inventory
	while {_n} >= 1:
		if {_n1} < 8:
			stop
		remove 1 from {_n}
		remove 8 from {_n1}
		remove 1 apple from {_p}'s inventory
		remove 8 gold blocks from {_p}'s inventory
		if {_p} has enough space for 1 enchanted golden apple:
			give {_p} 1 enchanted golden apple
		else:
			drop 1 enchanted golden apple at {_p}

command /bloczki [<text>]:
	trigger:
		wait 5 tick
		open chest with 2 rows named "Bloki" to player
		set player's current inventory's slot 15 to enchanted golden apple named "&fTWORZENIE KOXA"
		set player's current inventory's slot 16 to golden apple named "&fTWORZENIE REFILA"
		set player's current inventory's slot 1 to diamond block named "&fTWORZENIE BLOKOW DIAMENTOW"
		set player's current inventory's slot 2 to emerald block named "&fTWORZENIE BLOKOW EMERALD"
        
on inventory click:
	inventory name of current inventory of player is "Bloki"
	cancel event
	if clicked slot is 1:
		exchangeToBlocks(player, diamond, diamond block)
	else if clicked slot is 2:
		exchangeToBlocks(player, emerald, emerald block)
	else if clicked slot is 15:
		exchangeToKox(player)
		if player doesn't have 1 apple and 8 gold block:
			send "Nie masz wszystkich przedmiotow."
		stop
	wait 1 tick

wszystko dziala ale chce jeszcze mozliwosc zrobienia refila na slocie 16. Ponadto nie chce by zamykalo sie gui gdy nacisne prawym na wolny slot/pole w gui.

Edytowane przez xAxee
xAxee

Poprawiam formatowanie

Notatka dodana przez xAxee

Odnośnik do komentarza
Udostępnij na innych stronach

2 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
function exchangeToBlocks(p: player, 1: item, 2: item):
	set {_n} to amount of {_1} in {_p}'s inventory
	if {_n} >= 9:
		set {_n} to rounded down {_n} / 9
		remove ({_n} * 9) of {_1} from {_p}'s inventory
		add {_n} of {_2} to {_p}
        
function exchangeToKox(p: player):
	set {_n} to amount of apples in {_p}'s inventory
	set {_n1} to amount of gold blocks in {_p}'s inventory
	while {_n} >= 1:
		if {_n1} < 8:
			stop
		remove 1 from {_n}
		remove 8 from {_n1}
		remove 1 apple from {_p}'s inventory
		remove 8 gold blocks from {_p}'s inventory
		if {_p} has enough space for 1 enchanted golden apple:
			give {_p} 1 enchanted golden apple
		else:
			drop 1 enchanted golden apple at {_p}
function exchangeToRefil(p: player):
	set {_n} to amount of apples in {_p}'s inventory
	set {_n1} to amount of gold ingot in {_p}'s inventory
	while {_n} >= 1:
		if {_n1} < 8:
			stop
		remove 1 from {_n}
		remove 8 from {_n1}
		remove 1 apple from {_p}'s inventory
		remove 8 of gold ingot from {_p}'s inventory
		if {_p} has enough space for 1 of golden apple:
			give {_p} golden apple
		else:
			drop golden apple at {_p}

command /bloczki [<text>]:
	trigger:
		wait 5 tick
		open chest with 2 rows named "Bloki" to player
		set player's current inventory's slot 15 to enchanted golden apple named "&fTWORZENIE KOXA"
		set player's current inventory's slot 16 to golden apple named "&fTWORZENIE REFILA"
		set player's current inventory's slot 1 to diamond block named "&fTWORZENIE BLOKOW DIAMENTOW"
		set player's current inventory's slot 2 to emerald block named "&fTWORZENIE BLOKOW EMERALD"
        
on inventory click:
	inventory name of current inventory of player is "Bloki"
	cancel event
	if clicked slot is 1:
		exchangeToBlocks(player, diamond, diamond block)
	else if clicked slot is 2:
		exchangeToBlocks(player, emerald, emerald block)
	else if clicked slot is 15:
		exchangeToKox(player)
		if player doesn't have 1 apple and 8 gold block:
			send "Nie masz wszystkich przedmiotow."
		stop
	else if clicked slot is 16:
		exchangeToRefil(player)
		if player doesn't have 1 apple and 8 gold ingot:
			send "Nie masz wszystkich przedmiotow."
		stop
	wait 1 tick

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
W dniu 22.11.2020 o 19:51, xAxee napisał:


function exchangeToBlocks(p: player, 1: item, 2: item):
	set {_n} to amount of {_1} in {_p}'s inventory
	if {_n} >= 9:
		set {_n} to rounded down {_n} / 9
		remove ({_n} * 9) of {_1} from {_p}'s inventory
		add {_n} of {_2} to {_p}
        
function exchangeToKox(p: player):
	set {_n} to amount of apples in {_p}'s inventory
	set {_n1} to amount of gold blocks in {_p}'s inventory
	while {_n} >= 1:
		if {_n1} < 8:
			stop
		remove 1 from {_n}
		remove 8 from {_n1}
		remove 1 apple from {_p}'s inventory
		remove 8 gold blocks from {_p}'s inventory
		if {_p} has enough space for 1 enchanted golden apple:
			give {_p} 1 enchanted golden apple
		else:
			drop 1 enchanted golden apple at {_p}
function exchangeToRefil(p: player):
	set {_n} to amount of apples in {_p}'s inventory
	set {_n1} to amount of gold ingot in {_p}'s inventory
	while {_n} >= 1:
		if {_n1} < 8:
			stop
		remove 1 from {_n}
		remove 8 from {_n1}
		remove 1 apple from {_p}'s inventory
		remove 8 of gold ingot from {_p}'s inventory
		if {_p} has enough space for 1 of golden apple:
			give {_p} golden apple
		else:
			drop golden apple at {_p}

command /bloczki [<text>]:
	trigger:
		wait 5 tick
		open chest with 2 rows named "Bloki" to player
		set player's current inventory's slot 15 to enchanted golden apple named "&fTWORZENIE KOXA"
		set player's current inventory's slot 16 to golden apple named "&fTWORZENIE REFILA"
		set player's current inventory's slot 1 to diamond block named "&fTWORZENIE BLOKOW DIAMENTOW"
		set player's current inventory's slot 2 to emerald block named "&fTWORZENIE BLOKOW EMERALD"
        
on inventory click:
	inventory name of current inventory of player is "Bloki"
	cancel event
	if clicked slot is 1:
		exchangeToBlocks(player, diamond, diamond block)
	else if clicked slot is 2:
		exchangeToBlocks(player, emerald, emerald block)
	else if clicked slot is 15:
		exchangeToKox(player)
		if player doesn't have 1 apple and 8 gold block:
			send "Nie masz wszystkich przedmiotow."
		stop
	else if clicked slot is 16:
		exchangeToRefil(player)
		if player doesn't have 1 apple and 8 gold ingot:
			send "Nie masz wszystkich przedmiotow."
		stop
	wait 1 tick

 

Moglbys mi jeszcze cos z tym zrobic, bo gdy zrobie koxy zamknie gui itd bo juz nie mam np. jablek ale jest dalej wiadomosc ze nie mam czegos cos nie moge tego zrobic ale kombinuje caly czas.

 

if clicked slot is 15:
			if player doesn't have 1 apple and 8 gold block:
				send "1"
			exchangeToKox(player)
			close player's inventory
			stop

 

Edytowane przez xNightPower_
Nieaktywny

Naprawiam formatowanie na ciemnym stylu.

Odnośnik do komentarza
Udostępnij na innych stronach

Dołącz do dyskusji

Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.

Nieaktywny
Odpowiedz na pytanie...

×   Wklejono zawartość z formatowaniem.   Usuń formatowanie

  Dozwolonych jest tylko 75 emoji.

×   Odnośnik został automatycznie osadzony.   Przywróć wyświetlanie jako odnośnik

×   Przywrócono poprzednią zawartość.   Wyczyść edytor

×   Nie możesz bezpośrednio wkleić grafiki. Dodaj lub załącz grafiki z adresu URL.

 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...