• 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 Talkaction that shows item description TFS 1.3

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hi guys, I would like a script that when the player say "!identify (name of the item)" it will show the description of the item, similar to when the player set "look" on the item. For example player say "!identify fire sword" and it appears:

You see a fire sword (Atk:24 physical + 11 fire, Def:20 +1).
It can only be wielded properly by players of level 30 or higher.
It weighs 23.00 oz.
The blade is a magic flame.
 
Solution
Lua:
function onSay(player, words, param)

    param = param:gsub("%p", "")

    local it_type = ItemType(tonumber(param) or param)
    if not it_type or it_type:getId() == 0 then
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "This item name does not exist.")
        return false
    end

    local virtualItem = Game.createItem(it_type:getId())
    local description = virtualItem:getDescription()
    virtualItem:remove()

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. description)
   
    return false
end
Lua:
function onSay(player, words, param)

    param = param:gsub("%p", "")

    local it_type = ItemType(tonumber(param) or param)
    if not it_type or it_type:getId() == 0 then
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "This item name does not exist.")
        return false
    end

    local virtualItem = Game.createItem(it_type:getId())
    local description = virtualItem:getDescription()
    virtualItem:remove()

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. description)
   
    return false
end
 
Solution
Lua:
function onSay(player, words, param)

    param = param:gsub("%p", "")

    local it_type = ItemType(tonumber(param) or param)
    if not it_type or it_type:getId() == 0 then
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "This item name does not exist.")
        return false
    end

    local virtualItem = Game.createItem(it_type:getId())
    local description = virtualItem:getDescription()
    virtualItem:remove()

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. description)
  
    return false
end
Incredible, it works perfectly
 
Back
Top