• 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 Use item gain minimap marks

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,332
Reaction score
142
Hey, i want to ask for such script, if player use item, item dissapears ofc, and give 1-xx ammount of minimap marks pernamently for player ? character ?

tfs 1.4+
 
You can change the storage to numbers instead of calling it from the lib.
Lua:
--[[
    MAPMARK_TICK = 0,
    MAPMARK_QUESTION = 1,
    MAPMARK_EXCLAMATION = 2,
    MAPMARK_STAR = 3,
    MAPMARK_CROSS = 4,
    MAPMARK_TEMPLE = 5,
    MAPMARK_KISS = 6,
    MAPMARK_SHOVEL = 7,
    MAPMARK_SWORD = 8,
    MAPMARK_FLAG = 9,
    MAPMARK_LOCK = 10,
    MAPMARK_BAG = 11,
    MAPMARK_SKULL = 12,
    MAPMARK_DOLLAR = 13,
    MAPMARK_REDNORTH = 14,
    MAPMARK_REDSOUTH = 15,
    MAPMARK_REDEAST = 16,
    MAPMARK_REDWEST = 17,
    MAPMARK_GREENNORTH = 18,
    MAPMARK_GREENSOUTH = 19,
]]

local mapMarks = {
    [6578] = {
        {
            position = Position(1030, 1030, 7),
            type = MAPMARK_TEMPLE,
            text = "Temple"
        },
        {
            position = Position(1040, 1040, 7),
            type = MAPMARK_SHOVEL,
            text = "Hunts"
        },
        premium = false,
        storage = PlayerStorageKeys.markstorageone
    },
    [9941] = {
        {
            position = Position(1050, 1050, 7),
            type = MAPMARK_FLAG,
            text = "Depot"
        },
        {
            position = Position(1060, 1060, 7),
            type = MAPMARK_BAG,
            text = "Quests"
        },
        premium = true,
        storage = PlayerStorageKeys.markstoragetwo
    }
}

local mapMark = Action()

function mapMark.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local minimapItems = mapMarks[item.itemid]
    local playerPosition = player:getPosition()

    if not player:isPremium() and minimapItems.premium then
        player:sendCancelMessage("You need a premium account.")
        return true
    end

    if player:getStorageValue(minimapItems.storage) == 1 then -- optional to avoid players using the same item once more.
        player:sendCancelMessage("You have already marked this position.")
        return true
    end

    for _, minimapItem in ipairs(minimapItems) do
        player:addMapMark(minimapItem.position, minimapItem.type, minimapItem.text)
    end

    player:setStorageValue(minimapItems.storage, 1)
    playerPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have explored and marked new maps!")
    item:remove(1)
    return true
end

for id, _ in pairs(mapMarks) do
    mapMark:id(id)
end

mapMark:register()
 
Last edited:
You can change the storage to numbers instead of calling it from the lib.
Lua:
--[[
    MAPMARK_TICK = 0,
    MAPMARK_QUESTION = 1,
    MAPMARK_EXCLAMATION = 2,
    MAPMARK_STAR = 3,
    MAPMARK_CROSS = 4,
    MAPMARK_TEMPLE = 5,
    MAPMARK_KISS = 6,
    MAPMARK_SHOVEL = 7,
    MAPMARK_SWORD = 8,
    MAPMARK_FLAG = 9,
    MAPMARK_LOCK = 10,
    MAPMARK_BAG = 11,
    MAPMARK_SKULL = 12,
    MAPMARK_DOLLAR = 13,
    MAPMARK_REDNORTH = 14,
    MAPMARK_REDSOUTH = 15,
    MAPMARK_REDEAST = 16,
    MAPMARK_REDWEST = 17,
    MAPMARK_GREENNORTH = 18,
    MAPMARK_GREENSOUTH = 19,
]]

local mapMarks = {
    [6578] = {
        position = Position(1030, 1030, 7),
        type = MAPMARK_TEMPLE,
        text = "Temple",
        premium = false,
        storage = PlayerStorageKeys.markstorageone
    },
    [9941] = {
        position = Position(1050, 1050, 7),
        type = MAPMARK_FLAG,
        text = "Depot",
        premium = true,
        storage = PlayerStorageKeys.markstoragetwo
    }
}

local mapMark = Action()

function mapMark.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local minimapItem = mapMarks[item.itemid]
    local playerPosition = player:getPosition()

    if not player:isPremium() and minimapItem.premium then
        player:sendCancelMessage("You need a premium account.")
        return true
    end

    if player:getStorageValue(minimapItem.storage) == 1 then -- optional to avoid players using the same item once more.
        player:sendCancelMessage("You have already marked this position.")
        return true
    end

    player:addMapMark(minimapItem.position, minimapItem.type, minimapItem.text)
    player:setStorageValue(minimapItem.storage, 1)
    playerPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have explored and marked a new map!")
    item:remove(1)
    return true
end

for id, _ in pairs(mapMarks) do
    mapMark:id(id)
end

mapMark:register()
Can you please explain your message ''You can change the storage to numbers instead of calling it from the lib.'' i havent fully got it what you mean.


also by using 1 item i can sent multiple marks to appear ? because i try see script and it seems 1 item = 1 map mark, or im wrong ? :)


Thanks for your time!
 
Can you please explain your message ''You can change the storage to numbers instead of calling it from the lib.'' i havent fully got it what you mean.
I meant you can change PlayerStorageKeys.markstorageone to storage numbers if you are not using lib ones.
also by using 1 item i can sent multiple marks to appear ? because i try see script and it seems 1 item = 1 map mark, or im wrong ? :)
I had it for 1 mark per item, edited to allow multiple marks per item.
 
Back
Top