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

Action [TFS 1.1] - Slot system

Status
Not open for further replies.
Well let's say a Paladin with magic level 34 uses an Upgrade and wins 2% m lvl bonus.

2% of 34 turns out to be .68, at the moment it rounds down to 0 instead of to 1, i'm trying to figure out how to make it round up.

I'm not entirely sure which line of code to paste here. :confused:

hope this helps
http://lmgtfy.com/?q=lua+round+number&l=1
 
I misunderstood you.
Condition can't be rounded. You may replace % to exact numbers if you want full skills, but it will be more lines to change.
 
For those who are having all the stats work expect magic level not increasing change this :

slot.lua action

HTML:
local conditionMP,conditionHP,conditionML,conditionCLUB,conditionSHI,conditionDIST,conditionAMP = {},{},{},{},{},{},{}
for i=1,300 do
   conditionHP[i] = createConditionObject(CONDITION_ATTRIBUTES)
   setConditionParam(conditionHP[i], CONDITION_PARAM_SUBID, 50)
   setConditionParam(conditionHP[i], CONDITION_PARAM_BUFF_SPELL, 1)
   setConditionParam(conditionHP[i], CONDITION_PARAM_TICKS, -1)
   setConditionParam(conditionHP[i], CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 100+i)

   conditionMP[i] = createConditionObject(CONDITION_ATTRIBUTES)
   setConditionParam(conditionMP[i], CONDITION_PARAM_SUBID, 51)
   setConditionParam(conditionMP[i], CONDITION_PARAM_BUFF_SPELL, 1)
   setConditionParam(conditionMP[i], CONDITION_PARAM_TICKS, -1)
   setConditionParam(conditionMP[i], CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 100+i)

   conditionML[i] = createConditionObject(CONDITION_ATTRIBUTES)
   setConditionParam(conditionML[i], CONDITION_PARAM_SUBID, 52)
   setConditionParam(conditionML[i], CONDITION_PARAM_BUFF_SPELL, 1)
   setConditionParam(conditionML[i], CONDITION_PARAM_TICKS, -1)
   setConditionParam(conditionML[i], CONDITION_PARAM_STAT_MAGICPOINTSPERCENT, 100+i)

   conditionCLUB[i] = createConditionObject(CONDITION_ATTRIBUTES)
   setConditionParam(conditionCLUB[i], CONDITION_PARAM_SUBID, 53)
   setConditionParam(conditionCLUB[i], CONDITION_PARAM_BUFF_SPELL, 1)
   setConditionParam(conditionCLUB[i], CONDITION_PARAM_TICKS, -1)
   setConditionParam(conditionCLUB[i], CONDITION_PARAM_SKILL_MELEEPERCENT, 100+i)


   conditionSHI[i] = createConditionObject(CONDITION_ATTRIBUTES)
   setConditionParam(conditionSHI[i], CONDITION_PARAM_SUBID, 54)
   setConditionParam(conditionSHI[i], CONDITION_PARAM_BUFF_SPELL, 1)
   setConditionParam(conditionSHI[i], CONDITION_PARAM_TICKS, -1)
   setConditionParam(conditionSHI[i], CONDITION_PARAM_SKILL_SHIELDPERCENT, 100+i)

   conditionDIST[i] = createConditionObject(CONDITION_ATTRIBUTES)
   setConditionParam(conditionDIST[i], CONDITION_PARAM_SUBID, 55)
   setConditionParam(conditionDIST[i], CONDITION_PARAM_BUFF_SPELL, 1)
   setConditionParam(conditionDIST[i], CONDITION_PARAM_TICKS, -1)
   setConditionParam(conditionDIST[i], CONDITION_PARAM_SKILL_DISTANCEPERCENT, 100+i)
end

function getSlotType(n)
   if not n then
     return false
   end
   if n:match('%[(.+)%]') then
     n = n:match('%[(.+)%]')
     if n == '?' then
       return 0,n
     else
       return n:match('(.-)%.([+-])(%d+)%%')
     end
   else
     return false
   end
