• 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 What's wrong? Tiny script

highclick

New Member
Joined
Mar 21, 2011
Messages
80
Reaction score
4
TFS: 0.3.6


PHP:
local lever = 113
local item = 2346
local altarpos = {x = 1205, y = 1189, z = 10}
local cpos = {x = 1205, y = 1190, z = 10}
local npos = {x = 1205, y = 1184, z = 12}

function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)
    if item.actionid == lever and getCreaturePosition(cid, cpos) and getTileItemById(altarpos, item) then
            doTeleportThing(cid, {x = 1205, y = 1184, z = 12})
    end
    return true
end

When actionid=113 and you stand on a specific spot and place a specific item on a tile you should get teleported

I get this error
Code:
[12/02/2015 14:51:15] [Error - Action Interface]
[12/02/2015 14:51:15] data/actions/scripts/other/spiderbosslever.lua:onUse
[12/02/2015 14:51:15] Description:
[12/02/2015 14:51:15] (luaGetThingPosition) Thing not found

Bump
 
Last edited by a moderator:
You can use this function to compare positions.
Code:
function comparePos(poss, pos)
     return pos.x == poss.x and pos.y == poss.y and pos.z == poss.z
end

Code:
if comparePos(getCreaturePosition(cid), cpos) then

For the item.
Code:
if getTileItemById(altarpos, 2346).uid > 0 then

Checking for actionid isn't needed unless more actionids are used in this script.
Code:
if comparePos(getCreaturePosition(cid), cpos) and getTileItemById(altarpos, 2346).uid > 0 then
 
Back
Top