JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
Hello,
Another basic script for some people who are unable to create them.
data/actions/scripts/script.lua
Credits: JDB & Cykotitan.
Another basic script for some people who are unable to create them.
data/actions/scripts/script.lua
Code:
local t = {
[3000] = { -- UniqueID of the switch/lever
405, -- ground tile ID
{x = 100, y = 100, z = 7}, -- relocate position (creatures and items will be moved here)
{x = 100, y = 100, z = 7}, -- tile positions start here
{x = 100, y = 100, z = 7},
{x = 100, y = 100, z = 7},
{x = 100, y = 100, z = 7}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = t[item.uid]
if v then
for i = 3, #v do
v.stackpos = 0
local k = getThingFromPos(v).uid
if k ~= 0 then
doRelocate(v, v[2])
doRemoveItem(k)
else
doCreateItem(v[1], 1, v)
end
end
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
Credits: JDB & Cykotitan.
Last edited: