• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Funkcja stepIn nie działa

Code:
local config = {
	itemId = 1234,
	position = {x = , y = , z =}
}

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	local tmpItem = getTileItemById(config.position, config.itemId).uid
	if(tmpItem > 0) then
		doRemoveItem(tmpItem)
	end
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreateItem(config.itemId, 1, config.position
end

Macie =P
 
@chojrak: dalej mi nie wiele mówi, bo "moja ostatnia pozycja" to dla mnie to samo co "pozycja z której się tu pojawiłem"
Mógłbys jakiś przykład czy cos?
może jestem po prostu za głupi, ale ze źródła nie umiem wyczytać tego
btw, actor i cid też nie widzę różnicy w sumie, actor znaczy ten kto to zrobił, cid hmm, w sumie to samo?..
 
Code:
local config = {
	itemId = 1234,
	position = {x = , y = , z =}
}

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	local tmpItem = getTileItemById(config.position, config.itemId).uid
	if(tmpItem > 0) then
		doRemoveItem(tmpItem)
	end
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	doCreateItem(config.itemId, 1, config.position
end

Macie =P


error ;]
[25/01/2010 15:40:03] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/PitsOfInferno/CreateLadder.lua)
[25/01/2010 15:40:03] data/movements/scripts/PitsOfInferno/CreateLadder.lua:15: ')' expected (to close '(' at line 14) near 'end'
[25/01/2010 15:40:03] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/PitsOfInferno/CreateLadder.lua)
[25/01/2010 15:40:03] data/movements/scripts/PitsOfInferno/CreateLadder.lua:15: ')' expected (to close '(' at line 14) near 'end'
 
No ja pierdole brakuje glupiego ), nie umiesz sobie dodac? Grrr...

Zamien:
Code:
doCreateItem(config.itemId, 1, config.position

Na:
Code:
doCreateItem(config.itemId, 1, config.position)
 
Szukałem błędu ale nie nie mogłem znaleźć, od rana robię skrypty więc już mi się wali w oczach xD
 
stare parametry funkcji :)

W ogole to sa parametry od onUse :O

@chojrak: dalej mi nie wiele mówi, bo "moja ostatnia pozycja" to dla mnie to samo co "pozycja z której się tu pojawiłem"
Mógłbys jakiś przykład czy cos?
może jestem po prostu za głupi, ale ze źródła nie umiem wyczytać tego
btw, actor i cid też nie widzę różnicy w sumie, actor znaczy ten kto to zrobił, cid hmm, w sumie to samo?..

onStepIn -> fromPosition = pozycja z przed wejścia; toPosition = pozycja po wejściu
onStepOut -> fromPosition = pozycja z przed zejścia; toPosition = pozycja po zejściu
Natomiast lastPosition zachowane zostało dla kompatybilności ze starymi skryptami, a reprezentuje zawsze poprzednią pozycję, czyli w przypadku onStepIn jest takie samo, jak fromPosition, a onStepOut bodaj poprzednią pozycję z przed zejścia (= fromPosition z onStepIn) lub, bo nie pamiętam, też fromPosition.
Sprawdźcie i potwierdźcie ;p
 
Słuchajcie teraz mam kolejny problem, napisałem pewien skrypt ale nie chce mi zadziałać. I znowu to głupie pytanie, na czym polega problem? I mam prośbę, nie piszcie mi od razu nowego skryptu tylko powiedzcie jak się z tym uporać i gdzie robię błędy.

function onUse(cid, item, frompos, item2, topos)



if item.uid == 55520 then
if getPlayerStorageValue(cid,55520) == -1 then
if getPlayerItemCount(cid, 2337) >= 1 and getPlayerItemCount(cid, 2338) >= 1 and getPlayerItemCount(cid, 2340) >= 1 and getPlayerItemCount(cid, 2335) >= 1 and getPlayerItemCount(cid, 2341) >= 1 and getPlayerItemCount(cid, 2339) >= 1 and getPlayerItemCount(cid, 2336) >= 1 then
if doRemovePlayerItem(cid, 2337, 1) and doRemovePlayerItem(cid, 2338, 1) and doRemovePlayerItem(cid, 2340, 1) and doRemovePlayerItem(cid, 2335, 1) and doRemovePlayerItem(cid, 2341, 1) and doRemovePlayerItem(cid, 2339, 1) and doRemovePlayerItem(cid, 2336, 1) then
doPlayerSendTextMessage(cid,25,"You have found a Ancient Helmet.")
doPlayerAddItem(cid,2342,1)
setPlayerStorageValue(cid,55520,1)
else
doPlayerSendTextMessage(cid,25,"This chest is empty. You've already done this quest!")
end
else
doPlayerSendTextMessage(cid,25,"You dont have all items.")
end

