• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Help me to fix my dawnport tile in 0.4

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
238
Reaction score
54
Nothing working, i'm tryng to make a dawnport tile in 8.60

Why nothing happen?

Code:
<movevent type="StepIn" actionid="65527-65530" event="script" value="dawnport_tiles.lua" />

Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {vocid = 1 },
   [65529] = {vocid = 2 },
   [65528] = {vocid = 3 },
   [65527] = {vocid = 4 }
}

function onStepIn(cid, item, position, fromPosition)
   local r = tile[item.actionid]
   if r == 65530 then -- sorc tile
     queststatus = getPlayerStorageValue(cid,r)
     if queststatus == -1 then
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
       setPlayerStorageValue(cid,r,1)
       doPlayerAddItem(cid,2190,1) -- wand of vortex
       doPlayerAddItem(cid,2287,100) -- lmm
     end
   elseif r == 65529 then -- druid tile
     queststatus = getPlayerStorageValue(cid,r)
     if queststatus == -1 then
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
       setPlayerStorageValue(cid,r,1)
       doPlayerAddItem(cid,2182,1) -- snakebit rod
       doPlayerAddItem(cid,2287,100) -- lmm
     end
   elseif r == 65528 then -- pally tile
     queststatus = getPlayerStorageValue(cid,r)
     if queststatus == -1 then
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
       setPlayerStorageValue(cid,r,1)
       doPlayerAddItem(cid,2456,1) -- bow
       doPlayerAddItem(cid,2544,100) -- arrow
       doPlayerAddItem(cid,2544,100) -- arrow
       doPlayerAddItem(cid,2544,100) -- arrow
     end
   elseif r == 65527 then -- kina tile
     queststatus = getPlayerStorageValue(cid,r)
     if queststatus == -1 then
       doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
       setPlayerStorageValue(cid,r,1)
       doPlayerAddItem(cid,2379,1) -- sword
       doPlayerAddItem(cid,2382,1) -- club
       doPlayerAddItem(cid,2380,1) -- axe
     end
   end
   return true
end
 
Looks a little confusing when you're using same variable for storagevalue and a table pointer. Not sure if that was intended or not. Did you put these actionids through a mapeditor on the specific tiles you want this script executed on?
 
Look u can use something like this
if getPlayerStorageValue(cid,nimber storage) == 0 and isknight then
setPlayerStorageValue(cid,numberstorage,1)
doPlayerAddItem(cid,2379,1) -- sword
doPlayerAddItem(cid,2382,1) -- club
doPlayerAddItem(cid,2380,1) -- axe
end
 
Last edited:
The error is on check?
Code:
elseif r == 65529 then -- druid tile[

Yes, on your first line you already check if the tile's actionID is inside your table:
Code:
local r = tile[item.actionid]
Which means r points to a table value and does not equal the items action id.

Since you already started the table, you can just improve the table with the rest of the items you wanted to give to each vocation:
Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100} -- arrows
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1} -- club
        }
   }
}

function onStepIn(cid, item, position, fromPosition)
    local r = tile[item.actionid]
    if not r then
        return true
    end
 
    local queststatus = getPlayerStorageValue(cid, item.actionid)
    if queststatus ~= -1 then
        return true
    end
 
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    if r.weaponID then
        doPlayerAddItem(r.weaponID, 1)
    end
    if r.extraItems then
        for i=1,#r.extraItems do
            local item,count = r.extraItems[i].itemID, r.extraItems[i].count
            doPlayerAddItem(item, count)
        end
    end
return true
end
 
Last edited:
Looks a little confusing when you're using same variable for storagevalue and a table pointer. Not sure if that was intended or not. Did you put these actionids through a mapeditor on the specific tiles you want this script executed on?

I tried it to players take items only 1 time

Look u can use something like this
if getPlayerStorageValue(cid,nimber storage) == 0 and isknight then
setPlayerStorageValue(cid,numberstorage,1)
doPlayerAddItem(cid,2379,1) -- sword
doPlayerAddItem(cid,2382,1) -- club
doPlayerAddItem(cid,2380,1) -- axe
end

I don't understand, whats changed?

Yes, on your first line you already check if the tile's actionID is inside your table:
Code:
local r = tile[item.actionid]
Which means r points to a table value and does not equal the items action id.

Since you already started the table, you can just improve the table with the rest of the items you wanted to give to each vocation:
Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100} -- arrows
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1} -- club
        }
   }
}

function onStepIn(cid, item, position, fromPosition)
    local r = tile[item.actionid]
    if not r then
        return true
    end

    local queststatus = getPlayerStorageValue(cid, item.actionid)
    if queststatus ~= -1 then
        return true
    end

    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    if r.weaponID then
        doPlayerAddItem(r.weaponID, 1)
    end
    if r.extraItems then
        for i=1,#r.extraItems do
            local item,count = r.extraItems[i].itemID, r.extraItems[i].count
            doPlayerAddItem(item, count)
        end
    end
return true
end


I tried it, not work, just send heal effect, but show me this errors on console:

Code:
[4:21:03.855] [Error - MoveEvents Interface]
[4:21:03.856] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:03.856] Description:
[4:21:03.856] (luaDoPlayerAddItem) Player not found
[4:21:35.842] [8G]Tiago has logged out.

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:47.028] [Error - MoveEvents Interface]
[4:21:47.028] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.028] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:21:47.029] [Error - MoveEvents Interface]
[4:21:47.029] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.029] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:21:47.029] [Error - MoveEvents Interface]
[4:21:47.029] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.029] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:21:47.029] [Error - MoveEvents Interface]
[4:21:47.029] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.029] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found
[4:24:30.737] Oliver Jonas has logged out.

