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

[Mod] Random Item Stats

I'd do that, but I need functions first and 1.0 is based on 0.2 so it don't have them(yet?)
You know, itemattribute thing


Lemme see if I can found them for you and Ill give them to you :)


Edit: Nvm, they had not been released yet
 
Last edited:
Lemme see if I can found them for you and Ill give them to you :)


Edit: Nvm, they had not been released yet
I've checked source code already, it's here
I think I'm able to rewrite Mock's slot system where item attributes could be stored as description instead of item name and buffs applied as condition. I need more testing and if I manage to get it working without bugs I'll post it on otland.
 
Great! would be awesome, thanks for your help hope you can so I can use it :)
 
im reciving this issue

[10/09/2013 16:03:35] [Error - CreatureScript Interface]
[10/09/2013 16:03:35] In a timer event called from:
[10/09/2013 16:03:35] buffer:eek:nKill
[10/09/2013 16:03:35] Description:
[10/09/2013 16:03:35] [string "loadBuffer"]:53: attempt to compare number with nil
[10/09/2013 16:03:35] stack traceback:
[10/09/2013 16:03:35] [string "loadBuffer"]:53: in function 'createLoot'
[10/09/2013 16:03:35] [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>

(tfs 0.3.6)

any ideas :S

I have the same error, i'm using also tfs 0.3.6
 
someone can explait it to me, i dont understand the mod how i can config that?
 
@Ganjaaa It says right in the beginnigng of the script:
Code:
tiers, attr = {}, {}

tiers['rare'] = {
    color = 66, -- color of 'RARE' text
    extra = {0, 0},
    attrNames = true, -- show attribute names instead of rare
    chance = {
        [1] = 20000,
        [2] = 5000 -- chance for 2nd stat
    }
}
tiers['epic'] = {
    color = 35,
    extra = {7, 20}, -- additional percent bonus
    chance = {
        [1] = 5000,
        [2] = 25000
    }
}
tiers['legendary'] = {
    color = 149,
    extra = {20, 35},
    chance = {
        [1] = 1500,
        [2] = 100000 -- 2 bonuses always
    }
}


However. I need help with the attackspeed attribute. I've tried weapons with 45% extra attackspeed, but there's no difference in attackspeed from a normal weapon.
I'm using TFS 0.3.6pl1
from: svn://svn.otland.net/public/forgottenserver/tags/0.3.6pl1

Do I need to add something to my source code?
 
too bad it ain't working in 0.3.6 cryingdamnson v8.2
Code:
[24/01/2014 16:33:58] [Error - CreatureScript Interface]
[24/01/2014 16:33:58] buffer:onKill
[24/01/2014 16:33:58] Description:
[24/01/2014 16:33:58] (luaGetMonsterInfo) Monster not found

[24/01/2014 16:34:10] [Error - CreatureScript Interface]
[24/01/2014 16:34:10] buffer:onKill
[24/01/2014 16:34:10] Description:
[24/01/2014 16:34:10] (luaGetMonsterInfo) Monster not found

[24/01/2014 16:34:55] [Error - CreatureScript Interface]
[24/01/2014 16:34:55] buffer:onKill
[24/01/2014 16:34:55] Description:
[24/01/2014 16:34:55] (luaGetMonsterInfo) Monster not found
[24/01/2014 16:38:26] > Broadcasted message: "Information: CTF is Starting in 1 minut Enter the event tp and then the CTF TP!".

[24/01/2014 16:40:29] [Error - CreatureScript Interface]
[24/01/2014 16:40:29] In a timer event called from:
[24/01/2014 16:40:29] buffer:onKill
[24/01/2014 16:40:29] Description:
[24/01/2014 16:40:30] [string "loadBuffer"]:53: attempt to compare number with nil
[24/01/2014 16:40:30] stack traceback:
[24/01/2014 16:40:30]    [string "loadBuffer"]:53: in function 'createLoot'
[24/01/2014 16:40:30]    [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>

[24/01/2014 16:40:33] [Error - CreatureScript Interface]
[24/01/2014 16:40:33] In a timer event called from:
[24/01/2014 16:40:33] buffer:onKill
[24/01/2014 16:40:33] Description:
[24/01/2014 16:40:33] [string "loadBuffer"]:53: attempt to compare number with nil
[24/01/2014 16:40:33] stack traceback:
[24/01/2014 16:40:33]    [string "loadBuffer"]:53: in function 'createLoot'
[24/01/2014 16:40:33]    [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
 
im using TFS 1.0 and i cant seem to get this script to work at all? any help? there is no mod folder
 
Anyone know how I can get the attackspeed attribute to work? I can get the stat and everything. but it doesen't give me any boost in attackspeed when equipped.
crossbow = legendary crossbow (Range:5, Hit% +53).
[Attack Speed: +45%]
[Hit Chance: +53%]


No difference in attackspeed



I'm using TFS 0.3.6pl1
from: svn://svn.otland.net/public/forgottenserver/tags/0.3.6pl1
 
@Cykotitan I can't find any issues that would cause me not to get the attackspeed. Few others have the same problem, but seems noone found solution
 
[Error - CreatureScript Interface]
In a timer event called from:
buffer:eek:nkill
description:
[string "loadbuffer"]:53: in function 'create loot'
[string "loadbuffer"]:225: in function <[string "loadbuffer"]:212

I get this error when I click on a monster to take the loot.
al corpse are empty

I'm using tfs 0.3.6
 
Last edited:
Some errors :eek:
Code:
[23:32:17.913] [Error - CreatureScript Interface]
[23:32:17.913] In a timer event called from:
[23:32:17.913] domodlib('itemstats_conf')

[23:32:17.913] function round(n, s)
[23:32:17.913] return tonumber(('%.' .. (s or 0) .. 'f'):format(n))
[23:32:17.913] end

[23:32:17.913] function getContentDescription(uid, sep)
[23:32:17.913] local ret, i, containers = '', 0, {}
[23:32:17.913] while( i < getContainerSize(uid) )do
[23:32:17.913] local v, s = getContainerItem(uid, i), ''
[23:32:17.913] local k = getItemInfo(v.itemid)
[23:32:17.913] k.name = getItemAttribute(v.uid, 'name') or k.name
[23:32:17.913] if( k.name ~= '' )then
[23:32:17.913] if( v.type > 1 and k.stackable and k.showCount )then
[23:32:17.913] s = v.type .. ' ' .. k.plural
[23:32:17.913] else
[23:32:17.913] local article = getItemAttribute(v.uid, 'article') or k.article
[23:32:17.913] s = (article == '' and '' or article .. ' ') .. k.name
[23:32:17.913] end
[23:32:17.913] ret = ret .. (i == 0 and not sep and '' or ', ') .. s
[23:32:17.913] if( isContainer(v.uid) and getContainerSize(v.uid) ~= 0 )then
[23:32:17.913] table.insert(containers, v.uid)
[23:32:17.913] end
[23:32:17.913] else
[23:32:17.913] ret = ret .. (i == 0 and not sep and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
[23:32:17.913] end
[23:32:17.913] i = i + 1
[23:32:17.913] end
[23:32:17.913] for i = 1, #containers do
[23:32:17.913] ret = ret .. getContentDescription(containers, true)
[23:32:17.913] end
[23:32:17.913] return ret
[23:32:17.913] end

[23:32:17.913] local function send(cid, corpse, monster)
[23:32:17.913] if( isPlayer(cid) )then
[23:32:17.913] local ret = corpse and isContainer(corpse) and getContentDescription(corpse)
[23:32:17.913] doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'))
[23:32:17.913] local party = getPlayerParty(cid)
[23:32:17.913] if( party )then
[23:32:17.913] for _, pid in ipairs(getPartyMembers(party)) do
[23:32:17.913] doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
[23:32:17.913] end
[23:32:17.913] end
[23:32:17.913] end
[23:32:17.913] end

[23:32:17.913] local function createLoot(i, ext)
[23:32:17.913] local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id
[23:32:17.913] local random = math.ceil(math.random(100000) / ext)
[23:32:17.913] local tmpItem, f

[23:32:17.913] if( random < i.chance )then
[23:32:17.913] if i.subType == -1 then
[23:32:17.913] f = getItemInfo(item)
[23:32:17.913] end
[23:32:17.913] tmpItem = doCreateItemEx(item,
[23:32:17.913] i.subType ~= -1 and i.subType or
[23:32:17.913] f.stackable and random % i.count + 1 or
[23:32:17.913] f.charges ~= 0 and f.charges or
[23:32:17.913] 1
[23:32:17.913] )
[23:32:17.913] end

[23:32:17.913] if( not tmpItem )then
[23:32:17.913] return
[23:32:17.913] end

[23:32:17.913] if( i.actionId ~= -1 )then
[23:32:17.913] doItemSetAttribute(tmpItem, 'aid', i.actionId)
[23:32:17.913] end

[23:32:17.913] if( i.uniqueId ~= -1 )then
[23:32:17.913] doItemSetAttribute(tmpItem, 'uid', i.uniqueId)
[23:32:17.913] end

[23:32:17.913] if( i.text ~= '' )then
[23:32:17.913] doItemSetAttribute(tmpItem, 'text', i.text)
[23:32:17.913] end

[23:32:17.913] local ret, done

[23:32:17.913] for k, v in pairs(tiers) do
[23:32:17.913] local cur, used = {}, {}
[23:32:17.913] for i = 1, #v.chance do
[23:32:17.913] if( math.random(100000) <= v.chance )then
[23:32:17.913] if( f )then
[23:32:17.913] f = getItemInfo(item)
[23:32:17.913] end
[23:32:17.913] if( not f.stackable )then
[23:32:17.913] for m, n in pairs(attr) do
[23:32:17.913] if( not table.find(used, m) and
[23:32:17.913] (
[23:32:17.913] ( table.find(n.types, MELEE) and table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) ) or
[23:32:17.913] ( table.find(n.types, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or
[23:32:17.913] ( table.find(n.types, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or
[23:32:17.913] ( table.find(n.types, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or
[23:32:17.913] ( table.find(n.types, WAND) and f.weaponType == WEAPON_WAND ) or
[23:32:17.913] ( table.find(n.types, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquipTo ~= 0 ) or
[23:32:17.914] ( table.find(n.types, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPosition) and f.charges ~= 0 )
[23:32:17.914] ) )then
[23:32:17.914] table.insert(cur, m)
[23:32:17.914] end
[23:32:17.914] end

[23:32:17.914] if( #cur ~= 0 )then
[23:32:17.914] local n = cur[math.random(#cur)]
[23:32:17.914] table.insert(used, n)

[23:32:17.914] n = attr[n]
[23:32:17.914] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0))
[23:32:17.914] -- hacks
[23:32:17.914] if( n.attr == 'duration' )then
[23:32:17.914] tmp = getItemInfo(f.transformEquipTo)
[23:32:17.914] if tmp.transformDeEquipTo ~= item then
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] new = round( tmp.decayTime * (1 + percent / 100) * 1000 )
[23:32:17.914] elseif( n.attr == 'attackSpeed' )then
[23:32:17.914] new = round( vocation_base_attackspeed / (1 + percent / 100) )
[23:32:17.914] elseif( n.attr == 'hitChance' ) then
[23:32:17.914] new = round(
[23:32:17.914] f.hitChance == -1 and
[23:32:17.914] percent
[23:32:17.914] or
[23:32:17.914] f.hitChance * (1 + percent / 100)
[23:32:17.914] )
[23:32:17.914] else
[23:32:17.914] new = round(
[23:32:17.914] n.base and
[23:32:17.914] f[n['attr']] + f[n['base']] * (percent / 100)
[23:32:17.914] or
[23:32:17.914] f[n['attr']] * (1 + percent / 100)
[23:32:17.914] )

[23:32:17.914] if( new == f[n[n.base and 'base' or 'attr']] )then -- no improvement
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] end

[23:32:17.914] doItemSetAttribute(tmpItem, n.attr:lower(), new)

[23:32:17.914] local name = getItemAttribute(tmpItem, 'name')
[23:32:17.914] if( v.attrNames or not name )then
[23:32:17.914] local name = (v.attrNames and used[#used] or k) .. ' ' .. (name or f.name)
[23:32:17.914] doItemSetAttribute(tmpItem, 'name', name)

[23:32:17.914] if( f.article ~= '' )then
[23:32:17.914] local article = getArticle(name)
[23:32:17.914] if( article ~= f.article )then
[23:32:17.914] doItemSetAttribute(tmpItem, 'article', article)
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] end

[23:32:17.914] local desc = getItemAttribute(tmpItem, 'description') or f.description
[23:32:17.914] doItemSetAttribute(tmpItem, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc))

[23:32:17.914] ret = k
[23:32:17.914] end
[23:32:17.914] cur = {}
[23:32:17.914] if( #v.chance == i )then
[23:32:17.914] done = true
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] else
[23:32:17.914] done = i ~= 1
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] end
[23:32:17.914] if( done )then
[23:32:17.914] break
[23:32:17.914] end
[23:32:17.914] end

[23:32:17.914] return tmpItem, ret
[23:32:17.914] end

Was more but didnt fit.
 

Removed ALL bags, now:

[18/05/2014 13:27:56] [Error - CreatureScript Interface]
[18/05/2014 13:27:56] In a timer event called from:
[18/05/2014 13:27:56] buffer:eek:nKill
[18/05/2014 13:27:56] Description:
[18/05/2014 13:27:56] [string "loadBuffer"]:53: attempt to compare number with nil
[18/05/2014 13:27:56] stack traceback:
[18/05/2014 13:27:56] [string "loadBuffer"]:53: in function 'createLoot'
[18/05/2014 13:27:56] [string "loadBuffer"]:225: in function <[string "loadBuffer"]:212>
 
Last edited:
Killing monsters, items aren't enchanted (Ever).

Code:
tiers['rare'] = {
color = 66, -- color of 'RARE' text
extra = {0, 0},
attrNames = true, -- show attribute names instead of rare
chance = {
[1] = 95000,
[2] = 98000 -- chance for 2nd stat
}
 
Back
Top