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

Need help ;o

Akon

Member
Joined
Sep 10, 2009
Messages
1,003
Reaction score
6
10hr7u8.png


16blvyx.png


You need to pull this lever, to remove the red ruby's, and create a red gem
Items need to lay on that, so i can create a new one
Here come's the item, which i created with the 2 small ruby's

Red ruby ID= 2147
Red gem ID= 2156



I searched everywhere, but I couldnt find one, that works =(.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local loop = { -- ruby's pos
[1] = getThingFromPos(pos).itemid, -- first pos
[2] = getThingFromPos(pos).itemid -- second pos
}
local gempos = {x=x, y=y, z=z} -- pos of gem creation
for i = 1,2 do
if loop[i] == 2147 then
doCreateItem(2156, 1, gempos)
else
doPlayerSendCancel(cid, "There are not two rubys on specified position.")
end
end
return true
end

;)
 
worng :D , if there is only 1 roby it will create item , also it wont remove items, also getThingFrompos(pos) where is the verible of pos
 
Last edited:
Okay Doggynub sorry here the correct script:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local ruby1 = getThingFromPos(pos).itemid -- first pos
local ruby2 = getThingFromPos(pos).itemid -- second pos

local gempos = {x=x, y=y, z=z} -- pos of gem creation

if ruby1 == 2147 and ruby2 == 2147 then
doCreateItem(2156, 1, gempos)
else
doPlayerSendCancel(cid, "There are not two rubys on specified position.")
end
end
return true
end
on xml this:
XML:
<action actionid="actionid" event="script" value="name.lua"/>
 
Okay Doggynub sorry here the correct script:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local ruby1 = getThingFromPos(pos).itemid -- first pos
local ruby2 = getThingFromPos(pos).itemid -- second pos

local gempos = {x=x, y=y, z=z} -- pos of gem creation

if ruby1 == 2147 and ruby2 == 2147 then
doCreateItem(2156, 1, gempos)
else
doPlayerSendCancel(cid, "There are not two rubys on specified position.")
end
end
return true
end
on xml this:
XML:
<action actionid="actionid" event="script" value="name.lua"/>

hmm , I dont understand all of it, what do i need to do with the lever, and dont i need to also add the position of the rubys somewhere xd? thx for helping btw
 
is for check if is really is it ruby on X position you need to put here the position of rubys:
Lua:
local ruby1 = getThingFromPos(pos).itemid -- first pos
local ruby2 = getThingFromPos(pos).itemid -- second pos

You change pos for the position {x=x, y=y, z=z, stackpos = 1}
 
fast one i made if you still want :p
Lua:
local c = {
			ruby_id = 2466,   				-- id of red ruby
			ruby_place = 	{ 		
								[1] = {pos = {x=93,y=122,z=7}},  	-- first rube place
								[2] = {pos = {x=97,y=122,z=7}}		-- second ruby place
							},
 
			diamond = {x=96,y=123,z=7},	 	-- place of diamond created
			diamond_id= 2446,   			-- diamond id
			removal = true,					-- remove ruby on create item
			cancel_msg = "2 rubys must be placed on basin."    --- cancel message
		}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	result = false
	for i = 1,2 do
		if getTileItemById(c.ruby_place[i].pos,c.ruby_id).uid > 0 then
			result = true
		else 
			result = false
			break
		end
	end
	if result == true then
		if c.removal == true then
			for i = 1,2 do
				doRemoveItem(getTileItemById(c.ruby_place[i].pos,c.ruby_id).uid)
				doSendMagicEffect(c.ruby_place[i].pos,2)
			end
		end
		doCreateItem(c.diamond_id,1,c.diamond)
	else
		doPlayerSendCancel(cid,c.cancel_msg)
	end
return doTransformItem(item.uid,( item.itemid == 1945 and 1946 or 1945 ) )	
end
 
fast one i made if you still want :p
Lua:
local c = {
			ruby_id = 2466,   				-- id of red ruby
			ruby_place = 	{ 		
								[1] = {pos = {x=93,y=122,z=7}},  	-- first rube place
								[2] = {pos = {x=97,y=122,z=7}}		-- second ruby place
							},
 
			diamond = {x=96,y=123,z=7},	 	-- place of diamond created
			diamond_id= 2446,   			-- diamond id
			removal = true,					-- remove ruby on create item
			cancel_msg = "2 rubys must be placed on basin."    --- cancel message
		}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	result = false
	for i = 1,2 do
		if getTileItemById(c.ruby_place[i].pos,c.ruby_id).uid > 0 then
			result = true
		else 
			result = false
			break
		end
	end
	if result == true then
		if c.removal == true then
			for i = 1,2 do
				doRemoveItem(getTileItemById(c.ruby_place[i].pos,c.ruby_id).uid)
				doSendMagicEffect(c.ruby_place[i].pos,2)
			end
		end
		doCreateItem(c.diamond_id,1,c.diamond)
	else
		doPlayerSendCancel(cid,c.cancel_msg)
	end
return doTransformItem(item.uid,( item.itemid == 1945 and 1946 or 1945 ) )	
end


Woot, thanks it works =D, also thx to kylerxx
 
Back
Top