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

few scripts ? can u help ?

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello,
I need few scripts for TFS 0.3.5pl1:

1) Gate of Exprience Door [teleport] (Quest Door)

NORMAL: When you trying to pass the door, door open and you move in door
uo0004ew2.jpg

I WAN`T: When you trying to pass the door, door dont open just teleport you to otherside, like tibia 7.6 or 7.92 versions.

2) 7 items, 100 level, lever = use = teleport ?

If you got 7 items
ID = {2650, 2651, 2652, 2653, 2654, 2655, 2656)
You must place this item`s in position's:
2650 = x: 3450 y: 4059 z: 7
2651 = x: 3451 y: 4060 z: 7
2652 = x: 3452 y: 4061 z: 7
2653 = x: 3453 y: 4062 z: 7
2654 = x: 3454 y: 4063 z: 7
2655 = x: 3455 y: 4064 z: 7
2656 = x: 3456 y: 4065 z: 7
If you got 100 level, and placed items on positions, you use lever and you has been teleported to:
x: 5670 y: 3450 z: 8

3) Fishing without fishing skill
It`s possible to do it ?
I need fishing rod script without fishing skill.
Rod will fish normally fishes but without skill !

Anyone can help me ?
:huh:
 
Last edited:
@Up

door.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

fishing.lua
PHP:
local config = {
	waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
	rateSkill = getConfigValue("rateSkill"),
	allowFromPz = false,
	useWorms = true
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(not isInArray(config.waterIds, itemEx.itemid)) then
		return false
	end

	if((config.allowFromPz or not getTileInfo(getCreaturePosition(cid)).protection) and itemEx.itemid ~= 493 and
		math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) < getPlayerSkill(cid, SKILL_FISHING) and
		(not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1)))) then
		doPlayerAddItem(cid, ITEM_FISH, 1)
		doPlayerAddSkillTry(cid, SKILL_FISHING, config.rateSkill)
	end

	doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
	return true
end
 
@Up

door.lua

I am not sure this will work, but make a backup of the old script.

Code:
function onUse(cid, item, frompos, item2, topos)
-- Level required quest doors - by Alreth (v1.01)
--
-- Make a level door in your map and give it the actionid that you
-- want the level requirement to be.
-- Edit the variables below so the itemid for the horizontal and
-- vertical level doors that your server uses are correct.
 
    -- Edit these values so they match your server's item ids --
 
    horid = 1629 -- Itemid of an horizontal closed level door
    verid = 1627 -- Itemid of an vertical closed level door
 
    -- Stop editing now, unless you know what you're doing --
 
    playerlevel = getPlayerLevel(cid)
    playerpos = getPlayerPosition(cid)
    doorpos = frompos
    levelreq = item.actionid
 
    if (levelreq < 0 or levelreq == nil) then
        doPlayerSendTextMessage(cid, 16, "There has been an error. Please contact a gamemaster. Error: level requirement is not positive")
    else
        if (item.itemid == horid) then
            if (playerpos.y > doorpos.y) then
                newpos = {x = doorpos.x, y = (doorpos.y - 1), z = doorpos.z}
            else
                newpos = {x = doorpos.x, y = (doorpos.y + 1), z = doorpos.z}
            end
        elseif (item.itemid == verid) then
            if (playerpos.x > doorpos.x) then
                newpos = {x = (doorpos.x - 1), y = doorpos.y, z = doorpos.z}
            else
                newpos = {x = (doorpos.x + 1), y = doorpos.y, z = doorpos.z}
            end
        else
            doPlayerSendTextMessage(cid, 16, "There has been an error. Please contact a gamemaster. Error: invalid item id")
        end
 
        if (playerlevel >= levelreq) then
            doTeleportThing(cid, newpos)
            doSendMagicEffect(playerpos, 14)
            doSendMagicEffect(newpos, 14)
            doPlayerSendTextMessage(cid, 22, "Your level is enough to pass. Minimum level is " .. levelreq..".")
        else
            doPlayerSendTextMessage(cid, 22, "Your level is too low. You need " .. (levelreq - getPlayerLevel(cid)).." more levels.")
        end
    end
    return 1
end

And also for fishing.lua

In config you can change the rate of fishing.
Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    allowFromPz = false,
    useWorms = true,
    rate = 10 -- To make it harder or easier to fish, change this value.
-- Harder = lower
-- Easier = higher
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(not isInArray(config.waterIds, itemEx.itemid)) then
        return false
    end

    if((config.allowFromPz or not getTileInfo(getCreaturePosition(cid)).protection) and itemEx.itemid ~= 493 and
        math.random(1, (100 + ((config.rate / 10))) and
        (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1)))) then
        doPlayerAddItem(cid, ITEM_FISH, 1)
    end

    doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
    return true
end
 
doors.lua
Don`t work.
Gate is for 20 level and say me: You must get 957 more levels.

fishing.lua
PHP:
[17/07/2010 10:22:36] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/tools/fishing.lua)
[17/07/2010 10:22:36] data/actions/scripts/tools/fishing.lua:17: ')' expected (to close '(' at line 15) near 'then'
 
try this for the door script.

Code:
function onUse(cid,item,fromPosition,itemEx,toPosition)
local north,east,south,west,v = 0,1,2,3,getThingPos(cid)
local nv,ev,sv,wv = {x=v.x,y=v.y-2,z=v.z},{x=v.x+2,y=v.y,z=v.z}{x=v.x,y=v.y+2,z=v.z},{x=v.x-2,y=v.y,z=v.z},
	if getPlayerLevel(cid) > 100 then
		if getCreatureLookDirection(cid) == north then
			doTeleportThing(cid,nv)
			doSendMagicEffect(v,10)
		elseif getCreatureLookDirection(cid) == east then
			doTeleportThing(cid,ev)
			doSendMagicEffect(v,10)
		elseif getCreatureLookDirection(cid) == south then
			doTeleportThing(cid,sv)
			doSendMagicEffect(v,10)
		elseif getCreatureLookDirection(cid) == west then
			doTeleportThing(cid,wv)
			doSendMagicEffect(v,10)
		end
	else
		doPlayerSendTextMessage(cid,27,'You have to gain '..(getPlayerLevel(cid)-100)..' levels in order to use this door.')
		doSendMagicEffect(v,2)
	end
	return true
end
 
Last edited:
@Up
Hmm..
DEBUGS in CONSOLE:
[17/07/2010 18:57:30] data/actions/scripts/Kinto.lua:19: '<eof>' expected near 'end'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'
[17/07/2010 18:57:30] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/doors.lua)
[17/07/2010 18:57:30] data/actions/scripts/other/doors.lua:4: unexpected symbol near 'if'

How about this request of script:
PHP:
If you got 7 items
ID = {2650, 2651, 2652, 2653, 2654, 2655, 2656)
You must place this item`s in position's:
2650 = x: 3450 y: 4059 z: 7
2651 = x: 3451 y: 4060 z: 7
2652 = x: 3452 y: 4061 z: 7
2653 = x: 3453 y: 4062 z: 7
2654 = x: 3454 y: 4063 z: 7
2655 = x: 3455 y: 4064 z: 7
2656 = x: 3456 y: 4065 z: 7
If you got 100 level, and placed items on positions, you use lever and you has been teleported to:
x: 5670 y: 3450 z: 8
 
Back
Top