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

Lua Door NEW TFS

xTremoxx

domasturb(cid, genital)
Joined
Aug 11, 2007
Messages
418
Reaction score
6
Location
Brazil
Hello, whem i click to open desert quest door, (lvl 20)
say this error in console

PHP:
[19/01/2010 23:07:00] [Error - Action Interface] 
[19/01/2010 23:07:00] data/actions/scripts/other/doors.lua:onUse
[19/01/2010 23:07:00] Description: 
[19/01/2010 23:07:00] (luaGetThing) Thing not found

[19/01/2010 23:07:00] [Error - Action Interface] 
[19/01/2010 23:07:00] data/actions/scripts/other/doors.lua:onUse
[19/01/2010 23:07:00] Description: 
[19/01/2010 23:07:00] data/lib/function.lua:300: attempt to index a boolean value
[19/01/2010 23:07:00] stack traceback:
[19/01/2010 23:07:00] 	data/lib/function.lua:300: in function 'getItemName'
[19/01/2010 23:07:00] 	data/actions/scripts/evolution2.lua:24: in function 'getItemInfo'
[19/01/2010 23:07:00] 	data/lib/function.lua:648: in function 'getItemLevelDoor'
[19/01/2010 23:07:00] 	data/actions/scripts/other/doors.lua:22: in function <data/actions/scripts/other/doors.lua:16>

I'm using new tfs, can help-me ? i rep++
 
Evolution2.lua

PHP:
local conf = {}


-- // config // --
conf.maxItemLevel = 8 -- max item level 
conf.successChance = 70  -- succes upgrade chance

conf["upgrade"] = { -- how many parcent attributes are rised?
    attack = 5, -- attack %
    extraAttack = 10, -- extra Attack %
    defence = 5, -- defence %
    extraDefence = 10, -- extra defence %
    armor = 5, -- armor %
    attackSpeed = 3, -- attack speed %
    hitChance = 5, -- hit chance %
    shootRange = 2, -- shoot range %
}

--// end // --

function getItemInfo(item)

    local attr = {}
    local name = string.explode(getItemName(item), '+');
    if #name == 1 then
        attr.name = name[1]
        attr.level = math.abs(0)
    else
        attr.level = math.abs(name[2])
        attr.name = name[1]
    end
        attr.attack = (getItemAttack(item) > 0) and getItemAttack(item) or 0
        attr.extraAttack = (getItemExtraAttack(item) > 0) and getItemExtraAttack(item) or 0
        attr.defence = (getItemDefense(item) > 0) and getItemDefense(item) or 0
        attr.extraDefence = (getItemExtraDefense(item) > 0) and getItemExtraDefense(item) or 0
        attr.armor = (getItemArmor(item) > 0) and getItemArmor(item) or 0
        attr.attackSpeed = (getItemAttackSpeed(item) > 0) and getItemAttackSpeed(item) or 0
        attr.hitChance = (getItemHitChance(item) > 0) and getItemHitChance(item) or 0
        attr.shootRange = (getItemShootRange(item) > 0) and getItemShootRange(item) or 0
        attr.weight = (getItemWeight(item) > 0) and getItemWeight(item) or 0
        
    return attr
end

function upgradeValue(value, parcent)
    local newValue = math.ceil(((value/100)*parcent)+value)
    return (newValue > 0) and newValue or 0
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

    if toPosition.x == 65535 then
        local upgradingItem = getItemInfo(itemEx.uid)
        if (upgradingItem.attack > 0 or upgradingItem.defence > 0 or upgradingItem.armor > 0 or upgradingItem.shootRange > 1) then
            if (upgradingItem.level < conf.maxItemLevel) then
                if conf.successChance >= math.random(1,100) then
                    setItemName(itemEx.uid, upgradingItem.name.." + "..(upgradingItem.level+1))
                    setItemAttack(itemEx.uid, upgradeValue(upgradingItem.attack, conf["upgrade"].attack))
                    setItemExtraAttack(itemEx.uid, upgradeValue(upgradingItem.extraAttack, conf["upgrade"].extraAttack))
                    setItemDefense(itemEx.uid, upgradeValue(upgradingItem.defence, conf["upgrade"].defence))
                    setItemExtraDefense(itemEx.uid, upgradeValue(upgradingItem.extraDefence, conf["upgrade"].extraDefence))
                    setItemArmor(itemEx.uid, upgradeValue(upgradingItem.armor, conf["upgrade"].armor))
                    setItemAttackSpeed(itemEx.uid, upgradeValue(upgradingItem.attackSpeed, conf["upgrade"].attackSpeed))
                    setItemHitChance(itemEx.uid, upgradeValue(upgradingItem.hitChance, conf["upgrade"].hitChance))
                    setItemShootRange(itemEx.uid, upgradeValue(upgradingItem.shootRange, conf["upgrade"].shootRange))
                    doSendMagicEffect(toPosition, 30)
                    doPlayerSendTextMessage(cid, 22, "Equipamento evoluido com Sucesso ! seu item está ficando forte!")
                else
                    doRemoveItem(itemEx.uid, 100)
                    doSendMagicEffect(toPosition, 2)
                    doPlayerSendTextMessage(cid, 22, "Droga, seu item quebrou!")
                end
                doRemoveItem(item.uid, 1)
            else
                doPlayerSendCancel(cid, "Você atingiu o limite de Evolução!")
            end
        else
            doPlayerSendCancel(cid, "Você não pode evoluir este item!")
        end
    else
        doPlayerSendCancel(cid, "Você só pode evoluir items dentro do seu inventário!")
    end
    return TRUE;
