Skocz do zawartości
  • 0

Villager wykonujący komendę.


Pytanie

Witajcie! Potrzebuję waszej pomocy. Nie potrafię prawie w ogóle pisać skryptów, więc zgłaszam się tutaj - do was.

Mianowicie robię serwer RealLife. Chce właśnie zrobić villagera, który sprzedaje dowód osobisty oraz prawo jazdy.

Chcę, by to działało w taki sposób, że przywołujemy villagera, którego się nie da bić i on się nie rusza. Gdy klikamy na niego PPM pojawia się taka jakby skrzynka z 9 slotami.

Teraz zaprezentuję, jak chciałbym, by to wyglądało.

 

Respimy villagera o nazwie "Urzędnik". Gdy na niego klikniemy PPM pojawia się taka jakby skrzynka z 9 slotami. Gdy klikniemy na książkę nazwaną "&6Dowod osobisty &9&k: &a<nick gracza> zabiera nam 50zł, i książkę z tą nazwą daje graczu do ekwipunku. Teraz jak mają być ustawione sloty:

1 slot - Szara szyba

2 slot - Szara szyba

3 slot - Szara szyba

4 slot - Szara szyba

5 slot - Dowód osobisty (z nazwą podaną wyżej)

6 slot - Szara szyba

7 slot - Szara szyba

8 slot - Szara szyba
9 slot - Szara szyba

 

Jeżeli chodzi o prawo jazdy - Respimy villagera również z nazwą "Urzędnik" tylko w innym miejscu. Tym razem on handluje prawem jazdy. Wszystko jest tak samo, jak w przypadku wcześniejszego villagera. Prawo jazdy to była by książka nazwana: "&ePrawo Jazdy &9&k: &f<Nick gracza>. Sloty są ustawione tak jak wcześniej. Prawo jazdy kosztowałoby 4000zł. 

 

Z góry dziękuję za wykonanie skryptu.

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/
Udostępnij na innych stronach

Rekomendowane odpowiedzi

  • 0

Niestety nie da sie zrobic tego z villagerami, przynajmniej w moim przypadku klikajac na villagera nic sie nie dzieje po mimo skryptu bez errorów.

By zadzialalo musisz pobrac plugin Citizens oraz Vault (chyba Vault)

By zrespic npc ktory bedzie sprzedawal prawo jazdy piszesz /npc create &bPrawo Jazdy / a zeby zrespic npc z dowodem piszesz /npc create &bDowod Osobisty

jesli blady lub cos zle dziala to pisac :D

options:
    KupDowod: /KupDowodZa 5.0
    KupPrawko: /KupPrawkoZa 4.000

on right click on player:
    name of clicked player is "&bDowod Osobisty":
        open chest with 1 row named "&bDowod Osobisty" to player
        wait 2 tick
        format slot 0 of player with 1 of gray stained glass pane to close
        format slot 1 of player with 1 of gray stained glass pane to close
        format slot 2 of player with 1 of gray stained glass pane to close
        format slot 3 of player with 1 of gray stained glass pane to close
        format slot 4 of player with 1 of book named "&6Dowod Osobisty &9&k: %player%" to close then run [make player execute command "{@KupDowod}"]
        format slot 5 of player with 1 of gray stained glass pane to close
        format slot 6 of player with 1 of gray stained glass pane to close
        format slot 7 of player with 1 of gray stained glass pane to close
        format slot 8 of player with 1 of gray stained glass pane to close
        
command /KupDowodZa [<text>]:
    trigger:
        if arg 1 is "5.0":
            if player's balance >= 50:
                give player 1 book named "&6Dowod Osobosty &9&k: &a%player%"
                remove 50 from player's balance
                send "&6Zakupiles Dowod osobisty za 50 zlotych!" 
            else:
                send "&4Nie masz pieniedzy!" to player
        if arg 1 is not set:
            send "&4Nie ma takiej komendy!"
            
command /KupPrawkoZa [<text>]:
    trigger:
        if arg 1 is "4.000":
            if player's balance >= 4000:
                give player 1 book named "&3Prawo Jazdy &9&k: &f%player%"
                remove 4000 from player's balance
                send "&6Zakupiles Prawo Jazdy za 4000 zlotych!" 
            else:
                send "&4Nie masz pieniedzy!" to player
        if arg 1 is not set:
            send "&4Nie ma takiej komendy!"
                
