• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts Help script StepIn transform OnUse

adrenysny

Member
Joined
Feb 17, 2021
Messages
140
Reaction score
14
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()
 
Solution
E
something like this, just change item id:

Lua:
local nightmareCastle = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)

function nightmareCastle.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
    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.")
        return false
    end
    player:teleportTo(Position(32211, 32076, 15))
    return true
end

nightmareCastle:id(2550) -- the item is a scythe
nightmareCastle:register() -- this is our footer, it has to be the last function executed
something like this, just change item id:

Lua:
local nightmareCastle = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)

function nightmareCastle.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
    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.")
        return false
    end
    player:teleportTo(Position(32211, 32076, 15))
    return true
end

nightmareCastle:id(2550) -- the item is a scythe
nightmareCastle:register() -- this is our footer, it has to be the last function executed
 
Solution
something like this, just change item id:

Lua:
local nightmareCastle = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)

function nightmareCastle.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
    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.")
        return false
    end
    player:teleportTo(Position(32211, 32076, 15))
    return true
end

nightmareCastle:id(2550) -- the item is a scythe
nightmareCastle:register() -- this is our footer, it has to be the last function executed


thank you very much bro if it worked for me
 
Back
Top