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

[Actions] Switch create's bridge and delete's some item's (need SOMEONE GOOD).

DVEagle

New Member
Joined
Aug 29, 2009
Messages
95
Reaction score
3
Location
PoLand
Hello, it's the same request as here
Code:
http://otland.net/f132/actions-switch-items-correct-places-like-desert-q-114045/

But after 3 pages nobody wrote good script and topic was just mess so i've decided to write request again clearer.

This is what i need to works:
saxg.png
That should be :
When i put this lever and item's are on correct positions then these items disappear and in some xyz appears bridge (id 1284).


Old script : (don't working even if i deleted required item's, 'stackpos' and paste there id of coal basins..) there was always message in game "put on correct positions.."
Lua:
local Items = {
{pos = {x=1030,y=1325,z=13,stackpos=2}, id = 9447},
{pos = {x=1033,y=1323,z=13,stackpos=2}, id = 2557},
{pos = {x=1036,y=1325,z=13,stackpos=2}, id = 6531},
{pos = {x=1033,y=1329,z=13,stackpos=2}, id = 5797}
}
local bridge = {
{pos = {x=1034,y=1263,z=11}}
}
 
function onUse(cid)
local items, item = {};
for _,itemData in pairs(Items) do
item = getTileItemById(itemData.pos, itemData.id);
if(item.uid == 2001)then
table.insert(items, item);
end
item = NULL; -- not sure;
end
 
if #items == #Items then
doCreateItem(1284,bridge)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to put item's on correct positions!")
end
 
return true
end

Why i wrote new topic? Because someone in old one wrote bad script and others was just keep remaking it and nothing works.
 
Lua:
local t = {
	{{x=1030,y=1325,z=13}, 9447},
	{{x=1033,y=1323,z=13}, 2557},
	{{x=1036,y=1325,z=13}, 6531},
	{{x=1033,y=1329,z=13}, 5797}
}
local bridge = {x=1034,y=1263,z=11}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local items = {}
	for i= 1, #t do
		local v = getTileItemById(t[i][1], t[i][2]).uid
		if v == 0 then
			return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need to put the items on correct positions!')
		end
		table.insert(items, v)
	end
	 
	for i = 1, #items do
		doRemoveItem(items[i])
	end
	doCreateItem(1284, 1, bridge)
	return true
end
 
Your script remove's items from coal basins but don't creating bridge, it has to create bridge on nothing, just in air and i'm recieving that error:
Code:
[02/02/2011 19:01:07] [Error - Action Interface] 
[02/02/2011 19:01:07] data/actions/scripts/gqbridge.lua:onUse
[02/02/2011 19:01:07] Description: 
[02/02/2011 19:01:07] (luaDoCreateItem) Tile not found
 
If you want to create a tile on a nonexistant position, you have to edit your sources (luascript.cpp, function doCreateItem)
 
Back
Top