Skocz do zawartości
  • 0

Problem ze skryptem na ulepszanie HP


Notro

Pytanie

Siema. Mam problem, otóż napisałem taki skrypt na ulepszanie hp, chyba łatwo się domyślić jak to działa. Jestem dość nowy w tych wszystkich zmiennych itp., dlatego tego pewnie nie rozumiem... Otóż wczesniej, jak zmienna nazywała się po prostu {poz1} to wtedy jak rozumiem była serwerowa, no i wtedy nakładało efekt każdemu graczowi. Dlatego zmieniłem na {poz1::%player%} ale teraz po wpisaniu komendy nic sie nie dzieje, nikt nie otrzymuje efektu.

 

command /reset-ulepszenia-hp:
	trigger:
		set {poz1::%player%} to false
		set {poz2::%player%} to false
		set {poz3::%player%} to false


on join:
	if {poz1::%player%} is true:
		execute console command "effect give %player% minecraft:health_boost 1000000 0"
	if {poz2::%player%} is true:
		execute console command "effect give %player% minecraft:health_boost 1000000 1"
	if {poz3::%player%} is true:
		execute console command "effect give %player% minecraft:health_boost 1000000 2"
		
on drink of milk:
	if {poz1::%player%} is true:
		wait 2 tick
		execute console command "effect give %player% minecraft:health_boost 1000000 0"
	if {poz2::%player%} is true:
		wait 2 tick
		execute console command "effect give %player% minecraft:health_boost 1000000 1"
	if {poz3::%player%} is true:
		wait 2 tick
		execute console command "effect give %player% minecraft:health_boost 1000000 2"
		
on respawn:
	wait 2 tick
	if {poz1::%player%} is true:
		wait 2 tick
		execute console command "effect give %player% minecraft:health_boost 1000000 0"
	if {poz2::%player%} is true:
		wait 2 tick
		execute console command "effect give %player% minecraft:health_boost 1000000 1"
	if {poz3::%player%} is true:
		wait 2 tick
		execute console command "effect give %player% minecraft:health_boost 1000000 2"
	
		

command /ulepsz-hp [<player>] [<text>]:
	permission: ulepszanie.hp
	trigger:
		if arg 2 is "poz1":
			if {poz1::%player%} is false:
				set {poz1::%player%} to true
				send "cenzura &aUlepszono HP na Poziom 1!" to arg-1
				execute console command "effect give %arg 1% minecraft:health_boost 1000000 0"
			else if {poz1::%player%} is true:
				send "cenzura &cJuż to zakupiłeś!" to arg-1
		if arg 2 is "poz2":
			if {poz2::%player%} is false:
				set {poz2::%player%} to true
				send "cenzura &aUlepszono HP na Poziom 2!" to arg-1
				execute console command "effect give %arg 1% minecraft:health_boost 1000000 1"
			else if {poz2::%player%} is true:
				send "cenzura &cJuż to zakupiłeś!" to arg-1
		if arg 2 is "poz3":
			if {poz3::%player%} is false:
				set {poz3::%player%} to true
				send "cenzura &aUlepszono HP na Poziom 3!" to arg-1
				execute console command "effect give %arg 1% minecraft:health_boost 1000000 2"
			else if {poz3::%player%} is true:
				send "cenzura &cJuż to zakupiłeś!" to arg-1
			
		
		

Proszę o wyrozumiałość i z góry dziękuje za odpowiedź

Odnośnik do komentarza
Udostępnij na innych stronach

7 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 1

O boże.. A no tak wyrozumiałość okej.. A więc tak proponuje zmienić te efekty na 

set player's max health to 40 //ustawienie maksymalnej ilosci zycia gracza
set player's health to 40 // uleczenie gracza do jego maksymalnej ilosci zyc

Po 2 czy przed tymi wszystkimi eventami ustawiasz te zmienne? 

Po 3 podaj silnik, wersja silnika i wersja skripta

Odnośnik do komentarza
Udostępnij na innych stronach

  • 1
10 minut temu, JkodGames napisał:

Siema. Mam problem, otóż napisałem taki skrypt na ulepszanie hp, chyba łatwo się domyślić jak to działa. Jestem dość nowy w tych wszystkich zmiennych itp., dlatego tego pewnie nie rozumiem... Otóż wczesniej, jak zmienna nazywała się po prostu {poz1} to wtedy jak rozumiem była serwerowa, no i wtedy nakładało efekt każdemu graczowi. Dlatego zmieniłem na {poz1::%player%} ale teraz po wpisaniu komendy nic sie nie dzieje, nikt nie otrzymuje efektu.

1. Jeżeli chcesz zmienić na stałe ilość HP gracza, użyj składni ze Skripta.

set player's max health to 20
add 1 to player's max health
remove 10 from player's max health

2. Jeżeli wykonujesz wiele podobnych operacji, zastosuj pętle.

Przykład:

# Możesz zastąpić to:

on join:
	if {poz1::%player%} is true:
		execute console command "effect give %player% minecraft:health_boost 1000000 0"
	if {poz2::%player%} is true:
		execute console command "effect give %player% minecraft:health_boost 1000000 1"
	if {poz3::%player%} is true:
		execute console command "effect give %player% minecraft:health_boost 1000000 2"
		
# Tym:

on join:
	loop 3 times:
		if {poz%loop-number%::%player%} is true:
			execute console command "effect give %player% minecraft:health_boost 1000000 %loop-number - 1%"

 

Odnośnik do komentarza
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ę...