• 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!

Potrzebuje skryptu onStepIn

Koci

Member
Joined
Dec 18, 2009
Messages
784
Reaction score
18
Location
Scotland
Witam mam taką prośbę.
Chodzi mi o to żeby ktoś napisał mi skrypt onStepIn.
Ma działać tak:
Gracz staje na title o uid == 58674 i jeśli na title przed nim są itemy {2335, 2336, 2338, 2337, 2340, 2341, 2339} to usuwa te itemy pojawia się dymek i pojawia się item : 2342

Pozdrawiam.:peace:
 
Ja zaczne skrypt
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) == TRUE then
end
end
 
Próbowałem i mam takie coś ale to nie działa jak powinno:
function onStepIn(cid, item, position, fromPosition)

oltarz = {x=1541, y=1694, z=11, stackpos=255}

wezoltarz = getThingfromPos(oltarz)

if (isInArray({2335, 2336, 2338, 2337, 2340, 2341, 2339}, wezoltarz.itemid)) then
doRemoveItem(wezoltarz.uid,1) 
doCreateItem(2342,1,oltarz)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end
 
if (isInArray({2335, 2336, 2338, 2337, 2340, 2341, 2339}, wezoltarz.itemid)) then
na
if (isInArray({2335, 2336, 2338, 2337, 2340, 2341, 2339}, wezoltarz.uid)) then
albo
if (isInArray({2335, 2336, 2338, 2337, 2340, 2341, 2339}, oltarz)) then

Nie wiem bo nie mam isInArray w silniku swoim
 
nie ma prawa dzialac, nie trzebac miec tej funkcji aby wiedzieć do czego można ją zastosować

@topic
prosta pętla + stackpos może się przydać??
 
Code:
getCreatureLookDirection(cid)
to pewnie tez sie przyda.
 
Pięćset złoty. Stówa za mało piękny kawalerze.
 
Pewnie nie bedzie dzialal :(
Code:
local itemyKociego = { 2335, 2336, 2338, 2337, 2340, 2341, 2339 }
local pozycjaItemowKociego = { x = 1, y = 2, z = 7 }

local function czySaItemyKociego(pos)
	local znalezioneItemki = {}
	local result = 0

	for i = 5, 1, -1 do
		pos.stackpos = i
		if(isInArray(itemyKociego, getThingFromPos(pos).itemid) == TRUE)then
			table.insert(znalezioneItemki, getThingFromPos(pos).itemid)
		end
	end
	
	if(#itemyKociego == #znalezioneItemki)then
		table.sort(itemyKociego)
		table.sort(znalezioneItemki)
		
		for i = 1, #itemyKociego do
			if(itemyKociego[i] == znalezioneItemki[i])then
				result = result + 1
			end
		end
	end
	
	return result == #itemyKociego and true or false
end

local function usunItemyKociego(pos)
	for i = 5, 1, -1 do
		pos.stackpos = i
		if(isInArray(itemyKociego, getThingFromPos(pos).itemid) == TRUE)then
			doRemoveItem(getThingFromPos(pos).uid)
		end
	end

	return doSendMagicEffect(pos, CONST_ME_POFF)
end

function onStepIn(cid, item, pos)
	if(isPlayer(cid) == TRUE)then
		if(czySaItemyKociego(pozycjaItemowKociego) == true)then
			usunItemyKociego(pozycjaItemowKociego)
			doCreateItem(2342, 1, pozycjaItemowKociego)
		end
	end
end

popraw sobie loopy heh
 
Last edited:
Nie działa.
Jak wchodzę na title to nic się nie dzieje (itemy kociego leżą na pozycji itemów kociego na stałce :) )
2yo92ma.jpg

A czy to ważne w jakiej kolejności są itemy Kociego ??
 
Last edited:
Code:
local itemyKociego = { 2335, 2336, 2338, 2337, 2340, 2341, 2339 }
local pozycjaItemowKociego = { x = 1, y = 2, z = 7 }

local function czySaItemyKociego(pos)
	local result = 0

	for i = 1, #itemyKociego do
		if(getTileItemById(pos, itemyKociego[i]) == TRUE)then
			result = result + 1
		end
	end
	
	return result == #itemyKociego and true or false
end

local function usunItemyKociego(pos)
	for i = 1, #itemyKociego do
		if(getTileItemById(pos, itemyKociego[i]) == TRUE)then
			doRemoveItem(getTileItemById(pos, itemyKociego[i]).uid)
		end
	end

	return doSendMagicEffect(pos, CONST_ME_EXPLOSION)
end

function onStepIn(cid, item, pos)
	if(isPlayer(cid) == TRUE)then
		if(czySaItemyKociego(pozycjaItemowKociego) == true)then
			usunItemyKociego(pozycjaItemowKociego)
			doCreateItem(pozycjaItemowKociego, 2342, 1)
		end
	end
end

a w ten sposob?
 
Code:
local config = {
	ids = {from=2335, to=2341},
	storage = 4449,
	item = 2342
}
function onStepIn(cid, item, position, fromPosition)
	if getPlayerStorageValue(cid, config.storage) < 1 then
		for i = config.ids.from, config.ids.to do
			if getPlayerItemCount(cid, i) < 1 then
				failed = true
				break
			end
		end
		if not failed then
			for i = config.ids.from, config.ids.to do
				doPlayerRemoveItem(cid, i, 1)
			end
			local pos = getCreaturePosition(cid)
			doCreateItem(config.item, 1, {x=pos.x, y=pos.y-1, z=pos.z})
			setPlayerStorageValue(cid, config.storage, 1)
		else
			doPlayerSendCancel(cid, "You don't have all the required items.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You've already done this quest!")
	end
end
 
Code:
local itemyKociego = { 2335, 2336, 2338, 2337, 2340, 2341, 2339 }
local pozycjaItemowKociego = { x = 1, y = 2, z = 7 }

local function czySaItemyKociego(pos)
	local result = 0

	for i = 1, #itemyKociego do
		if(getTileItemById(pos, itemyKociego[i]) == TRUE)then
			result = result + 1
		end
	end
	
	return result == #itemyKociego and true or false
end

local function usunItemyKociego(pos)
	for i = 1, #itemyKociego do
		if(getTileItemById(pos, itemyKociego[i]) == TRUE)then
			doRemoveItem(getTileItemById(pos, itemyKociego[i]).uid)
		end
	end

	return doSendMagicEffect(pos, CONST_ME_EXPLOSION)
end

function onStepIn(cid, item, pos)
	if(isPlayer(cid) == TRUE)then
		if(czySaItemyKociego(pozycjaItemowKociego) == true)then
			usunItemyKociego(pozycjaItemowKociego)
			doCreateItem(pozycjaItemowKociego, 2342, 1)
		end
	end
end

a w ten sposob?
Też nic się nie dzieje ;/
 
Nie wiem czy wiesz ale musisz dodać linijkę do movements.xml
 
Back
Top