• 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!

TFS 1.X+ Validate item when using

Ovnyx

Member
Joined
Jul 25, 2017
Messages
163
Solutions
2
Reaction score
7
hi people, i was trying to validate when i use an object in a target what kind of item is(helmet, legs, armor, ring, etc)
i tried with ItemType using itemType:getSlotPosition() with no success any ideas how can i do this?
thanks in advice!
 
im working in TFS 1.3, actually i was testing with this function:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2365 then
        local type = ItemType(target:getId())
        print("SLOT: "..type:getSlotPosition()
        position:sendMagicEffect(CONST_ME_MAGIC_RED)
        return true
    end
    return true
end

so basicaly this script executes when i use a flawless ice crystal in some target, i need to know if the target is a ring slot item for example to apply the script just to that kind of items
 
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2365 then
    local type = ItemType(target:getId())
        if type:getSlotPosition() == SLOTP_RING then
            print(1)
        else
            print(2)
        end
    end
    return true
end
 
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 2365 then
    local type = ItemType(target:getId())
        if type:getSlotPosition() == SLOTP_RING then
            print(1)
        else
            print(2)
        end
    end
    return true
end
thanks for ur answer, but is not working :/, maybe this is not the correct way to validate if an item is a ring , a weapon, a helmet, etc?
 
Back
Top