on right click on player:
    name of clicked player is "&bPrawo Jazdy":
        open chest with 1 row named "&bPrawo Jazdy" to player
        wait 2 tick
        format slot 0 of player with 1 of gray stained glass pane to close
        format slot 1 of player with 1 of gray stained glass pane to close
        format slot 2 of player with 1 of gray stained glass pane to close
        format slot 3 of player with 1 of gray stained glass pane to close
        format slot 4 of player with 1 of book named "&3Prawo Jazdy &9&k: &f%player%" to close then run [make player execute command "{@KupPrawko}"]
        format slot 5 of player with 1 of gray stained glass pane to close
        format slot 6 of player with 1 of gray stained glass pane to close
        format slot 7 of player with 1 of gray stained glass pane to close
        format slot 8 of player with 1 of gray stained glass pane to close

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171577
Udostępnij na innych stronach

  • 0

@Legal95 po co te argumenty? Gdy gracz ma nick a nie villager. Musisz się jeszcze wiele nauczyć.

on right click on entity:
	if name of clicked entity contains "&bDowod Osobisty":

Jeśli już chcesz coś takiego zrobić. 

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171582
Udostępnij na innych stronach

  • 0

@jaku49 przecież na początku mówie ,że villagerami nie da się zrobić.. pisze "Trzeba wgrać plugin Citizens" to chyba bedzie skrypt z npc z Citizensa.. 

Edytowane przez Legal95
Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171583
Udostępnij na innych stronach

  • 0

No tak, ale da się zrobić npc jako villager przez Citizens sam używałem takiego czegoś u siebie na serwerze. 

A u ciebie nic się nie dzieje bo coś źle napisałeś. villager = entity, gracz = player.

A argumenty w komendach są zbędne a sam kod można skrócić. Ale ten skrypt ma prawo działać po kilku poprawkach. 

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171584
Udostępnij na innych stronach

  • 0

ten skrypt jest pod NPC a nie pod Villagerów, źle zrozumiałeś :P 

bo chcialem zrobic go na podstawie zwyklych NPC (Graczy) a nie o Villagerach. :D 

Zaraz poszukam tego co mówiłeś o tych villagerach w Citizensie i sproboje przerobić.

 

Dobra poprawiłem, mam nadzieje ,ze jest w granicach tolerancji :D 

on right click on entity:
    name of clicked entity contain "&bDowod Osobisty":
        open chest with 1 row named "&bDowod Osobisty" to player
        wait 2 tick
        format slot 0 of player with 1 of gray stained glass pane to close
        format slot 1 of player with 1 of gray stained glass pane to close
        format slot 2 of player with 1 of gray stained glass pane to close
        format slot 3 of player with 1 of gray stained glass pane to close
        format slot 4 of player with 1 of book named "&6Dowod Osobisty &9&k: %player%" to close then run [make player execute command "/KupDowod"]
        format slot 5 of player with 1 of gray stained glass pane to close
        format slot 6 of player with 1 of gray stained glass pane to close
        format slot 7 of player with 1 of gray stained glass pane to close
        format slot 8 of player with 1 of gray stained glass pane to close
        
command /KupDowod:
    trigger:
        if player's balance >= 50:
            give player 1 book named "&6Dowod Osobosty &9&k: &a%player%"
            remove 50 from player's balance
            send "&6Zakupiles Dowod osobisty za 50 zlotych!" 
        else:
            send "&4Nie masz pieniedzy!" to player
            
command /KupPrawko:
    trigger:
        if player's balance >= 4000:
            give player 1 book named "&3Prawo Jazdy &9&k: &f%player%"
            remove 4000 from player's balance
            send "&6Zakupiles Prawo Jazdy za 4000 zlotych!" 
        else:
            send "&4Nie masz pieniedzy!" to player
                
on right click on entity:
    name of clicked entity contain "&bPrawo Jazdy":
        open chest with 1 row named "&bPrawo Jazdy" to player
        wait 2 tick
        format slot 0 of player with 1 of gray stained glass pane to close
        format slot 1 of player with 1 of gray stained glass pane to close
        format slot 2 of player with 1 of gray stained glass pane to close
        format slot 3 of player with 1 of gray stained glass pane to close
        format slot 4 of player with 1 of book named "&3Prawo Jazdy &9&k: &f%player%" to close then run [make player execute command "/KupPrawko"]
        format slot 5 of player with 1 of gray stained glass pane to close
        format slot 6 of player with 1 of gray stained glass pane to close
        format slot 7 of player with 1 of gray stained glass pane to close
        format slot 8 of player with 1 of gray stained glass pane to close

 

//Edit

Zeby stworzyc te entity to trzeba wpisac /npc create &bDowod Osobisty --type Villager i powinno dzialac :D

Edytowane przez Legal95
Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171585
Udostępnij na innych stronach

  • 0
Gość Usunięty#12968

command /npc [<text>]:
    trigger:
        if arg 1 is not set:
            send "&7>> &aPoprawne uzycie &c/npc <nazwa>"
        if arg 1 is set:
            spawn a villager 1 meters above the player
            set the name of spawned entity to arguments
            apply resistance 1000 to the spawned entity for 1000000000 seconds
            apply slowness 1000 to the spawned entity for 1000000000 seconds
