• 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 onStepIn Problem

charlyhustle

Member
Joined
Dec 9, 2011
Messages
47
Reaction score
6
Hi guys,

I wrote a script for a quest but I'm struggling with getting it to work.

Here's what i did:

movements.xml:
XML:
<movevent event="StepIn" actionid="56000" script="script.lua" />

script.lua:
Lua:
function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)

    if not player then creature:teleportTo(fromPosition) return true end
    
    if item.itemid == 8426 then
        if player:getStorageValue(quest) < 2 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "some text")
        end
    elseif item.itemid == 459 then
        if player:getStorageValue(quest) == -1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "some more text")
            player:setStorageValue(quest, 0)
        end
    elseif item.itemid == 19744 --to reset storage for testing purposes
        player:setStorageValue(quest, -1)
    end
    return true
end

The reason I did it this way is because I got multiple tiles that should trigger the first and second message.
I'm neither getting an error in the console nor does it show any message or anything else.
I think there might even be a better solution to achieve what i want?

Thanks in advance!
 
Did you set the storage where you wrote "quest"?
Also, have you put the exact tile ID on the places you want?

if item.itemid == 8426 then
elseif item.itemid == 459 then
elseif item.itemid == 19744
 
Did you set the storage where you wrote "quest"?
Also, have you put the exact tile ID on the places you want?

if item.itemid == 8426 then
elseif item.itemid == 459 then
elseif item.itemid == 19744
Yes I set the storage in storage.lua.
i put the exact tile ID.

Here's what it looks like in RME:

quest.png

quest2.png
 
Solution
Back
Top