• 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!

[lua] Event onUse not found.

ibkfly

New Member
Joined
Jan 1, 2010
Messages
69
Reaction score
4
Lua:
function onStepIn(cid, item, position, lastPosition)

local portal = {x = 1375, y = 500, z = 9}
local finishedqueststorage = 14001
local player = Player(cid)

if (player:getStorageValue(finishedqueststorage) == 14001) then
doTeleportThing(player, portal)
doSendMagicEffect(portal, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The magic field has thrown you into the daedric abyss!")
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not prepared for facing the dangers of the dungeon.")
end

return true
end

error in console as thread title says. Any suggestions?
 
You get that error "Event onUse not found" because you are trying to use a movement script onStepIn as an action (onUse).

Action
Code:
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)

Movement
Code:
function onStepIn(cid, item, position, fromPosition)

Also cleaned up your code abit:
Code:
function onStepIn(cid, item, position, fromPosition)
    local portal = Position(1375, 500, 9)
    local finishedqueststorage = 14001
    local player = Player(cid)
    if not player then -- Prohibit crash in case no player trig the event.
        return true
    end

    if player:getStorageValue(finishedqueststorage) == 14001 then
        player:teleportTo(portal)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "The magic field has thrown you into the daedric abyss!")
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not prepared for facing the dangers of the dungeon.")
    end
    return true
end
 
Last edited:
ahh, thanks man. just figured it out myself. was looking at a 1.1 VIP system script here on the forum. instead of using vip time i was making the teleport only usable after finishing a quest, getting storage 14001. That was already configured by an NPC and creature event. so i was a bit quick and put the teleport script where the vip item script (actions map instead of movements) from the thread was.
 
Back
Top Bottom