end

Doors.lua

PHP:
local function checkStackpos(item, position)
	position.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
	local thing = getThingFromPos(position)

	position.stackpos = STACKPOS_TOP_FIELD
	local field = getThingFromPos(position)

	return (item.uid == thing.uid or thing.itemid < 100 or field.itemid == 0)
end

local function doorEnter(cid, item, toPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(fromPosition.x ~= CONTAINER_POSITION and isPlayerPzLocked(cid) and getTileInfo(fromPosition).protection) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	end

	if(getItemLevelDoor(item.itemid) > 0) then
		if(item.actionid == 189) then
			if(not isPremium(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local gender = item.actionid - 186
		if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE, PLAYERSEX_GAMEMASTER}, gender)) then
			if(gender ~= getPlayerSex(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local skull = item.actionid - 180
		if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
			if(skull ~= getCreatureSkullType(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local group = item.actionid - 150
		if(group >= 0 and group < 30) then
			if(group > getPlayerGroupId(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		local vocation = item.actionid - 100
		if(vocation >= 0 and vocation < 50) then
			local playerVocationInfo = getVocationInfo(getPlayerVocation(cid))
			if(playerVocationInfo.id ~= vocation and playerVocationInfo.fromVocation ~= vocation) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
				return true
			end

			doorEnter(cid, item, toPosition)
			return true
		end

		if(item.actionid == 190 or (item.actionid ~= 0 and getPlayerLevel(cid) >= (item.actionid - getItemLevelDoor(item.itemid)))) then
			doorEnter(cid, item, toPosition)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
		end

		return true
	end

	if(isInArray(specialDoors, item.itemid)) then
		if(item.actionid == 100 or (item.actionid ~= 0 and getPlayerStorageValue(cid, item.actionid) > 0)) then
			doorEnter(cid, item, toPosition)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
		end

		return true
	end

	if(isInArray(keys, item.itemid)) then
		if(itemEx.actionid > 0) then
			if(item.actionid == itemEx.actionid and doors[itemEx.itemid] ~= nil) then
				doTransformItem(itemEx.uid, doors[itemEx.itemid])
				return true
			end

			doPlayerSendCancel(cid, "The key does not match.")
			return true
		end

		return false
	end

	if(isInArray(horizontalOpenDoors, item.itemid) and checkStackpos(item, fromPosition)) then
		local newPosition = toPosition
		newPosition.y = newPosition.y + 1
		local doorPosition = fromPosition
		doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
		local doorCreature = getThingfromPos(doorPosition)
		if(doorCreature.itemid ~= 0) then
			local pzDoorPosition = getTileInfo(doorPosition).protection
			local pzNewPosition = getTileInfo(newPosition).protection
			if((pzDoorPosition and not pzNewPosition and doorCreature.uid ~= cid) or
				(not pzDoorPosition and pzNewPosition and doorCreature.uid == cid and isPlayerPzLocked(cid))) then
				doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			else
				doTeleportThing(doorCreature.uid, newPosition)
				if(not isInArray(closingDoors, item.itemid)) then
					doTransformItem(item.uid, item.itemid - 1)
				end
			end

			return true
		end

		doTransformItem(item.uid, item.itemid - 1)
		return true
	end

	if(isInArray(verticalOpenDoors, item.itemid) and checkStackpos(item, fromPosition)) then
		local newPosition = toPosition
		newPosition.x = newPosition.x + 1
		local doorPosition = fromPosition
		doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
		local doorCreature = getThingfromPos(doorPosition)
		if(doorCreature.itemid ~= 0) then
			if(getTileInfo(doorPosition).protection and not getTileInfo(newPosition).protection and doorCreature.uid ~= cid) then
				doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			else
				doTeleportThing(doorCreature.uid, newPosition)
				if(not isInArray(closingDoors, item.itemid)) then
					doTransformItem(item.uid, item.itemid - 1)
				end
			end

			return true
		end

		doTransformItem(item.uid, item.itemid - 1)
		return true
	end

	if(doors[item.itemid] ~= nil and checkStackpos(item, fromPosition)) then
		if(item.actionid == 0) then
			doTransformItem(item.uid, doors[item.itemid])
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
		end

		return true
	end

	return false
end
 
I will try.

-- I Disable and Reload and say this when i try open door (gate of experience) --

PHP:
[20/01/2010 03:11:24] [Error - Action Interface] 
[20/01/2010 03:11:24] data/actions/scripts/other/doors.lua:onUse
[20/01/2010 03:11:24] Description: 
[20/01/2010 03:11:24] (luaGetThing) Thing not found

[20/01/2010 03:11:24] [Error - Action Interface] 
[20/01/2010 03:11:24] data/actions/scripts/other/doors.lua:onUse
[20/01/2010 03:11:24] Description: 
[20/01/2010 03:11:24] data/lib/050-function.lua:234: attempt to index a boolean value
[20/01/2010 03:11:24] stack traceback:
[20/01/2010 03:11:24] 	data/lib/050-function.lua:234: in function 'getItemName'
[20/01/2010 03:11:24] 	data/actions/scripts/evolution1.lua:24: in function 'getItemInfo'
[20/01/2010 03:11:24] 	data/lib/050-function.lua:591: in function 'getItemLevelDoor'
[20/01/2010 03:11:24] 	data/actions/scripts/other/doors.lua:22: in function <data/actions/scripts/other/doors.lua:16>
 
Back
Top