Hi guys!
I've been trying to adapt this wall lever script to my tfs 1.2 server:
This is the script Im using:
The pilar gets removed and then it gets created again but my lever is not turning to the left
Console Error:
data/actions/scripts/pilar.lua:12: attempt to index local 'lever' (a number value)
stack traceback:
[C]: in function '__index'
Could anybody please be so kind to help me?
Thanks!
I've been trying to adapt this wall lever script to my tfs 1.2 server:
[How-to] Using addEvent()
I'm gonna get straight to the point and make this very simple. I had a thread already written up before this one, but I got too complex, if you want to get into the more complex stuff, feel free to post here, we can talk about it. Making this tutorial complex to understand is not my goal...
otland.net
This is the script Im using:
Code:
<action actionid="1356" script="pilar.lua"/>
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
local pillarTile = Tile(X, Y, Z)
if item.itemid == 1945 then
pillarTile:getPosition():sendMagicEffect(CONST_ME_POFF)
pillarTile:getItemById(1515):remove()
Item(item.uid):transform(1946)
addEvent(function(pillarPos, lever)
Game.createItem(1515, 1, pillarPos) -- Create pillar
pillarPos:sendMagicEffect(CONST_ME_POFF) -- Send POFF effect
lever:transform(1945) -- Flip lever to the left
end, 3000, pillarTile:getPosition(), Tile(toPosition):getItemById(1946))
elseif item.itemid == 1946 then
return false
end
return true
end
The pilar gets removed and then it gets created again but my lever is not turning to the left
Console Error:
data/actions/scripts/pilar.lua:12: attempt to index local 'lever' (a number value)
stack traceback:
[C]: in function '__index'
Could anybody please be so kind to help me?
Thanks!
Last edited: