local dir = {
up = 4050,
right = 4051,
down = 4052,
left = 4053
}
local cfg = {
mon = "" --write monster name here
}
function onStepIn(cid, item, toPosition, fromPosition)
local pos = {
leftDown = {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z},
leftUp = {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z},
rightDown = {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z},
rightUp = {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z}
}
if item.actionid == dir.up then
doCreateMonster(cfg.mon, pos.leftUp)
doCreateMonster(cfg.mon, pos.rightUp)
doSendMagicEffect(pos.leftUp, 13)
doSendMagicEffect(pos.rightUp, 13)
doTransformItem(item.uid, item.itemid-1)
end
if item.actionid == dir.right then
doCreateMonster(cfg.mon, pos.rightDown)
doCreateMonster(cfg.mon, pos.rightUp)
doSendMagicEffect(pos.rightDown, 13)
doSendMagicEffect(pos.rightUp, 13)
doTransformItem(item.uid, item.itemid-1)
end
if item.actionid == dir.down then
doCreateMonster(cfg.mon, pos.rightDown)
doCreateMonster(cfg.mon, pos.leftDown)
doSendMagicEffect(pos.rightDown, 13)
doSendMagicEffect(pos.leftDown, 13)
doTransformItem(item.uid, item.itemid-1)
end
if item.actionid == dir.left then
doCreateMonster(cfg.mon, pos.leftUp)
doCreateMonster(cfg.mon, pos.leftDown)
doSendMagicEffect(pos.leftUp, 13)
doSendMagicEffect(pos.leftDown, 13)
doTransformItem(item.uid, item.itemid-1)
end
end
function onStepOut(cid, item, fromPosition)
local pos2 = {
leftDown = {x = fromPosition.x-1, y = fromPosition.y+1, z = fromPosition.z, stackpos = 255},
leftUp = {x = fromPosition.x-1, y = fromPosition.y-1, z = fromPosition.z, stackpos = 255},
rightDown = {x = fromPosition.x+1, y = fromPosition.y+1, z = fromPosition.z, stackpos = 255},
rightUp = {x = fromPosition.x+1, y = fromPosition.y-1, z = fromPosition.z, stackpos = 255}
}
if item.actionid == dir.up then
local getMon1 = getThingfromPos(pos2.rightUp)
local getMon2 = getThingfromPos(pos2.leftUp)
if getMon1.uid > 0 and getMon2.uid > 0 then
doRemoveCreature(getMon1.uid)
doRemoveCreature(getMon2.uid)
doSendMagicEffect(pos2.rightUp, 13)
doSendMagicEffect(pos2.leftUp, 13)
end
doTransformItem(item.uid, item.itemid+1)
end
if item.actionid == dir.right then
local getMon1 = getThingfromPos(pos2.rightUp)
local getMon2 = getThingfromPos(pos2.rightDown)
if getMon1.uid > 0 and getMon2.uid > 0 then
doRemoveCreature(getMon1.uid)
doRemoveCreature(getMon2.uid)
doSendMagicEffect(pos2.rightUp, 13)
doSendMagicEffect(pos2.rightDown, 13)
end
doTransformItem(item.uid, item.itemid+1)
end
if item.actionid == dir.down then
local getMon1 = getThingfromPos(pos2.rightDown)
local getMon2 = getThingfromPos(pos2.leftDown)
if getMon1.uid > 0 and getMon2.uid > 0 then
doRemoveCreature(getMon1.uid)
doRemoveCreature(getMon2.uid)
doSendMagicEffect(pos2.rightDown, 13)
doSendMagicEffect(pos2.leftDown, 13)
end
doTransformItem(item.uid, item.itemid+1)
end
if item.actionid == dir.left then
local getMon1 = getThingfromPos(pos2.leftDown)
local getMon2 = getThingfromPos(pos2.leftUp)
if getMon1.uid > 0 and getMon2.uid > 0 then
doRemoveCreature(getMon1.uid)
doRemoveCreature(getMon2.uid)
doSendMagicEffect(pos2.leftDown, 13)
doSendMagicEffect(pos2.leftUp, 13)
end
doTransformItem(item.uid, item.itemid+1)
end
end