end

local function loadSet(cid)
   local t = {}
   for slot=1,9 do
     t[slot] = ''
     local s = getPlayerSlotItem(cid,slot).uid
     if s ~= 0 then
       t[slot] = Item(s):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
     end
   end
   return t
end

function chk(cid,f)
   if not isPlayer(cid) then return false end
   local t = loadSet(cid)
   for i=1,#f do
     if f[i] ~= t[i] then
       equip(cid,nil,slot)
       break
     end
   end
   addEvent(chk,2000,cid,t)
end

function check_slot(aab, i)
   if i == 5 or i == 6 then
     if isWeapon(aab) or isShield(aab) or isBow(aab) then
       return true
     end
   else
     return true
   end
return false
end

function equip(cid,item,slot)
   local t = {}
   if item then
     local mm,sinal,qto = getSlotType(Item(item.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION))
     t[mm] = tonumber(qto)
   end
   for i=1,9 do
     if i ~= slot then
       if getPlayerSlotItem(cid,i).itemid ~= 0 then
         local aab = getPlayerSlotItem(cid,i).uid
         if aab and check_slot(aab,i) then
           for _ in Item(aab):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION):gmatch('(%[.-%])') do
             local mm,sinal,qto2 = getSlotType(_)
             if mm then
               if not t[mm] then
                 t[mm] = 0
               end
               t[mm] = t[mm]+tonumber(qto2)
               t[mm] = t[mm] > 300 and 300 or t[mm]
             end
           end
         end
       end
     end
   end
   local fu = 0
   local ca = {}
   local s = ''
   for sl,n in pairs(t) do
     fu = fu+1
     s = s..''..n..'% more of '..sl..'\n'
     if sl == 'hp' then
       doAddCondition(cid,conditionHP[tonumber(n)])
       Player(cid):addHealth(Player(cid):getMaxHealth() - Player(cid):getHealth())
       ca[50] = 1
       doSendTutorial(cid,19)
     elseif sl == 'mp' then
       doAddCondition(cid,conditionMP[tonumber(n)])
       Player(cid):addMana(Player(cid):getMaxMana() - Player(cid):getMana())
       ca[51] = 1
       doSendTutorial(cid,19)
     elseif sl == 'ml' then
       doAddCondition(cid,conditionML[tonumber(n)])
       ca[52] = 1
     elseif sl == 'melee' then
       doAddCondition(cid,conditionCLUB[tonumber(n)])
       ca[53] = 1
     elseif sl == 'shield' then
       doAddCondition(cid,conditionSHI[tonumber(n)])
       ca[54] = 1
     elseif sl == 'dist' then
       doAddCondition(cid,conditionDIST[tonumber(n)])
       ca[55] = 1
     end
   end
   if fu > 0 then
     for i=50,55 do
       if not ca[i] then
         doRemoveCondition(cid,CONDITION_ATTRIBUTES,i)
       end
     end
   else
     for i=50,55 do
       doRemoveCondition(cid,CONDITION_ATTRIBUTES,i)
     end
   end
   return true
end

function onLogin(cid)
  equip(cid,nil,slot)
  addEvent(chk,2000,cid,loadSet(cid))
  return true
end
@zbizu
 
@zbizu Can you add wands and rods to script? I'm not the most experienced coder lol.
 
@nugo I'm retired and busy a bit. I'll post new version which works with wands as soon as I'll be able to.

edit: added wands support, check first post
 
Last edited:
First post updated. Let me know if there is something missing.

If someone wants to loot items with random stats add this:
creaturescripts.xml
Code:
  <event type="kill" name="loot_slot" script="onkill_slot.lua"/>
login.lua
Code:
  player:registerEvent("loot_slot")
