• 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 [TFS 1.5] Use items to gain mounts

bolachapanco

Member
Joined
Aug 5, 2023
Messages
30
Reaction score
5
Location
Brazil
I have this script that when an item is used it gives the mount but I would like it to be necessary to use these items for the mount to be given:

04 Spectral Horseshoes Spectral Horseshoe
01 Spectral Horse Tack Spectral Horse Tack
01 Spectral Saddle


The idea here is to revscript the Phastamal Jade mount

Lua:
local config = {
        [34072] = {mountId = 167, message = "You receive the permission to ride a Phantasmal Jade"},
        [34073] = {mountId = 167, message = "You receive the permission to ride a Phantasmal Jade"},
        [34074] = {mountId = 167, message = "You receive the permission to ride a Phantasmal Jade"},
    }
    
local jademount = Action()

function jademount.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local mount = config[item.itemid]

    if not mount then
        return true
    end

    if not player:hasMount(mount.mountId) then
            player:addMount(mount.mountId)
        player:say(mount.message, TALKTYPE_MONSTER_SAY)
        item:remove(1)
    else
        player:sendTextMessage(19, "You already have this mount")
    end
    return true
end

for itemId, info in pairs(config) do
    jademount:id(itemId)
end

jademount:register()
 
Lua:
local config = {
    [34072] = {mountId = 167, message = "You receive permission to ride a Phantasmal Jade"},
    [34073] = {mountId = 167, message = "You receive permission to ride a Phantasmal Jade"},
    [34074] = {mountId = 167, message = "You receive permission to ride a Phantasmal Jade"},
}

local function hasRequiredItems(player)
    local playerItemCountFerraduras = player:getItemCount(10614) -- Item ID "04 Spectral Horseshoes"
    local playerItemCountArreios = player:getItemCount(10028) -- Item ID "01 Spectral Harnesses"
    local playerItemCountSela = player:getItemCount(9743) -- Item ID "01 Spectral Saddle"

    return playerItemCountFerraduras >= 4 and playerItemCountArreios >= 1 and playerItemCountSela >= 1
end

local jademount = Action()

function jademount.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local mount = config[item.itemid]

    if not mount then
        return true
    end

    if hasRequiredItems(player) then
        if not player:hasMount(mount.mountId) then
            player:addMount(mount.mountId)
            player:say(mount.message, TALKTYPE_MONSTER_SAY)
            player:removeItem(10614, 4)
            player:removeItem(10028, 1)
            player:removeItem(9743, 1)
            item:remove(1)
        else
            player:sendTextMessage(19, "Do you already have this mount?.")
        end
    else
        player:sendTextMessage(19, "You do not have enough items to receive the mount.")
    end

    return true
end

for itemId, info in pairs(config) do
    jademount:id(itemId)
end

jademount:register()
 
Back
Top