• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Help tfs 1.5 script not working or giving error in console

johnsamir

Banned User
Joined
Oct 13, 2009
Messages
555
Solutions
5
Reaction score
97
Location
Nowhere
HI
i know that getthingfrompos code was removed in tfs 1.5

this script is not working in tfs 1.5 but it used to work in tfs 0.4
Lua:
--function onStepIn(cid, item, pos)

--    coin = {x=33240, y=32855, z=13, stackpos=1}
--    newpos = {x=33246, y=32850, z=13}

--    getcoin = getThingPosition(coin)
    
--    if item.actionid == 6007 and getcoin.itemid == 2159 then
--        doTeleportThing(cid,newpos)
--        doRemoveItem(getcoin.uid,1)
--        doSendMagicEffect(coin, CONST_ME_MAGIC_RED)
--        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
--        else
--    end
    
--    if item.actionid == 6008 then
--    doTeleportThing(cid, {x=33239, y=32856, z=13})
--    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)   
--    end
--    return true
--end

geisor show me the way how to update it. and now look like this but the script is not working either or sending errors in console.
as you can see the script has two actions id one where do you need to add an scarab coins and another where you only should step into the teleport flame
none of both function ain't working
Code:
--adaptation felipe93
local coinPosition = {x=33240, y=32855, z=13}
local coinItemId = 2159
local newPosition = {x=33246, y=32850, z=13}

function onStepIn(cid, item, pos)
   if item.actionid == 6007 then
      local coinItem = Tile(coinPosition):getItemById(coinItemId)
      if coinItem then
         coinItem:remove(1)
         doTeleportThing(cid,newPosition)
         doSendMagicEffect(coinPosition, CONST_ME_MAGIC_RED)
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
      end
   end

   if item.actionid ==6008 then
      doTeleportThing(cid, {x=33239, y=32856, z=13})
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
   end

   return true
end
Code:
    <moveevent event="StepIn" tileitem="1"  actionid="6007" script="The Ancient Tombs Quest/Mahrdis/coalbasin.lua"/>
    <!-- <moveevent event="StepIn" actionid="6007" script="The Ancient Tombs Quest/Mahrdis/coalbasin.lua"/> -->
    <moveevent event="StepIn" actionid="6008" script="The Ancient Tombs Quest/Mahrdis/coalbasin.lua"/>
ideas?


thanks
 
Solution
it wasn't removed, it was moved to Lua at compat.lua:

Lua:
function getThingfromPos(pos)
    local tile = Tile(pos)
    if tile == nil then
        return pushThing(nil)
    end

    local thing
    local stackpos = pos.stackpos or 0
    if stackpos == STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE then
        thing = tile:getTopCreature()
        if thing == nil then
            local item = tile:getTopDownItem()
            if item and item:getType():isMovable() then
                thing = item
            end
        end
    elseif stackpos == STACKPOS_TOP_FIELD then
        thing = tile:getFieldItem()
    elseif stackpos == STACKPOS_TOP_CREATURE then
        thing = tile:getTopCreature()
    else
        thing = tile:getThing(stackpos)...

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,507
Solutions
260
Reaction score
4,455
it wasn't removed, it was moved to Lua at compat.lua:

Lua:
function getThingfromPos(pos)
    local tile = Tile(pos)
    if tile == nil then
        return pushThing(nil)
    end

    local thing
    local stackpos = pos.stackpos or 0
    if stackpos == STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE then
        thing = tile:getTopCreature()
        if thing == nil then
            local item = tile:getTopDownItem()
            if item and item:getType():isMovable() then
                thing = item
            end
        end
    elseif stackpos == STACKPOS_TOP_FIELD then
        thing = tile:getFieldItem()
    elseif stackpos == STACKPOS_TOP_CREATURE then
        thing = tile:getTopCreature()
    else
        thing = tile:getThing(stackpos)
    end
    return pushThing(thing)
end
 
Solution
Top