Skocz do zawartości
  • 0

Pytanie/Problem


Kamil1xx
 Udostępnij

Pytanie

Witam napotkałem problem z zwierzaczkami mianowicie kod nizej dziala w 100% lecz je maly blad gdy moja postac zmienia swiat z "world" na np "nether" swinka zostaje na swiecie world i nie tepa sie za mną jak to naprawic?

KOD:

                while spawned pig is alive:
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick


 

Glicz

Wstawiam kod w code.

Notatka dodana przez Glicz

Odnośnik do komentarza
Udostępnij na innych stronach

16 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
W dniu 14.09.2021 o 16:56, Kamil1xx napisał:

Witam napotkałem problem z zwierzaczkami mianowicie kod nizej dziala w 100% lecz je maly blad gdy moja postac zmienia swiat z "world" na np "nether" swinka zostaje na swiecie world i nie tepa sie za mną jak to naprawic?

KOD:

                while spawned pig is alive:
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick


 

szczerze to nie jestem jakimś znawcą ale wydaje mi się ,że entity przypisane jest do jednego typu świata, ale mam rozwiązanie. Nie mam zamiaru teraz pisać systemu całego (Nawet przez to ,że nie podałeś całego kodu tylko jego część) tego skryptu ale mogę przedstawić ci coś co może doprowadzić cię do sukcesu.


To:

On Portal Enter

 Zarejestruj się lub zaloguj, aby zobaczyć ukrytą treść!
Patterns:
  • [on] portal enter[ing]
  • [on] entering [a] portal
Since: 1.0
Called when an entity enters a nether portal or an end portal. Please note that this event will be fired many times for a nether portal.

Examples:

on portal enter:


lub to jeżeli światów jest kilka a nie tylko "nether, zwykły i end":

On Player World Change

 Zarejestruj się lub zaloguj, aby zobaczyć ukrytą treść!
Patterns:
  • [on] [player] world chang(ing|e[d])
Since: 2.2-dev28
Called when a player enters a world. Does not work with other entities!

Examples:

on player world change:
    world is "city"
    send "Welcome to the City!"



Ja osobiście bym zrobił na zasadzie przypisania świni do świada i przy jego zmianie zabijał starego zwierzaka i respił nowego w nowym świecie :)

Edytowane przez polsatgraniepl
Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

To jest caly kod jak mam go naprawic aby dzialalo tepanie swinki gdy zmienie swiat?
 

KOD:
on rightclick with saddle:
    cancel event
    spawn pig at location of player
    set name of last spawned entity to "&cSwinka %player%"
    while spawned pig is alive:
        if distance between player and spawned pig is less than 10:
            if distance between player and spawned pig is bigger than 3:
                make spawned pig pathfind to location of player with speed 1.5
        else if distance between player and spawned pig is bigger than 10:
            teleport spawned pig to position of player
        wait 10 tick    

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
6 minut temu, Kamil1xx napisał:

To jest caly kod jak mam go naprawic aby dzialalo tepanie swinki gdy zmienie swiat?
 

KOD:
on rightclick with saddle:
    cancel event
    spawn pig at location of player
    set name of last spawned entity to "&cSwinka %player%"
    while spawned pig is alive:
        if distance between player and spawned pig is less than 10:
            if distance between player and spawned pig is bigger than 3:
                make spawned pig pathfind to location of player with speed 1.5
        else if distance between player and spawned pig is bigger than 10:
            teleport spawned pig to position of player
        wait 10 tick    

wpisz /sk info i podaj wszytko co ci się wyświetliło bo ja na swoim localhoście mam 10 błędów.....

EDIT:
A nie, przepraszam... Zwykłe tabowanie. A wyglądało na coś groźniejszego
unknown.png

Edytowane przez polsatgraniepl
Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

Czy to ma tak wyglądać:

KOD:
                while spawned pig is alive:
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if world of spawned pig = world of player:
                        teleport spawned pig to player
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick


Jezeli tak to przechodzenie z swiatow nie dziala i nie tepa swinki ;<

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
4 minuty temu, Kamil1xx napisał:

Czy to ma tak wyglądać:

KOD:
                while spawned pig is alive:
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if world of spawned pig = world of player:
                        teleport spawned pig to player
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick


Jezeli tak to przechodzenie z swiatow nie dziala i nie tepa swinki ;<

nie, nie tak to ma wyglądać, nie wiem dlaczego w ogóle kombinujesz po swojemu skoro dałem ci dokładny kod

ma to wyglądać tak (włącznie z wcięciami) - nie zmieniasz nic
 

while (...):
	mój kod
		mój kod
	reszta twojego kodu

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
5 minut temu, PanMaruda napisał:

nie, nie tak to ma wyglądać, nie wiem dlaczego w ogóle kombinujesz po swojemu skoro dałem ci dokładny kod

ma to wyglądać tak (włącznie z wcięciami) - nie zmieniasz nic
 

while (...):
	mój kod
		mój kod
	reszta twojego kodu

 

teraz to kompletnie nie działa wdg twojego typu:

 

on rightclick with saddle:
	cancel event
	spawn pig at location of player
	set name of last spawned entity to "&cSwinka %player%"
	while spawned pig is alive:
		if world of spawned pig != world of player:
			teleport spawned pig to player
			if distance between player and spawned pig is less than 10:
				if distance between player and spawned pig is bigger than 3:
					make spawned pig pathfind to location of player with speed 1.5
			else if distance between player and spawned pig is bigger than 10:
				teleport spawned pig to position of player
		wait 10 tick

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

                while spawned pig is alive:
                    if world of spawned pig = world of player:
                        teleport spawned pig to player
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick
 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0
5 minut temu, Kamil1xx napisał:

                while spawned pig is alive:
                    if world of spawned pig = world of player:
                        teleport spawned pig to player
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick
 

no dobrze, to teraz wytłumacz mi proszę dlaczego usunąłeś wykrzyknik sprzed znaku równości?

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

To jest mój pierwszy kod ktory dzialal w 90% gdy przechodzilem z swiatu jednego do drugiego swinka nie teleportowala sie.

KOD:
on rightclick with saddle:
    cancel event
    spawn pig at location of player
    set name of last spawned entity to "&cSwinka %player%"
    while spawned pig is alive:
        if distance between player and spawned pig is less than 10:
            if distance between player and spawned pig is bigger than 3:
                make spawned pig pathfind to location of player with speed 1.5
        else if distance between player and spawned pig is bigger than 10:
            teleport spawned pig to position of player
        wait 10 tick    

To jest koncowy kod ktory nadal nie dziala ten kod polecil mi kolega wyzej nie dziala wcale.

KOD:
on rightclick with saddle:
             cancel event
             spawn pig at location of player
             set name of last spawned entity to "&cSwinka %player%"
             while spawned pig is alive:
                    if world of spawned pig = world of player:
                        teleport spawned pig to player
                    if distance between player and spawned pig is less than 10:
                        if distance between player and spawned pig is bigger than 3:
                            make spawned pig pathfind to location of player with speed 1.5
                    else if distance between player and spawned pig is bigger than 10:
                        teleport spawned pig to position of player
                    wait 10 tick

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ę...