• 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 when obtaining storage, receive a letter on DP

antonio664

Member
Joined
Jan 9, 2013
Messages
129
Reaction score
5
I wanted a script that when the player has x storage, receive a letter with a text

(TFS 1.3)
 
Solution
add this to data/scripts under any file name:

Lua:
local moveevent = MoveEvent()

function moveevent.onStepIn(creature, item, position, fromPosition)
    if player:getStorageValue(123) == -1 then -- no storage
        -- do nothing
        return true
    else
        local letter = player:addItem(2598, 1)
        if letter then
            letter:setAttribute(ITEM_ATTRIBUTE_TEXT, "your text here")
            local inbox = player:getInbox()
            letter:moveTo(inbox)
        end
        player:setStorageValue(123, 1)
    end
    return true
end

moveevent:register()
Lua:
local moveevent = MoveEvent()
local storageKey = 123

function moveevent.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer()...
Ok first of all
"I want" is not how you ask for help or a request. So my answer here: Ok, nice that you want that. Good for you.
And also more details would be nice. "A player has x storage"?
Looking through your postings, you have always either been rude/demanding or not giving any information. Which is probably the reason why most of your questions/demands are unanswered or ignored.
 
how will the player receive this storage?

per tile
Post automatically merged:

Ok first of all
"I want" is not how you ask for help or a request. So my answer here: Ok, nice that you want that. Good for you.
And also more details would be nice. "A player has x storage"?
Looking through your postings, you have always either been rude/demanding or not giving any information. Which is probably the reason why most of your questions/demands are unanswered or ignored.

sorry if i looked rude.
My English is bad, that's why it's so limited
Post automatically merged:

the idea was that the player would receive some information after obtaining storage(any)
You see
Post automatically merged:

example

@Evil Puncker @Merrok

If player has x storage, receive a letterin the depot.
By global events range
 
Last edited:
add this to data/scripts under any file name:

Lua:
local moveevent = MoveEvent()

function moveevent.onStepIn(creature, item, position, fromPosition)
    if player:getStorageValue(123) == -1 then -- no storage
        -- do nothing
        return true
    else
        local letter = player:addItem(2598, 1)
        if letter then
            letter:setAttribute(ITEM_ATTRIBUTE_TEXT, "your text here")
            local inbox = player:getInbox()
            letter:moveTo(inbox)
        end
        player:setStorageValue(123, 1)
    end
    return true
end

moveevent:register()
 
add this to data/scripts under any file name:

Lua:
local moveevent = MoveEvent()

function moveevent.onStepIn(creature, item, position, fromPosition)
    if player:getStorageValue(123) == -1 then -- no storage
        -- do nothing
        return true
    else
        local letter = player:addItem(2598, 1)
        if letter then
            letter:setAttribute(ITEM_ATTRIBUTE_TEXT, "your text here")
            local inbox = player:getInbox()
            letter:moveTo(inbox)
        end
        player:setStorageValue(123, 1)
    end
    return true
end

moveevent:register()
Lua:
local moveevent = MoveEvent()
local storageKey = 123

function moveevent.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end

    if creature:getStorageValue(storageKey) == 1 then
        local letter = Game.createItem(2598)
        letter:setAttribute(ITEM_ATTRIBUTE_TEXT, "your text here")
        letter:moveTo(creature:getInbox())

        creature:setStorageValue(storageKey, 2)
    end
    return true
end

moveevent:register()

Less garbage
 
Solution
Select thread as solved by selecting Best answer to the reply you think will do best for your needs.
 
Back
Top