[4:30:29.795] [Error - MoveEvents Interface]
[4:30:29.795] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.795] Description:
[4:30:29.795] (luaDoPlayerAddItem) Player not found

[4:30:29.795] [Error - MoveEvents Interface]
[4:30:29.795] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.795] Description:
[4:30:29.795] (luaDoPlayerAddItem) Player not found

[4:30:29.795] [Error - MoveEvents Interface]
[4:30:29.795] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.796] Description:
[4:30:29.796] (luaDoPlayerAddItem) Player not found

[4:30:29.796] [Error - MoveEvents Interface]
[4:30:29.796] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.796] Description:
[4:30:29.796] (luaDoPlayerAddItem) Player not found
 
I tried it to players take items only 1 time



I don't understand, whats changed?




I tried it, not work, just send heal effect, but show me this errors on console:

Code:
[4:21:03.855] [Error - MoveEvents Interface]
[4:21:03.856] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:03.856] Description:
[4:21:03.856] (luaDoPlayerAddItem) Player not found
[4:21:35.842] [8G]Tiago has logged out.

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:46.566] [Error - MoveEvents Interface]
[4:21:46.566] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:46.566] Description:
[4:21:46.566] (luaDoPlayerAddItem) Player not found

[4:21:47.028] [Error - MoveEvents Interface]
[4:21:47.028] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.028] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:21:47.029] [Error - MoveEvents Interface]
[4:21:47.029] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.029] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:21:47.029] [Error - MoveEvents Interface]
[4:21:47.029] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.029] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:21:47.029] [Error - MoveEvents Interface]
[4:21:47.029] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:21:47.029] Description:
[4:21:47.029] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found

[4:22:49.167] [Error - MoveEvents Interface]
[4:22:49.167] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:22:49.167] Description:
[4:22:49.167] (luaDoPlayerAddItem) Player not found
[4:24:30.737] Oliver Jonas has logged out.

[4:30:29.795] [Error - MoveEvents Interface]
[4:30:29.795] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.795] Description:
[4:30:29.795] (luaDoPlayerAddItem) Player not found

[4:30:29.795] [Error - MoveEvents Interface]
[4:30:29.795] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.795] Description:
[4:30:29.795] (luaDoPlayerAddItem) Player not found

[4:30:29.795] [Error - MoveEvents Interface]
[4:30:29.795] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.796] Description:
[4:30:29.796] (luaDoPlayerAddItem) Player not found

[4:30:29.796] [Error - MoveEvents Interface]
[4:30:29.796] data/movements/scripts/dawnport_tiles.lua:onStepIn
[4:30:29.796] Description:
[4:30:29.796] (luaDoPlayerAddItem) Player not found

doPlayerAddItem(cid, x,x) --> the cid was missing, in TFS 1.x is coding a little differently xD
In your error message it shows that there is problem with "DoPlayerAddItem" and that the "Player was not found". So in the future fixing the error is pretty simple, just look for that function in your code, use the error message that it gives you, and see if you can find the solution.

Fixed below:
Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100} -- arrows
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1} -- club
        }
   }
}

function onStepIn(cid, item, position, fromPosition)
    local r = tile[item.actionid]
    if not r then
        return true
    end
    local queststatus = getPlayerStorageValue(cid, item.actionid)
    if queststatus ~= -1 then
        return true
    end
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    if r.weaponID then
        doPlayerAddItem(cid, r.weaponID, 1)
    end
    if r.extraItems then
        for i=1,#r.extraItems do
            local item,count = r.extraItems[i].itemID, r.extraItems[i].count
            doPlayerAddItem(cid, item, count)
        end
    end
return true
end
 
doPlayerAddItem(cid, x,x) --> the cid was missing, in TFS 1.x is coding a little differently xD
In your error message it shows that there is problem with "DoPlayerAddItem" and that the "Player was not found". So in the future fixing the error is pretty simple, just look for that function in your code, use the error message that it gives you, and see if you can find the solution.

Fixed below:
Code:
local tile = {
   --[actionid] = {vocation id}
   [65530] = {
        vocid = 1,
        weaponID = 2190, -- wand of vortex
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65529] = {
        vocid = 2,
        weaponID = 2182, -- snakebite rod
        extraItems = {
            {itemID = 2287, count = 100} -- lmm
        }
   },
   [65528] = {
        vocid = 3,
        weaponID = 2456, -- bow
        extraItems = {
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100}, -- arrows
            {itemID = 2544, count = 100} -- arrows
        }
   },
   [65527] = {
        vocid = 4,
        extraItems = {
            {itemID = 2379, count = 1}, -- sword
            {itemID = 2382, count = 1}, -- axe
            {itemID = 2380, count = 1} -- club
        }
   }
}

function onStepIn(cid, item, position, fromPosition)
    local r = tile[item.actionid]
    if not r then
        return true
    end
    local queststatus = getPlayerStorageValue(cid, item.actionid)
    if queststatus ~= -1 then
        return true
    end
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    if r.weaponID then
        doPlayerAddItem(cid, r.weaponID, 1)
    end
    if r.extraItems then
        for i=1,#r.extraItems do
            local item,count = r.extraItems[i].itemID, r.extraItems[i].count
            doPlayerAddItem(cid, item, count)
        end
    end
return true
end

Ty so much!
 
Back
Top