• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Revscripts(1.3) Custom Equipment {SYC}

Thats a pretty nice system btw. Maybe you should treat as "unique drop system" where you can create a lot of unique custom drops... the only update that i'd sugest is to make it drop from a specific mob / boss.
 
Hello,
I'm testing few attributes systems from this forum and found this one, but I have a problem to make it working on my engine (tfs 1.4).

I got an error with table nil:
Bash:
Lua Script Error: [Scripts Interface]
C:\Users\PC\Desktop\OTS\A OTS Project\data\scripts\customequpiment.lua
...sktop\OTS\A OTS Project\data\scripts\customequpiment.lua:182: table index is nil
stack traceback:
        [C]: in function '__newindex'
        ...sktop\OTS\A OTS Project\data\scripts\customequpiment.lua:182: in main chunk
        [C]: in function 'reload'
        ...TS\A OTS Project\data\scripts\talkactions\god\reload.lua:77: in function <...TS\A OTS Project\data\scripts\talkactions\god\reload.lua:55>
> customequpiment.lua [error]


It points to the line:
"customEquipment[properties.equipId] = properties"

1746819479012.webp

Before I had to remove few lines with condition lines, because they were not included in my source.
Any idea which table is nill here? I guess that some condition can be still not available on my engine, but can't figure out which.

EDIT: Nvm, had to change <equipement to <CustomEquipment in for: for i in equipmentFile:read("*a"):gmatch("<CustomEquipment (.-)</CustomEquipment>") do

Edit2: No errors right now, but still dont know how to test it. Looting demons with loot set to 2000 (MPA drops in a single demon) is not changing the item. Also created script with:
function onUse(player, item, fromPosition, target, toPosition)
player:addCustomEquipment(24001)

end

also not working (do nothing). I have to do something wrong :(

Edited the drop function:
LUA:
dropLootEvent.onDropLoot = function(self, corpse)
    if not enableLoot then
        return true
    end
    local lottery = {}
    for index, item in pairs(corpse:getItems()) do
        print("Loop in corpse")
        if table.contains(baseItemList, item:getId()) then
        print("Found baseItem")
            for eq, attr in pairs(customEquipment) do
                if attr.baseItem == item:getId() then
                    if attr.tier and attr.tier["lootable"] then
                        if attr.tier["chance"] and attr.tier["chance"] < math.random(100) then
                            table.insert(lottery, attr.equipId)
                                    print(chance)
                        end
                    end
                end
            end  
        end
    end
    if #lottery > 0 then
        local equipId = lottery[math.random(#lottery)]

            for index, item in pairs(corpse:getItems()) do
                if customEquipment[equipId].baseItem == item:getId() then
                    local name = item:getName()
                    item:transformToEq(equipId)
                    if enableLootMessage then
                        Player(corpse:getCorpseOwner()):sendTextMessage(MESSAGE_LOOT, "There is something different about that " ..name.. "!")
                    end
                end
            end

    end
    return true
end

and get in console events:
Bash:
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse
Loop in corpse

But not a single "Found baseItem"


Update: removed few confitions and finally gets the item with attributes :)
 
Last edited:

Similar threads

Back
Top