Hi, please help me pass this StepIn script to OnUse. Or simply a teleport scroll that does not let you travel with that storage
Lua:
local config = {
[59810] = {position = Position(32211, 32076, 15)}
}
local nightmareCastle = MoveEvent()
function nightmareCastle.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return false
end
for index, value in pairs(config) do
if item.actionid == index then
if(item.actionid == 59810)then
if(player:getStorageValue(Storage.DreamCourts.DreamScar.nightmareTimer) > os.time())then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.")
player:teleportTo(fromPosition, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return false
end
end
doSendMagicEffect(player:getPosition(), CONST_ME_TELEPORT)
player:teleportTo(value.position)
doSendMagicEffect(value.position, CONST_ME_TELEPORT)
end
end
end
nightmareCastle:type("stepin")
for index, value in pairs(config) do
nightmareCastle:aid(index)
end
nightmareCastle:register()