on rightclick on villager:
    if name of clicked entity is "Dowod Osobisty":
        cancel event
        make player execute command "/zawod"
on damage of villager:
    name of victim entity is "Dowod Osobisty":
        cancel event

Tu masz na villagera a reszte sobie skopiuj od nich

Edytowane przez wygram13
Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171588
Udostępnij na innych stronach

  • 0

@wygram13

Tylko takiego villagera nie da sie usunac, trzeba dodac skrypt na usuniecie jego:

command /killvillagers:
    trigger:
        loop all villagers:
            kill loop-entity

 

Edytowane przez Legal95
Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171589
Udostępnij na innych stronach

  • 0

@polp223 próbowałeś wgrywać wersje 1.7.x? lub 1.8.8?

jesli masz DO wersji 1.8 to pobierz wersje 1.8 bo tez obsluguje 1.7 wiec tutaj:

https://dev.bukkit.org/projects/citizens/files/901556

a skrypt to taki musisz dac na serwer:

tworzysz NPC komenda /npc create &bDowod Osobisty --type villager lub /npc create &bPrawo Jazdy --type villager

on right click on entity:
    name of clicked entity contain "&bDowod Osobisty":
        open chest with 1 row named "&bDowod Osobisty" to player
        wait 2 tick
        format slot 0 of player with 1 of gray stained glass pane to close
        format slot 1 of player with 1 of gray stained glass pane to close
        format slot 2 of player with 1 of gray stained glass pane to close
        format slot 3 of player with 1 of gray stained glass pane to close
        format slot 4 of player with 1 of book named "&6Dowod Osobisty &9&k: %player%" to close then run [make player execute command "/KupDowod"]
        format slot 5 of player with 1 of gray stained glass pane to close
        format slot 6 of player with 1 of gray stained glass pane to close
        format slot 7 of player with 1 of gray stained glass pane to close
        format slot 8 of player with 1 of gray stained glass pane to close
        
command /KupDowod:
    trigger:
        if player's balance >= 50:
            give player 1 book named "&6Dowod Osobosty &9&k: &a%player%"
            remove 50 from player's balance
            send "&6Zakupiles Dowod osobisty za 50 zlotych!" 
        else:
            send "&4Nie masz pieniedzy!" to player
            
command /KupPrawko:
    trigger:
        if player's balance >= 4000:
            give player 1 book named "&3Prawo Jazdy &9&k: &f%player%"
            remove 4000 from player's balance
            send "&6Zakupiles Prawo Jazdy za 4000 zlotych!" 
        else:
            send "&4Nie masz pieniedzy!" to player
                
on right click on entity:
    name of clicked entity contain "&bPrawo Jazdy":
        open chest with 1 row named "&bPrawo Jazdy" to player
        wait 2 tick
        format slot 0 of player with 1 of gray stained glass pane to close
        format slot 1 of player with 1 of gray stained glass pane to close
        format slot 2 of player with 1 of gray stained glass pane to close
        format slot 3 of player with 1 of gray stained glass pane to close
        format slot 4 of player with 1 of book named "&3Prawo Jazdy &9&k: &f%player%" to close then run [make player execute command "/KupPrawko"]
        format slot 5 of player with 1 of gray stained glass pane to close
        format slot 6 of player with 1 of gray stained glass pane to close
        format slot 7 of player with 1 of gray stained glass pane to close
        format slot 8 of player with 1 of gray stained glass pane to close

 

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171643
Udostępnij na innych stronach

  • 0

@Legal95 Vaulta posiadam, jednak SKQuery nie. Za chwilkę pobiorę ;)

@Legal95 pobrałem i jest 0 błędów, natomiast villagera mi nie przywołuje po wpisaniu żadnej z tych komend, a gdy wpisuje "/npc" nawet nie pokazuje, jak mam to dokładnie wpisać.

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171649
Udostępnij na innych stronach

  • 0

@polp223 czyli plugin citizens nie jest kompatybilny :P nie wiem dokładnie jaką wersje bys musial pobrac by dzialala z tą twoją skoro masz 1.7-1.8 

co do komendy to nie mozesz przywolac jesli jest nie kompatybilny plugin z wersją MC

tak więc byś musiał albo poszukać wersji na swój serwer albo pobierać wszystkie od 1.7.X do 1.8.8 czy coś w tym stylu lub wyższe.

spróbuje także coś poszukać ale nie gwarantuje

@polp223 to świetnie :D

teraz możesz wpisać komendę, /npc create &bDowod Osobisty --type Villager i powinno działać jeśli na niego klikniesz prawym :D 

Odnośnik do komentarza
https://skript.pl/temat/25985-villager-wykonuj%C4%85cy-komend%C4%99/#findComment-171654
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

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