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

(Request)(TFS 0.4) Loot items with random stats

mori2005

New Member
Joined
Feb 19, 2009
Messages
68
Reaction score
0
hi im looking for this script but when u loot a item with random stats appears
-Common (color: Light-blue)
-Rare (color: Blue)
-Legendary (color: Purple)

the script in TFS 1.0 is

creaturescripts.xml

<event type="kill" name="loot_slot" script="onkill_slot.lua"/>
login.lua

player:registerEvent("loot_slot")
onkill_slot.lua

function getper()
local n = 1
for i=1,10 do
n = n+math.random(0,2)
if n < 8*i then
break
end
end
return n
end

local lootable_slots = {'hp','mp','ml','melee','shield','dist'}

function assign_loot_Slot(pos)
local c = Tile(pos):getTopDownItem()
if c ~= nil then
if c:isContainer() then
local h = c:getItemHoldingCount()
if h > 0 then
for i = 1, h do
local i_Ex = c:getItem(i - 1)
local itemEx = {
itemid = i_Ex:getId(),
uid = i_Ex:getUniqueId()
}

if (isArmor(itemEx.uid) or isWeapon(itemEx.uid) or isShield(itemEx.uid)) and not isItemStackable(itemEx.uid) then
if math.random(1,5) == 5 then
if math.random(1, 100) <= 25 then
nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
doSetItemSpecialDescription(itemEx.uid, nam)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYAREA)
if math.random(1, 100) <= 10 then
nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
doSetItemSpecialDescription(itemEx.uid, nam)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_ICETORNADO)
end
if math.random(1, 200) <= 1 then
nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
doSetItemSpecialDescription(itemEx.uid, nam)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_PURPLEENERGY)
end
end
end
end
end
return true
end
end
end
end

function onKill(cid, target, lastHit)
if (not isSummon(target)) then
addEvent(assign_loot_Slot, 1, getThingPos(target))
end
return true
end

BUT I WANT IT IN TFS 0.4 plz
 
Back
Top