Skocz do zawartości
  • 0

Skrypt na HP bloków


Xemi

Pytanie

Mógłby ktoś zrobić albo chociaż dać przykład jak zrobić coś takiego? Chodzi o to, aby blok np. stone miał 100hp. Jeżeli raz go zniszczymy kilofem to jego życie spadnie do 99 i informacja pokaże się na czacie. Tak samo gdy wybucha tnt to mogłoby zabierać 100hp. Da się coś takiego zrobić?

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/
Udostępnij na innych stronach

9 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
Gość ZiemniaQ
options:
	hp: 500
	mineDMG: 1
	tntDMG: 100

function addDamage(loc: location, dmg: integer) :: boolean
	if {hp::%{_loc}%} is not set:
		set {hp::%{_loc}%} to {@hp}
	add {_dmg} to {hp::%{_loc}%}
	if {hp::%{_loc}%} <= 0:
		return true
	else:
		return false

on break:
	if addDamage(location of event-block, {@mineDMG}) is false:
		cancel event
		send "HP: %{hp::%location of event-block%/{@hp}"

on explode:
	loop exploded blocks:
		if addDamage(location of loop-block, {@tntDMG}) is false:
			remove loop-block from exploded blocks

Wymagany Skript 2.2 oraz SkQuery

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218882
Udostępnij na innych stronach

  • 0
5 minut temu, LuckyPotato napisał:

options:
	hp: 500
	mineDMG: 1
	tntDMG: 100

function addDamage(loc: location, dmg: integer) :: boolean
	if {hp::%{_loc}%} is not set:
		set {hp::%{_loc}%} to {@hp}
	add {_dmg} to {hp::%{_loc}%}
	if {hp::%{_loc}%} <= 0:
		return true
	else:
		return false

on break:
	if addDamage(location of event-block, {@mineDMG}) is false:
		cancel event
		send "HP: %{hp::%location of event-block%/{@hp}"

on explode:
	loop exploded blocks:
		if addDamage(location of loop-block, {@tntDMG}) is false:
			remove loop-block from exploded blocks

Wymagany Skript 2.2 oraz SkQuery

nie dziala ;/

 

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218883
Udostępnij na innych stronach

  • 0
on left click on wood:
	cancel event
	if meta data value "block-hp" of clicked block is not set:
		set meta data value "block-hp" of clicked block to 10
	
	if meta data value "block_damage_cd" of player is not set:
		set {_now} to convert date now to unix date
		set meta data value "block_damage_cd" of player to {_now}

	

	set {_hp} to meta data value "block-hp" of clicked block
	
	set {_czas_gracz} to meta data value "block_damage_cd" of player
	set {_czas_gracz} to {_czas_gracz} parsed as number

	set {_aktualny_czas} to convert date now to unix date
	set {_aktualny_czas} to {_aktualny_czas} parsed as number

	if {_aktualny_czas} is bigger than {_czas_gracz}
		
		if {_hp} is bigger or equal to 1:
          remove 1 from {_hp}
          show an actionbar from "HP: %{_hp}%/10" to player
          set meta data value "block-hp" of clicked block to {_hp}

          set {_now} to now
          add 2 seconds to {_now}
          set {_now} to convert date {_now} to unix date

          set break stage animation of clicked block to {_hp}
		  if {_hp} is 0:
			set clicked block to air

 

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218885
Udostępnij na innych stronach

  • 0
3 godziny temu, MrJuliusz napisał:

on left click on wood:
	cancel event
	if meta data value "block-hp" of clicked block is not set:
		set meta data value "block-hp" of clicked block to 10
	
	if meta data value "block_damage_cd" of player is not set:
		set {_now} to convert date now to unix date
		set meta data value "block_damage_cd" of player to {_now}

	

	set {_hp} to meta data value "block-hp" of clicked block
	
	set {_czas_gracz} to meta data value "block_damage_cd" of player
	set {_czas_gracz} to {_czas_gracz} parsed as number

	set {_aktualny_czas} to convert date now to unix date
	set {_aktualny_czas} to {_aktualny_czas} parsed as number

	if {_aktualny_czas} is bigger than {_czas_gracz}
		
		if {_hp} is bigger or equal to 1:
          remove 1 from {_hp}
          show an actionbar from "HP: %{_hp}%/10" to player
          set meta data value "block-hp" of clicked block to {_hp}

          set {_now} to now
          add 2 seconds to {_now}
          set {_now} to convert date {_now} to unix date

          set break stage animation of clicked block to {_hp}
		  if {_hp} is 0:
			set clicked block to air

 

