Skocz do zawartości
  • 0

random tp


pawel1232

Pytanie

on right click with stone button:
	block behind is sponge:
		set {_x} to random integer from -3000 to 3000
		set {_z} to random integer from -300 to 3000
		set {_xyz} to the location at {_x}, 256, {_z}
		teleport player to {_xyz}
		wait 1 tick
		loop 256 times:
			if block under player is air:
				teleport player under player
				if block under player is water:
					cancel event
			else:
				send "&6Zostales przeteleportowany na koordynaty &2%location of player%"
				stop

Czemu cancel event nie może być zrobiony? nazwa błędu:  can not cancel an event anymore after is has already passed

Odnośnik do komentarza
https://skript.pl/temat/41161-random-tp/
Udostępnij na innych stronach

14 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
Teraz, pawel1232 napisał:

on right click with stone button:
	block behind is sponge:
		set {_x} to random integer from -3000 to 3000
		set {_z} to random integer from -300 to 3000
		set {_xyz} to the location at {_x}, 256, {_z}
		teleport player to {_xyz}
		wait 1 tick
		loop 256 times:
			if block under player is air:
				teleport player under player
				if block under player is water:
					cancel event
			else:
				send "&6Zostales przeteleportowany na koordynaty &2%location of player%"
				stop

Czemu cancel event nie może być zrobiony? nazwa błędu:  can not cancel an event anymore after is has already passed

Event może być wycofany jedynie po sprawdzaniu warunków. Nie możesz jak w twoim przypadku teleportować gracza i w dodatku czekać 1 tick.

Odnośnik do komentarza
https://skript.pl/temat/41161-random-tp/#findComment-257254
Udostępnij na innych stronach

  • 0
11 minut temu, pawel1232 napisał:

ok

on right click on stone button:
	if block east or block west or block north or block south of clicked block is sponge:
		set {_x} to random integer from -3000 to 3000
		set {_y} to random integer from 64 to 256
		set {_z} to random integer from -3000 to 3000
		set {_xyz} to location at {_x}, {_y}, {_z} in world "world"
		loop 256 times:
			if block under block at location at {_xyz} is air:
				remove 1 from y-loc of {_xyz}
			else:
				exit loop
				teleport player to {_xyz}
				send "&6Zostales przeteleportowany na koordynaty &7x: &e%x-loc of player%&7, y: &e%y-loc of player%&7, x: &e%z-loc of player%" to player

Sprawdź coś takiego.

Edytowane przez Kormic
Odnośnik do komentarza
https://skript.pl/temat/41161-random-tp/#findComment-257262
Udostępnij na innych stronach

  • 0
1 minutę temu, Kormic napisał:

on right click on stone button:
	if block behind targeted block is sponge:
		set {_x} to random integer from -3000 to 3000
		set {_y} to random integer from 64 to 256
		set {_z} to random integer from -3000 to 3000
		set {_xyz} to location at {_x}, {_y}, {_z} in world "world"
		loop 256 times:
			if block under block at location at {_xyz} is not air:
				remove 1 from y-loc of {_xyz}
			else:
				exit loop
				teleport player to {_xyz}
				send "&6Zostales przeteleportowany na koordynaty &7x: &e%x-loc of player%&7, y: &e%y-loc of player%&7, x: &e%z-loc of player%" to player

Sprawdź coś takiego.

błędów nie ma ale nie tepa wcale 

Odnośnik do komentarza
https://skript.pl/temat/41161-random-tp/#findComment-257264
Udostępnij na innych stronach

  • 0
6 godzin temu, pawel1232 napisał:

a dodasz jeszcze że gdy jest woda pod nogami to nie tepa ? 

Tak, ale daj chwilę.

 

6 godzin temu, pawel1232 napisał:

NIe działa

on right click:
	if targeted block is stone button:
		if block west or south or east or north clicked block is sponge:
			set {_x} to random integer from -3000 to 3000
			set {_y} to random integer from 64 to 256
			set {_z} to random integer from -3000 to 3000
			set {_xyz} to location at {_x}, {_y}, {_z} in world "world"
			loop 256 times:
				if block under block at location at {_xyz} is not air:
					remove 1 from y-loc of {_xyz}
				else:
					exit loop
					teleport player to {_xyz}
					send "&6Zostales przeteleportowany na koordynaty &7x: &e%x-loc of player%&7, y: &e%y-loc of player%&7, x: &e%z-loc of player%" to player

Zauważyłem, że Skript ma problem z rozpoznawaniem 'stone button', więc na twoim miejscu usunąłbym pierwszy od góry warunek i sprawdzał np. poprzez region.

EDIT:

Wpadłem na nieco lepszy pomysł, aby urozmaicić ten skrypt:

function randomizeCoordinates() :: location:
	set {_x} to random integer from -3000 to 3000
	set {_y} to random integer from 64 to 256
	set {_z} to random integer from -3000 to 3000
	set {_xyz} to location at {_x}, {_y}, {_z} in world "world"
	loop 256 times:
		if block under block at location at {_xyz} is not air:
			remove 1 from y-loc of {_xyz}
		else:
			exit loop
			while block under block at location at {_xyz} is water:
				set {_xyz} to randomizeCoordinates()
				wait 1 tick
	return {_xyz}
	
on right click:
	if targeted block is stone button:
		if block west or south or east or north clicked block is sponge:
			teleport player to randomizeCoordinates()
			send "&6Zostales przeteleportowany na koordynaty &7x: &e%x-loc of player%&7, y: &e%y-loc of player%&7, x: &e%z-loc of player%" to player

Pewnie nadal będzie problem z warunkiem z guzikiem, ale usuń w razie potrzeby i sprawdź jak działa skrypt.

xAxee

Łączę posty

Notatka dodana przez xAxee

Odnośnik do komentarza
https://skript.pl/temat/41161-random-tp/#findComment-257272
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.

×
×
  • Dodaj nową pozycję...