igorbr
New Member
- Joined
- Jan 9, 2008
- Messages
- 34
- Reaction score
- 0
It's to many complex:
this is a script of switchs to remove something from a specific pos:
PARAMETERS
switchUniqueId = uniqueid of switch, i use 3500
itemid = id of item that will be removed
pos = position of item
scapePos = if something is on the pos, will be teleported to this pos (items and creatures)
duration = the removal duration
lets go script:
in data/actions/scripts add a file named switchThingRemover.lua
and put inside this:
in actions.xml add the line:
like?
rep for me xD
credts: me (Shadowman)
this is a script of switchs to remove something from a specific pos:
PARAMETERS
switchUniqueId = uniqueid of switch, i use 3500
itemid = id of item that will be removed
pos = position of item
scapePos = if something is on the pos, will be teleported to this pos (items and creatures)
duration = the removal duration
lets go script:
in data/actions/scripts add a file named switchThingRemover.lua
and put inside this:
PHP:
-- Switch advanced script created by Shadowman.
-- It's more than Perfect!
-- CONFIGURATIONS
-- ADD NEW ITEMS TO REMOVE HERE
local removeThingConfig = {
[3500]={ -- unique id of switch
[1] = {itemid = 1025, pos = {x=580, y=939, z=10}, scapePos = {x=581, y=939, z=10}, duration = 5*60*1000}, -- first item to remove (only this have duration(is for all items))
[2] = {itemid = 1025, pos = {x=581, y=939, z=10}, scapePos = {x=581, y=939, z=10}} -- second item to remove
},
}
-- DONT EDIT HERE
function onUse(cid, item, frompos, item2, topos)
if removeThingConfig[item.uid] then
if item.itemid == 1945 then
local canAddEvent = 0
for a = 1, table.maxn(removeThingConfig[item.uid]) do
local itemPos = {x=removeThingConfig[item.uid][a].pos.x,y=removeThingConfig[item.uid][a].pos.y,z=removeThingConfig[item.uid][a].pos.z,stackpos=1}
local itemEx = getTileThingByPos(itemPos)
if removeThingConfig[item.uid][1].duration > 0 then
canAddEvent = canAddEvent + 1
end
doRemoveItem(itemEx.uid)
doSendMagicEffect(removeThingConfig[item.uid][a].pos, CONST_ME_POFF)
end
if canAddEvent == table.maxn(removeThingConfig[item.uid]) then
eventID = addEvent(doReloadParameters, removeThingConfig[item.uid][1].duration, item)
end
doTransformItem(item.uid, 1946)
elseif item.itemid == 1946 then
doReloadParameters(item)
stopEvent(eventID)
end
else
return false
end
return true
end
function doReloadParameters(item)
for a = 1, table.maxn(removeThingConfig[item.uid]) do
local i = 0
while (i == 0) do
local getThing = getTileThingByPos({x=removeThingConfig[item.uid][a].pos.x,y=removeThingConfig[item.uid][a].pos.y,z=removeThingConfig[item.uid][a].pos.z,stackpos=1})
if isMovable(getThing.uid) == true then
doTeleportThing(getThing.uid, removeThingConfig[item.uid][a].scapePos)
else
i = 1
end
end
doCreateItem(removeThingConfig[item.uid][a].itemid, 1, removeThingConfig[item.uid][a].pos)
doSendMagicEffect(removeThingConfig[item.uid][a].pos, CONST_ME_TELEPORT)
doTransformItem(item.uid, 1945)
end
return true
end
in actions.xml add the line:
PHP:
<action uniqueid="3500" event="script" value="switchThingRemover.lua"/>
like?
rep for me xD
credts: me (Shadowman)