end
end
return TRUE
end

<action uniqueid="55520" script="Tomb/Nagroda.lua" />
 
Code:
local items = {1234, 5678, 90}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerStorageValue(cid, 55520) == EMPTY_STORAGE) then
		local pass = true
		for i = 1, #items do
			if(getPlayerItemCount(cid, items[i]) == 0) then
				pass = false
				break
			end
		end

		if(pass) then
			for i = 1, #items do
				doPlayerRemoveItem(cid, items[i])
			end
			doPlayerAddItem(cid, 2342, 1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Ancient Helmet.")
			setPlayerStorageValue(cid, 55520, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dont have all items.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This chest is empty. You've already done this quest!")
	end
	return true
end

Nie chcialo mi sie poprawiac, masz gotowca... W tablicy items wpisz ID wymaganych przedmiotow.
 
Last edited:
Code:
local items = {1234, 5678, 90}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerStorageValue(cid, 55520) == EMPTY_STORAGE) then
		local pass = true
		for i = 1, #items do
			if(getPlayerItemCount(cid, items[i]) == 0) then
				pass = false
				break
			end
		end

		if(pass) then
			for i = 1, #items do
				doPlayerRemoveItem(cid, items[i])
			end
			doPlayerAddItem(cid, 2342, 1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Ancient Helmet.")
			setPlayerStorageValue(cid, 55520, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dont have all items.")
		end
	e[COLOR="Red"][b]k[/b][/COLOR]se
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This chest is empty. You've already done this quest!")
	end
	return true
end

Nie chcialo mi sie poprawiac, masz gotowca... W tablicy items wpisz ID wymaganych przedmiotow.

Ok?
 
Code:
local items = {1234, 5678, 90}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerStorageValue(cid, 55520) == EMPTY_STORAGE) then
		local pass = true
		for i = 1, #items do
			if(getPlayerItemCount(cid, items[i]) == 0) then
				pass = false
				break
			end
		end

		if(pass) then
			for i = 1, #items do
				doPlayerRemoveItem(cid, items[i])
			end
			doPlayerAddItem(cid, 2342, 1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Ancient Helmet.")
			setPlayerStorageValue(cid, 55520, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dont have all items.")
		end
	ekse
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This chest is empty. You've already done this quest!")
	end
	return true
end

Nie chcialo mi sie poprawiac, masz gotowca... W tablicy items wpisz ID wymaganych przedmiotow.

zrobiles kilka blędow ktore poprawilem. Po kliknięciu helmet się dostaje ale nie zabiera itemów.

Ps. Zauważyłem, ze wszystkie skrzynie z nagrodami da się ruszać a gdy wrzuci się skrzynkę do tp i za nią wejdzie wywala debuga. Jak to naprawić ?:(
 
Słuchajcie mam kilka pytań.
Stworzyłem skypt, który po wejściu na daną kratkę przypisuje dopowiedni klucz(StorageValue) aby móc przejść przez drzwi a ten skrypt dla drzwi wygląda tak:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local nPos = {x=33268, y=32446, z=12}

if getPlayerStorageValue(cid, 36205) == 1 then
if getPlayerStorageValue(cid, 36206) == -1 then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doTeleportThing(cid, nPos)
doSendMagicEffect(nPos, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid,25,'You can go.')
setPlayerStorageValue(cid,36206,1)
else
doPlayerSendTextMessage(cid,25,'You have done already this quest.')
end
else
doPlayerSendTextMessage(cid,25,'You cant pass!')
end
return 1
end

Skrypt działa ale jest on niepraktyczny bo przenosi gracza jednorazowo zamiast otwierać i zamykać za nim drzwi (tak jak w przypadku bramek lvl-owych). Jaką funkcje trzeba dopisać żeby drzwi działały za każdym razem w dwie strony gdy gracz ma przypisany odpowiedni klucz?

I drugie pytanie.
Mam taki skrypt, że po wejściu na daną kratkę przenosi gracza na x,y,z ale chcę zrobić kilka (np. 30) takich samych "teleportów", które działają identycznie tylko, że na innej krateczce. Gdy przypiszę taki sam uniqueID dla kilku kratek pokazuje się w konsoli takie coś:

Duplicate uniqueId 60075

Czy to przeszkadza w pracy ots ? Jeśli tak to czy jest inny sposób niż kopiowanie tego skryptu i przypisywanie każdej krateczce inne uniqueID ?
 
Last edited:
Nikt nie wie?
Może za bardzo to rozwinąłem.
Pytanie brzmi: Jak zrobić drzwi, które się otwierają i zamykają(jak bramka lvlowa) po zrobieniu danego questa?
 
Back
Top