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

Action Broken HoTA

Komic

MChem
Joined
Jun 8, 2007
Messages
359
Reaction score
51
Code:
function onAddItem(moveitem, tileitem, pos)
helmnum = moveitem.itemid+40000
helmstatus = getGlobalStorageValue(helmnum)

if moveitem.itemid == 2335 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
elseif moveitem.itemid == 2336 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end			
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
elseif moveitem.itemid == 2337 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
elseif moveitem.itemid == 2338 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
elseif moveitem.itemid == 2339 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42341) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
elseif moveitem.itemid == 2340 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42336) == 1 and getGlobalStorageValue(42341) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
elseif moveitem.itemid == 2341 then
	if helmstatus ~= 1 then
		setGlobalStorageValue(helmnum,1)
		if getGlobalStorageValue(42335) == 1 and getGlobalStorageValue(42337) == 1 and getGlobalStorageValue(42338) == 1 and getGlobalStorageValue(42339) == 1 and getGlobalStorageValue(42340) == 1 and getGlobalStorageValue(42336) == 1 then
			doTransformItem(moveitem.uid, 2342)
			for q = 2, 8 do
				doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
			end
			for p = 42335, 42341 do
				setGlobalStorageValue(p,0)
			end
		end
	else
		doRemoveItem(moveitem.uid,1)
		doPlayerAddItem(cid,moveitem.uid,1)
		doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
	end
end
	return 1	
end

This is like in RL tibia where you don't have to pull a lever to make the helmet it happens naturally. Atm it doesn't work and I don't know why as it is the first time that I have made a script with this function and also using for/do in it, so can someone try to fix for me?
 
He doesn't fix errors in scripts in that thread. He only optimizes them. And he closed it temporarily since he don't have time to optimize scripts atm.
 
this script do exactly what? when you remove the helmet, the ruby fades? xD
 
Haha :p

This script makes all 6-7 peces into a full hota if you place them at right place(Except the gem ofcourse)

Sincerly,
Furstiwn.
 
any errors in console? o ;

im make shortly you version, but not tested. i don't know where you have error.
PHP:
items = {2335, 2336, 2337, 2338, 2339, 2340, 2341} -- item id's.
function onAddItem(moveitem, tileitem, pos)
local helmnum = moveitem.itemid+40000
local helmstatus = getGlobalStorageValue(helmnum)
local broke = 0
	if items[moveitem.itmeid] then
		if(helmstatus ~= 1)then
			setGlobalStorageValue(helmnum,1)
			for i=1,#items do
				if getGlobalStorageValue(items[i]+40000) == 1 then
					broke = 0
				else
					broke = 1
					i=#items
				end
			end
			
			if broke == 0 then
				for q = 1, #items+1 do
					doRemoveItem(getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=q}).uid,1)
					setGlobalStorageValue(p,items[q]+40000)
				end
					doCreateItem(moveitem.uid, 1, pos)
					doPlayerSendTextMessage(cid,22,"You can\'t place this item here.")
			end
		end
	end
	return 1	
end
 
Last edited:
#up
haha, global storage with cid param, nice. xd


#down
hehehe ; P
 
Last edited:
Back
Top