onkill_slot.lua
Code:
function getper()
   local n = 1
   for i=1,10 do
     n = n+math.random(0,10)
     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) <= 75 then
                 nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                 nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                 doSetItemSpecialDescription(itemEx.uid, nam)
                 if math.random(1, 100) <= 50 then
                   nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                   doSetItemSpecialDescription(itemEx.uid, nam)
                   if math.random(1, 100) <= 25 then
                     nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                     doSetItemSpecialDescription(itemEx.uid, nam)
                   end
                 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, 2, getThingPos(target))
   end
return true
end
 
First post updated. Let me know if there is something missing.

If someone wants to loot items with random stats add this:
creaturescripts.xml
Code:
  <event type="kill" name="loot_slot" script="onkill_slot.lua"/>
login.lua
Code:
  player:registerEvent("loot_slot")
onkill_slot.lua
Code:
function getper()
   local n = 1
   for i=1,10 do
     n = n+math.random(0,10)
     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) <= 75 then
                 nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                 nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                 doSetItemSpecialDescription(itemEx.uid, nam)
                 if math.random(1, 100) <= 50 then
                   nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                   doSetItemSpecialDescription(itemEx.uid, nam)
                   if math.random(1, 100) <= 25 then
                     nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                     doSetItemSpecialDescription(itemEx.uid, nam)
                   end
                 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, 2, getThingPos(target))
   end
return true
end

Working great thanks! :)
 
First post updated. Let me know if there is something missing.

If someone wants to loot items with random stats add this:
creaturescripts.xml
Code:
  <event type="kill" name="loot_slot" script="onkill_slot.lua"/>
login.lua
Code:
  player:registerEvent("loot_slot")
onkill_slot.lua
Code:
function getper()
   local n = 1
   for i=1,10 do
     n = n+math.random(0,10)
     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) <= 75 then
                 nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                 nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                 doSetItemSpecialDescription(itemEx.uid, nam)
                 if math.random(1, 100) <= 50 then
                   nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                   doSetItemSpecialDescription(itemEx.uid, nam)
                   if math.random(1, 100) <= 25 then
                     nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                     doSetItemSpecialDescription(itemEx.uid, nam)
                   end
                 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, 2, getThingPos(target))
   end
return true
end
Thanks a lot man apprecaite it. This script does wants and rods also yea?

Stupid question also, what part of the script do you change to reduce or increase the max % increase on an item?

One more thing, if you equip the item with a bonus of HP or MP it automatically puts your heal/mana to full. So you can equp

@zbizu
 
Last edited:
Thanks a lot man apprecaite it. This script does wants and rods also yea?

Stupid question also, what part of the script do you change to reduce or increase the max % increase on an item?

One more thing, if you equip the item with a bonus of HP or MP it automatically puts your heal/mana to full. So you can equp

@zbizu
re-install my script(first post was edited) and it will support wands/rods and shouldn't add hp/mp anymore
 
First post updated. Let me know if there is something missing.

If someone wants to loot items with random stats add this:
creaturescripts.xml
Code:
  <event type="kill" name="loot_slot" script="onkill_slot.lua"/>
login.lua
Code:
  player:registerEvent("loot_slot")
onkill_slot.lua
Code:
function getper()
   local n = 1
   for i=1,10 do
     n = n+math.random(0,10)
     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) <= 75 then
                 nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                 nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                 doSetItemSpecialDescription(itemEx.uid, nam)
                 if math.random(1, 100) <= 50 then
                   nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                   doSetItemSpecialDescription(itemEx.uid, nam)
                   if math.random(1, 100) <= 25 then
                     nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                     doSetItemSpecialDescription(itemEx.uid, nam)
                   end
                 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, 2, getThingPos(target))
   end
return true
end

Is there a way to send a message to the players local chat to let them know they looted an upgraded item?
 
Is there a way to send a message to the players local chat to let them know they looted an upgraded item?
there are plenty of ways to do it, for example below "if math.random(1, 100) <= 75 then" you may add:
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Rare")
 