Rowniez nie dziala :(  

indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 23: remove 1 from {_hp}')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 24: show an actionbar from "HP: %{_hp}%/10" to player')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 25: set meta data value "block-hp" of clicked block to {_hp}')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 27: set {_now} to now')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 28: add 2 seconds to {_now}')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 29: set {_now} to convert date {_now} to unix date')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 31: set break stage animation of clicked block to {_hp}')
[20:33:49 ERROR]: indentation error: expected 2 tabs, but found 4 spaces (konsola.sk, line 32: if {_hp} is 0:')
[20:33:49 WARN]: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (konsola.sk, line 22: if {_hp} is bigger or equal to 1:')
[20:33:49 ERROR]: 'meta data value "block-hp"' is not a number (konsola.sk, line 3: if meta data value "block-hp" of clicked block is not set:')
[20:33:49 ERROR]: 'player' is not an item stack (konsola.sk, line 6: if meta data value "block_damage_cd" of player is not set:')
[20:33:49 ERROR]: 'meta data value "block-hp"' is not a number (konsola.sk, line 12: set {_hp} to meta data value "block-hp" of clicked block')
[20:33:49 ERROR]: 'player' is not an item stack (konsola.sk, line 14: set {_czas_gracz} to meta data value "block_damage_cd" of player')
[20:33:49 ERROR]: 'convert date now to unix date' is not an entity type (konsola.sk, line 17: set {_aktualny_czas} to convert date now to unix date')
[20:33:49 ERROR]: 'if {_aktualny_czas}' is not an entity type (konsola.sk, line 20: if {_aktualny_czas} is bigger than {_czas_gracz}')

 

Takie błędy
Edytowane przez HeezQ
HeezQ

Łączę + Usuwam formatowanie + Wrzucam w code

Notatka dodana przez HeezQ

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218890
Udostępnij na innych stronach

  • 0

Wiesz, mi nie działa lodówka w domu wiesz co się z nią stało? Jak mam ci pomóc jeżeli nie chcesz podać błędu ani jednego screena? 

 

Ehhh jak widzę takich typów to mnie nosi, Czytaj błędy a będziesz wiedział co zrobić, bezmyślne przepisywanie kodu jest największą głupotą. 

 

BŁĄD: indentation error: expected 2 tabs, but found 4 spaces

To znaczy że skrypt oczekuje w tej linijce 2 tabów a widzi spacje... Wystarczy wykazać minimum chęci nikt ci nie będzie myślał za ciebie przedewszystkim to twoje zadanie.

HeezQ

Łączę + poprawiam tekst dla ciemnego stylu

Notatka dodana przez HeezQ

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218892
Udostępnij na innych stronach

  • 0
3 godziny temu, MrJuliusz napisał:

Ehhh jak widzę takich typów to mnie nosi, Czytaj błędy a będziesz wiedział co zrobić, bezmyślne przepisywanie kodu jest największą głupotą. 

 

BŁĄD: indentation error: expected 2 tabs, but found 4 spaces

To znaczy że skrypt oczekuje w tej linijce 2 tabów a widzi spacje... Wystarczy wykazać minimum chęci nikt ci nie będzie myślał za ciebie przedewszystkim to twoje zadanie.

No własnie to robiłem 

 

 

Po ogarnieciu:  

[20:42:10 ERROR]: 'meta data value "block-hp"' is not a number (konsola.sk, line 3: if meta data value "block-hp" of clicked block is not set:')
[20:42:10 ERROR]: 'player' is not an item stack (konsola.sk, line 6: if meta data value "block_damage_cd" of player is not set:')
[20:42:10 ERROR]: 'meta data value "block-hp"' is not a number (konsola.sk, line 12: set {_hp} to meta data value "block-hp" of clicked block')
[20:42:10 ERROR]: 'player' is not an item stack (konsola.sk, line 14: set {_czas_gracz} to meta data value "block_damage_cd" of player')
[20:42:10 ERROR]: 'convert date now to unix date' is not an entity type (konsola.sk, line 17: set {_aktualny_czas} to convert date now to unix date')
[20:42:10 ERROR]: 'if {_aktualny_czas}' is not an entity type (konsola.sk, line 20: if {_aktualny_czas} is bigger than {_czas_gracz}')
[20:42:10 ERROR]: 'an actionbar from "HP: %{_hp}%/10"' is not an entity type (konsola.sk, line 24: show an actionbar from "HP: %{_hp}%/10" to player')
[20:42:10 ERROR]: 'meta data value "block-hp"' is not a number (konsola.sk, line 25: set meta data value "block-hp" of clicked block to {_hp}')
[20:42:10 ERROR]: 'convert date {_now} to unix date' is not an entity type (konsola.sk, line 29: set {_now} to convert date {_now} to unix date')
[20:42:10 ERROR]: 'break stage animation' is not a number (konsola.sk, line 31: set break stage animation of clicked block to {_hp}')

 

Edytowane przez HeezQ
HeezQ

Łączę + Wrzucam w code + Poprawiam cytat

Notatka dodana przez HeezQ

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218894
Udostępnij na innych stronach

  • 0

tak, mam

2 godziny temu, MrJuliusz napisał:

A masz dodatek Skellet oraz RandomSK?

Da rade coś z tego zrobić?

HeezQ

Łączę, następnym razem edytuj post i dopisuj, zamiast tworzenia następnego posta.

Notatka dodana przez HeezQ

Odnośnik do komentarza
https://skript.pl/temat/33991-skrypt-na-hp-blok%C3%B3w/#findComment-218900
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.

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

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