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

TFS 1.X+ addevent error tfs 1.5

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,337
Solutions
71
Reaction score
697
Location
ლ(ಠ益ಠლ)
I've tried to fix this problem several times without success... I'm not very good with addevent in LUA... Can anyone solve the problem? When I place the item on a statue so that it removes the wall, a few minutes later, the wall comes back again, and the item appears in the same place. This allows another player to walk by and pick up the item. Repeat the process in the same way, understand?

The script does not have the wall return again, but I would like to add the wall return and also have the item return in the statue.



watch the video here:

XML:
Lua Script Error: [Action Interface]
data/actions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:onUse
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        ...tions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:294: in function <...tions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:28>

Lua:
local function Crystal2(cid)
end

local function Crystal3(cid)
end

local function Crystal4(cid)
end

local function Crystal5(cid)
end

local function Crystal6(cid)
end

local function Crystal7(cid)
end

local function Crystal8(cid)
end

local function Crystal9(cid)
end

local function Crystal10(cid)
end

function onUse(cid, item, frompos, item2, topos)

if item2.actionid == 100 and item2.itemid == 3900 then

wall1 = {x=1223, y=549, z=13, stackpos=1}
wall2 = {x=1222, y=547, z=13, stackpos=1}
wall3 = {x=1222, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(4851,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid,22,"get hear on something open.")
doRemoveItem(item.uid,1)

-------------------------------------------------------------

elseif item2.actionid == 200 and item2.itemid == 3900 then

wall1 = {x=1235, y=549, z=13, stackpos=1}
wall2 = {x=1234, y=547, z=13, stackpos=1}
wall3 = {x=1234, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal2, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 300 and item2.itemid == 3900 then

wall1 = {x=1250, y=549, z=13, stackpos=1}
wall2 = {x=1249, y=547, z=13, stackpos=1}
wall3 = {x=1249, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal3, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 400 and item2.itemid == 3900 then

wall1 = {x=1268, y=549, z=13, stackpos=1}
wall2 = {x=1267, y=547, z=13, stackpos=1}
wall3 = {x=1267, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal4, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 500 and item2.itemid == 3900 then

wall1 = {x=1271, y=557, z=13, stackpos=1}
wall2 = {x=1269, y=556, z=13, stackpos=1}
wall3 = {x=1269, y=556, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal5, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 600 and item2.itemid == 3900 then

wall1 = {x=1271, y=567, z=13, stackpos=1}
wall2 = {x=1269, y=566, z=13, stackpos=1}
wall3 = {x=1269, y=566, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal6, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 700 and item2.itemid == 3900 then

wall1 = {x=1271, y=581, z=13, stackpos=1}
wall2 = {x=1269, y=580, z=13, stackpos=1}
wall3 = {x=1269, y=580, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal7, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 800 and item2.itemid == 3900 then

wall1 = {x=1258, y=584, z=13, stackpos=1}
wall2 = {x=1259, y=582, z=13, stackpos=1}
wall3 = {x=1259, y=582, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal8, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 900 and item2.itemid == 3900 then

wall1 = {x=1242, y=584, z=13, stackpos=1}
wall2 = {x=1243, y=582, z=13, stackpos=1}
wall3 = {x=1243, y=582, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal9, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 1000 and item2.itemid == 3900 then

wall1 = {x=1228, y=584, z=13, stackpos=1}
wall2 = {x=1229, y=582, z=13, stackpos=1}
wall3 = {x=1229, y=582, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
-------------------------------------------------------------

elseif item2.actionid == 1300 and item2.itemid == 3900 then

wall1 = {x=1261, y=568, z=13, stackpos=1}
wall2 = {x=1253, y=568, z=13, stackpos=1}
wall3 = {x=1253, y=568, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
-------------------------------------------------------------

elseif item2.actionid == 1100 and item2.itemid == 3900 then

wall1 = {x=1195, y=545, z=14, stackpos=1}
wall2 = {x=1200, y=543, z=14, stackpos=1}
wall3 = {x=1200, y=543, z=14, stackpos=1}
m1 = {x=1193, y=548, z=14, stackpos=1}
m2 = {x=1193, y=550, z=14, stackpos=1}
m3 = {x=1197, y=548, z=14, stackpos=1}
m4 = {x=1197, y=550, z=14, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
monster1 = getThingfromPos(m1)
monster2 = getThingfromPos(m2)
monster3 = getThingfromPos(m3)
monster4 = getThingfromPos(m4)

doRemoveItem(getwall1.uid,1)
doRemoveItem(monster2.uid,1)
doRemoveItem(monster3.uid,1)
doRemoveItem(monster4.uid,1)
doRemoveItem(monster1.uid,1)
doSummonCreature("Guardian Gargoyle", m1)
doSummonCreature("Guardian Gargoyle", m2)
doSummonCreature("Guardian Gargoyle", m3)
doSummonCreature("Guardian Gargoyle", m4)
doCreateItem(1459,1,m1)
doCreateItem(1459,1,m2)
doCreateItem(1458,1,m3)
doCreateItem(1458,1,m4)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
end
end
 
Solution
I've tried to fix this problem several times without success... I'm not very good with addevent in LUA... Can anyone solve the problem? When I place the item on a statue so that it removes the wall, a few minutes later, the wall comes back again, and the item appears in the same place. This allows another player to walk by and pick up the item. Repeat the process in the same way, understand?

The script does not have the wall return again, but I would like to add the wall return and also have the item return in the statue.



watch the video here:

XML:
Lua Script Error: [Action Interface]
data/actions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:onUse
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack...
I've tried to fix this problem several times without success... I'm not very good with addevent in LUA... Can anyone solve the problem? When I place the item on a statue so that it removes the wall, a few minutes later, the wall comes back again, and the item appears in the same place. This allows another player to walk by and pick up the item. Repeat the process in the same way, understand?

The script does not have the wall return again, but I would like to add the wall return and also have the item return in the statue.



watch the video here:

XML:
Lua Script Error: [Action Interface]
data/actions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:onUse
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        ...tions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:294: in function <...tions/scripts/Quests/Quest Tirith/Valan/Life Crystal.lua:28>

Lua:
local function Crystal2(cid)
end

local function Crystal3(cid)
end

local function Crystal4(cid)
end

local function Crystal5(cid)
end

local function Crystal6(cid)
end

local function Crystal7(cid)
end

local function Crystal8(cid)
end

local function Crystal9(cid)
end

local function Crystal10(cid)
end

function onUse(cid, item, frompos, item2, topos)

if item2.actionid == 100 and item2.itemid == 3900 then

wall1 = {x=1223, y=549, z=13, stackpos=1}
wall2 = {x=1222, y=547, z=13, stackpos=1}
wall3 = {x=1222, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(4851,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid,22,"get hear on something open.")
doRemoveItem(item.uid,1)

-------------------------------------------------------------

elseif item2.actionid == 200 and item2.itemid == 3900 then

wall1 = {x=1235, y=549, z=13, stackpos=1}
wall2 = {x=1234, y=547, z=13, stackpos=1}
wall3 = {x=1234, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal2, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 300 and item2.itemid == 3900 then

wall1 = {x=1250, y=549, z=13, stackpos=1}
wall2 = {x=1249, y=547, z=13, stackpos=1}
wall3 = {x=1249, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal3, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 400 and item2.itemid == 3900 then

wall1 = {x=1268, y=549, z=13, stackpos=1}
wall2 = {x=1267, y=547, z=13, stackpos=1}
wall3 = {x=1267, y=547, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal4, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 500 and item2.itemid == 3900 then

wall1 = {x=1271, y=557, z=13, stackpos=1}
wall2 = {x=1269, y=556, z=13, stackpos=1}
wall3 = {x=1269, y=556, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal5, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 600 and item2.itemid == 3900 then

wall1 = {x=1271, y=567, z=13, stackpos=1}
wall2 = {x=1269, y=566, z=13, stackpos=1}
wall3 = {x=1269, y=566, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal6, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 700 and item2.itemid == 3900 then

wall1 = {x=1271, y=581, z=13, stackpos=1}
wall2 = {x=1269, y=580, z=13, stackpos=1}
wall3 = {x=1269, y=580, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal7, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 800 and item2.itemid == 3900 then

wall1 = {x=1258, y=584, z=13, stackpos=1}
wall2 = {x=1259, y=582, z=13, stackpos=1}
wall3 = {x=1259, y=582, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal8, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 900 and item2.itemid == 3900 then

wall1 = {x=1242, y=584, z=13, stackpos=1}
wall2 = {x=1243, y=582, z=13, stackpos=1}
wall3 = {x=1243, y=582, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal9, 120 * 1000, cid)

-------------------------------------------------------------

elseif item2.actionid == 1000 and item2.itemid == 3900 then

wall1 = {x=1228, y=584, z=13, stackpos=1}
wall2 = {x=1229, y=582, z=13, stackpos=1}
wall3 = {x=1229, y=582, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
-------------------------------------------------------------

elseif item2.actionid == 1300 and item2.itemid == 3900 then

wall1 = {x=1261, y=568, z=13, stackpos=1}
wall2 = {x=1253, y=568, z=13, stackpos=1}
wall3 = {x=1253, y=568, z=13, stackpos=1}

getwall1 = getThingfromPos(wall1)

doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
-------------------------------------------------------------

elseif item2.actionid == 1100 and item2.itemid == 3900 then

wall1 = {x=1195, y=545, z=14, stackpos=1}
wall2 = {x=1200, y=543, z=14, stackpos=1}
wall3 = {x=1200, y=543, z=14, stackpos=1}
m1 = {x=1193, y=548, z=14, stackpos=1}
m2 = {x=1193, y=550, z=14, stackpos=1}
m3 = {x=1197, y=548, z=14, stackpos=1}
m4 = {x=1197, y=550, z=14, stackpos=1}

getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
monster1 = getThingfromPos(m1)
monster2 = getThingfromPos(m2)
monster3 = getThingfromPos(m3)
monster4 = getThingfromPos(m4)

doRemoveItem(getwall1.uid,1)
doRemoveItem(monster2.uid,1)
doRemoveItem(monster3.uid,1)
doRemoveItem(monster4.uid,1)
doRemoveItem(monster1.uid,1)
doSummonCreature("Guardian Gargoyle", m1)
doSummonCreature("Guardian Gargoyle", m2)
doSummonCreature("Guardian Gargoyle", m3)
doSummonCreature("Guardian Gargoyle", m4)
doCreateItem(1459,1,m1)
doCreateItem(1459,1,m2)
doCreateItem(1458,1,m3)
doCreateItem(1458,1,m4)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
end
end
Lua:
local function Crystal2(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end
local function Crystal3(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal4(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal5(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal6(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal7(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal8(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal9(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

local function Crystal10(cid)
    local player = Player(cid)
    if not player then return end
    -- Your code HERE
end

function onUse(cid, item, frompos, item2, topos)
if item2.actionid == 100 and item2.itemid == 3900 then
wall1 = {x=1223, y=549, z=13, stackpos=1}
wall2 = {x=1222, y=547, z=13, stackpos=1}
wall3 = {x=1222, y=547, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(4851,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid,22,"get hear on something open.")
doRemoveItem(item.uid,1)
-------------------------------------------------------------
elseif item2.actionid == 200 and item2.itemid == 3900 then
wall1 = {x=1235, y=549, z=13, stackpos=1}
wall2 = {x=1234, y=547, z=13, stackpos=1}
wall3 = {x=1234, y=547, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal2, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 300 and item2.itemid == 3900 then
wall1 = {x=1250, y=549, z=13, stackpos=1}
wall2 = {x=1249, y=547, z=13, stackpos=1}
wall3 = {x=1249, y=547, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal3, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 400 and item2.itemid == 3900 then
wall1 = {x=1268, y=549, z=13, stackpos=1}
wall2 = {x=1267, y=547, z=13, stackpos=1}
wall3 = {x=1267, y=547, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal4, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 500 and item2.itemid == 3900 then
wall1 = {x=1271, y=557, z=13, stackpos=1}
wall2 = {x=1269, y=556, z=13, stackpos=1}
wall3 = {x=1269, y=556, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal5, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 600 and item2.itemid == 3900 then
wall1 = {x=1271, y=567, z=13, stackpos=1}
wall2 = {x=1269, y=566, z=13, stackpos=1}
wall3 = {x=1269, y=566, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal6, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 700 and item2.itemid == 3900 then
wall1 = {x=1271, y=581, z=13, stackpos=1}
wall2 = {x=1269, y=580, z=13, stackpos=1}
wall3 = {x=1269, y=580, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal7, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 800 and item2.itemid == 3900 then
wall1 = {x=1258, y=584, z=13, stackpos=1}
wall2 = {x=1259, y=582, z=13, stackpos=1}
wall3 = {x=1259, y=582, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal8, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 900 and item2.itemid == 3900 then
wall1 = {x=1242, y=584, z=13, stackpos=1}
wall2 = {x=1243, y=582, z=13, stackpos=1}
wall3 = {x=1243, y=582, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal9, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 1000 and item2.itemid == 3900 then
wall1 = {x=1228, y=584, z=13, stackpos=1}
wall2 = {x=1229, y=582, z=13, stackpos=1}
wall3 = {x=1229, y=582, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid:getId())
-------------------------------------------------------------
elseif item2.actionid == 1300 and item2.itemid == 3900 then
wall1 = {x=1261, y=568, z=13, stackpos=1}
wall2 = {x=1253, y=568, z=13, stackpos=1}
wall3 = {x=1253, y=568, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
doRemoveItem(getwall1.uid,1)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid)
-------------------------------------------------------------
elseif item2.actionid == 1100 and item2.itemid == 3900 then
wall1 = {x=1195, y=545, z=14, stackpos=1}
wall2 = {x=1200, y=543, z=14, stackpos=1}
wall3 = {x=1200, y=543, z=14, stackpos=1}
m1 = {x=1193, y=548, z=14, stackpos=1}
m2 = {x=1193, y=550, z=14, stackpos=1}
m3 = {x=1197, y=548, z=14, stackpos=1}
m4 = {x=1197, y=550, z=14, stackpos=1}
getwall1 = getThingfromPos(wall1)
getwall2 = getThingfromPos(wall2)
getwall3 = getThingfromPos(wall3)
monster1 = getThingfromPos(m1)
monster2 = getThingfromPos(m2)
monster3 = getThingfromPos(m3)
monster4 = getThingfromPos(m4)
doRemoveItem(getwall1.uid,1)
doRemoveItem(monster2.uid,1)
doRemoveItem(monster3.uid,1)
doRemoveItem(monster4.uid,1)
doRemoveItem(monster1.uid,1)
doSummonCreature("Guardian Gargoyle", m1)
doSummonCreature("Guardian Gargoyle", m2)
doSummonCreature("Guardian Gargoyle", m3)
doSummonCreature("Guardian Gargoyle", m4)
doCreateItem(1459,1,m1)
doCreateItem(1459,1,m2)
doCreateItem(1458,1,m3)
doCreateItem(1458,1,m4)
doCreateItem(2177,1,wall2)
doCreateItem(5070,1,wall3)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, "Cleck!", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
addEvent(Crystal10, 120 * 1000, cid:getId())
end
end

in TFS 1.x+ all events receive user data as parameters instead of the creature ID.
so the old scripts don't work as expected.

As you may notice I am using the getId method to the cid variable, since it is actually a userdata and not a number.
Please read some of the tutorials regarding the addEvent method, there is a lot of information about it.
 
Solution
Thank you very much, it solved the problem! I'm going to study about this addevent's tutorial, my head is bad. I have a lot of running around all day, work and college have a lot of things. It got tiring... So, another heartfelt thank you!
 
Back
Top