• 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 CONST_SLOT_RIGHT is everything

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,424
Solutions
15
Reaction score
177
Location
Sweden
Yello! Why is this that every item that exists belongs to CONST_SLOT_RIGHT, when the item is not desired to that slot and cannot be moved onto that slot. (I don't use classic equipment slots).
TFS 1.3 (10.98)

Script: (Which always prints fuck)
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition)
local type = ItemType(itemEx:getId())

 if isItemStackable(itemEx.itemid) then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "Stackable items cant be upgraded.")
    return false
 end
 
 if item.itemid ~= 8300 then
  return false
 end

if type:usesSlot(CONST_SLOT_RIGHT) then
print("fuck")
end
end
 
Solution
Probably not updated since classic slots. You can check item base stats to determine what they are.

For shields you can just call :getDefense() > 0
For weapons you can try :getWeaponType() but I'm not sure if it works with wands.
For every other piece of equipment item:getType():getSlotPosition() - CONST_SLOT_LEFT - CONST_SLOT_RIGHT should return their true slot
Probably not updated since classic slots. You can check item base stats to determine what they are.

For shields you can just call :getDefense() > 0
For weapons you can try :getWeaponType() but I'm not sure if it works with wands.
For every other piece of equipment item:getType():getSlotPosition() - CONST_SLOT_LEFT - CONST_SLOT_RIGHT should return their true slot
 
Solution
Probably not updated since classic slots. You can check item base stats to determine what they are.

For shields you can just call :getDefense() > 0
For weapons you can try :getWeaponType() but I'm not sure if it works with wands.
For every other piece of equipment item:getType():getSlotPosition() - CONST_SLOT_LEFT - CONST_SLOT_RIGHT should return their true slot
I'll see if I can fix that issue in sources and make a pull request instead.

When I have you here, you created this script: CreatureEvent - [TFS 1.3] updated Slot System (https://otland.net/threads/tfs-1-3-updated-slot-system.267624/)

I'm trying to get the stat & value separate from each other, right now I use item:getStats()[1] but that will return for example: MP;1.5
I know I've been stuck at this one before and solved it but yet again I cant find the solution.
 
Back
Top