Yeah that's what I tried but nothing was appearing:

Code:
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) <= 75 then
                 nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                 nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                 doSetItemSpecialDescription(itemEx.uid, nam)
                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have looted an Upgraded Item: Semi-Rare")
                 if math.random(1, 100) <= 50 then
                   nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                   doSetItemSpecialDescription(itemEx.uid, nam)
                   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have looted an Upgraded Item: Rare")
                     if math.random(1, 100) <= 25 then
                       nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                       doSetItemSpecialDescription(itemEx.uid, nam)                  
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have looted an Upgraded Item: Very-Rare")
                     end
                 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
 
i just relalized that wasn't an action and you wanted the message to appear if you loot something upgraded (no idea)
 
Last edited:
Just some reccomendations, you dont need to do any of it just mentioning it. Maybe not have sheild% drop on a 2h crossbow, or distance drop on a wand. Maybe make it so the % Stat can only drop on corrisponding loot. Also maybe an explination somewhere in the thread on how to modify chance of drops.

Also anyone checked if the slow remover works? im having some trouble with it, doesn't take stats away. Everything else works fine.
 
Last edited:
Hey guys, I wasn't able to make it send messages to Local Chat. :(

However, I changed it so that it will now show effects above the creature if an upgraded item was looted:
1 Upgrade - Holy Effect
2 Upgrades - Holy + Ice Tornado
3 Upgrades - Holy + Ice + PurpleEnery field

Hope it helps those people who were looking for this, and please improve on it if you feel need be. :)

Code:
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


@nugo
Yes the slot remove works for me,

Also to modify the chance of drops you can play around with this line of code and the similar lines:

Code:
if math.random(1, 100) <= 75 then

For example:

Code:
if math.random(1, 100) <= 99 then
This would increase the chances of looting an upgraded item.

Code:
if math.random(1, 100) <= 10 then
This would decrease the chances of looting an upgraded item.

With this Function:
Code:
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

You can edit how much % Bonus the items get, I edited mine so the maximum is 3%. I just changed n = n+math.random(0,10) to n = n+math.random(0,2).

If I made any mistakes in my explanation please correct me. Thanks.
 
Last edited:
Hey guys, I wasn't able to make it send messages to Local Chat. :(

However, I changed it so that it will now show effects above the creature if an upgraded item was looted:
1 Upgrade - Holy Effect
2 Upgrades - Holy + Ice Tornado
3 Upgrades - Holy + Ice + PurpleEnery field

Hope it helps those people who were looking for this, and please improve on it if you feel need be. :)

Code:
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


@nugo
Yes the slot remove works for me,

Also to modify the chance of drops you can play around with this line of code and the similar lines:

Code:
if math.random(1, 100) <= 75 then

For example:

Code:
if math.random(1, 100) <= 99 then
This would increase the chances of looting an upgraded item.

Code:
if math.random(1, 100) <= 10 then
This would decrease the chances of looting an upgraded item.

With this Function:
Code:
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

You can edit how much % Bonus the items get, I edited mine so the maximum is 3%. I just changed n = n+math.random(0,10) to n = n+math.random(0,2).

If I made any mistakes in my explanation please correct me. Thanks.
Thanks man appreciate it. Got the slow remover to work also, the item id in the example script is a stackable item and i couldn't get to work with a stackable item.
 
Last edited:
how can i convert the thread of MULTI SLOT 0.3.6 to TFS 1.0 , i want that system :(
 
function getItemArmor(uid) return ItemType(getThing(uid).itemid):getArmor() end
function isArmor(uid) if (getItemArmor(uid) ~= 0 and getItemWeaponType(uid) == 0) then return true else return false end end


These 2 functions dont seem to be working properly for me on TFS 1.0 (10.35). Could you please help me? Other than that, great work!
 
Status
Not open for further replies.
Back
Top