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

script to add item in loot to all monsters at once

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, im looking for a script where you put items and loot chance and when it start like /startevent all the monster will start droping these items (in the dead body) until the event is finished /endevent
something like this, for example fr holydays, christmas stuff idk
i have searched for this but i can't find anything similar, does anyone know or have this that could share it with me? :D
TFS 0.3

or maybe not necesarily as a event, but as you put them and there, every creature drops it now
i have card items, cards for every mount there is, so i would hate to put all those cards in every monster loot
 
Last edited:
Solution
im sorry man if it not a trouble, could you make it to last forever? i mean that starts with the server up and ends with the server down? all the time working? like a normal loot list for every creature? if not's too much to ask ;c
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
       
           registerCreatureEvent(cid, "SuperLoot")
           
   </description>
   <config name="sloot"><![CDATA[
       config = {
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent}...
I think it should, I didn't test it, MOD VERSION:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
       
           registerCreatureEvent(cid, "SuperLoot")
           
   </description>
   <config name="sloot"><![CDATA[
       config = {
           message = "Holytimes have come! Everyone can drop extra loot from monster for another 3 hours!",
           finished = "Holytimes has ended!",
           timer = 180, -- minutes
           auto = "yes",
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent},
           items = {
               {8888, 1, 100},
               {8889, 1, 5},
               {2160, 5, 33}
           }
       }
   ]]></config>
   <globalevent name="SuperLootAuto" time="16:00" event="script"><![CDATA[
   domodlib('sloot')
   function onTime(interval, lastExecution)
       if config.timer == "yes" then
           doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
           setGlobalStorageValue(config.storage, 1)
           addEvent(function()
               doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 0)
           end, config.timer * 60 * 1000)
           return true
       end
       return true
   end
   ]]></globalevent>
   <talkaction words="!holytimes" event="script"><![CDATA[
   domodlib('sloot')
   function onSay(cid, words, param, channel)
       if getPlayerGroupId(cid) <= 3 then
           return false
       end
       if getPlayerGroupId(cid) > 3 then
           if param == "" then
               doPlayerSendCancel(cid, "Command param required. Available: start, stop.")
           elseif string.lower(param) == "start" then
               if getGlobalStorageValue(config.storage) == 1 then
                   doPlayerSendCancel(cid, "You cannot start event, event is running.")
                   return true
               end
               doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 1)
               addEvent(function()
                   doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
                   setGlobalStorageValue(config.storage, 0)
               end, config.timer * 60 * 1000)
           elseif string.lower(param) == "stop" then
               doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 0)
           end
           return true
       end
       return true
   end
   ]]></talkaction>
   <event type="kill" name="SuperLoot" event="script"><![CDATA[
   domodlib('sloot')
   function onKill(cid, target, lastHit)
       if getGlobalStorageValue(config.storage) ~= 1 then
           return true
       end
       local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
       local pos = getCreaturePosition(target)
       if isMonster(target) and getCreatureMaster(target) == target then
           addEvent(function(pos, corpse)
               if isContainer(getTileItemById(pos, corpse).uid) then
                   local change = math.random(1, 100)
                   for i = 1, #config.items do
                       if chance <= config.items[i][3] then
                           local amount = config.items[i][2]
                           if amount > 1 and config.random_amount_if_more_than_one == "yes" then
                               amount = math.random(1, config.items[i][2])
                           end
                           doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
                       end
                   end
               end
           end, 1, pos, corpseId)
           return true
       end
       return true
   end
   ]]></event>
</mod>
 
Last edited:
I think it should, I didn't test it, MOD VERSION:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
      
           registerCreatureEvent(cid, "SuperLoot")
          
   </description>
   <config name="sloot"><![CDATA[
       config = {
           message = "Holytimes have come! Everyone can drop extra loot from monster for another 3 hours!",
           finished = "Holytimes has ended!",
           timer = 180, -- minutes
           auto = "yes",
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent},
           items = {
               {8888, 1, 100},
               {8889, 1, 5},
               {2160, 5, 33}
           }
       }
   ]]></config>
   <globalevent name="SuperLootAuto" time="16:00" event="script"><![CDATA[
   domodlib('sloot')
   function onTime(interval, lastExecution)
       if config.timer == "yes" then
           doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
           setGlobalStorageValue(config.storage, 1)
           addEvent(function()
               doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 0)
           end, config.timer * 60 * 1000)
           return true
       end
       return true
   end
   ]]></globalevent>
   <talkaction words="!holytimes" event="script"><![CDATA[
   domodlib('sloot')
   function onSay(cid, words, param, channel)
       if getPlayerGroupId(cid) <= 3 then
           return false
       end
       if getPlayerGroupId(cid) > 3 then
           if param == "" then
               doPlayerSendCancel(cid, "Command param required. Available: start, stop.")
           elseif string.lower(param) == "start" then
               if getGlobalStorageValue(config.storage) == 1 then
                   doPlayerSendCancel(cid, "You cannot start event, event is running.")
                   return true
               end
               doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 1)
               addEvent(function()
                   doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
                   setGlobalStorageValue(config.storage, 0)
               end, config.timer * 60 * 1000)
           elseif string.lower(param) == "stop" then
               doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 0)
           end
           return true
       end
       return true
   end
   ]]></talkaction>
   <event type="kill" name="SuperLoot" event="script"><![CDATA[
   domodlib('sloot')
   function onKill(cid, target, lastHit)
       if getGlobalStorageValue(config.storage) ~= 1 then
           return true
       end
       local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
       local pos = getCreaturePosition(target)
       if isMonster(target) and getCreatureMaster(target) == target then
           addEvent(function(pos, corpse)
               if isContainer(getTileItemById(pos, corpse).uid) then
                   local change = math.random(1, 100)
                   for i = 1, #config.items do
                       if chance <= config.items[i][3] then
                           local amount = config.items[i][2]
                           if amount > 1 and config.random_amount_if_more_than_one == "yes" then
                               amount = math.random(1, config.items[i][2])
                           end
                           doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
                       end
                   end
               end
           end, 1, pos, corpseId)
           return true
       end
       return true
   end
   ]]></event>
</mod>


im sorry man if it not a trouble, could you make it to last forever? i mean that starts with the server up and ends with the server down? all the time working? like a normal loot list for every creature? if not's too much to ask ;c
 
im sorry man if it not a trouble, could you make it to last forever? i mean that starts with the server up and ends with the server down? all the time working? like a normal loot list for every creature? if not's too much to ask ;c
As simple as removing a few lines, you should start trying yourself.
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
      
           registerCreatureEvent(cid, "SuperLoot")
          
   </description>
   <config name="sloot"><![CDATA[
       config = {
           message = "Holytimes have come! Everyone can drop extra loot from monster for another 3 hours!",
           finished = "Holytimes has ended!",
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent},
           items = {
               {8888, 1, 100},
               {8889, 1, 5},
               {2160, 5, 33}
           }
       }
   ]]></config>
   <talkaction words="!holytimes" event="script"><![CDATA[
   domodlib('sloot')
   function onSay(cid, words, param, channel)
       if getPlayerGroupId(cid) <= 3 then
           return false
       end
       if getPlayerGroupId(cid) > 3 then
           if param == "" then
               doPlayerSendCancel(cid, "Command param required. Available: start, stop.")
           elseif string.lower(param) == "start" then
               if getGlobalStorageValue(config.storage) == 1 then
                   doPlayerSendCancel(cid, "You cannot start event, event is running.")
                   return true
               end
               doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 1)
           elseif string.lower(param) == "stop" then
               doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 0)
           end
           return true
       end
       return true
   end
   ]]></talkaction>
   <event type="kill" name="SuperLoot" event="script"><![CDATA[
   domodlib('sloot')
   function onKill(cid, target, lastHit)
       if getGlobalStorageValue(config.storage) ~= 1 then
           return true
       end
       local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
       local pos = getCreaturePosition(target)
       if isMonster(target) and getCreatureMaster(target) == target then
           addEvent(function(pos, corpse)
               if isContainer(getTileItemById(pos, corpse).uid) then
                   local change = math.random(1, 100)
                   for i = 1, #config.items do
                       if chance <= config.items[i][3] then
                           local amount = config.items[i][2]
                           if amount > 1 and config.random_amount_if_more_than_one == "yes" then
                               amount = math.random(1, config.items[i][2])
                           end
                           doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
                       end
                   end
               end
           end, 1, pos, corpseId)
           return true
       end
       return true
   end
   ]]></event>
</mod>
 
As simple as removing a few lines, you should start trying yourself.
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
     
           registerCreatureEvent(cid, "SuperLoot")
         
   </description>
   <config name="sloot"><![CDATA[
       config = {
           message = "Holytimes have come! Everyone can drop extra loot from monster for another 3 hours!",
           finished = "Holytimes has ended!",
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent},
           items = {
               {8888, 1, 100},
               {8889, 1, 5},
               {2160, 5, 33}
           }
       }
   ]]></config>
   <talkaction words="!holytimes" event="script"><![CDATA[
   domodlib('sloot')
   function onSay(cid, words, param, channel)
       if getPlayerGroupId(cid) <= 3 then
           return false
       end
       if getPlayerGroupId(cid) > 3 then
           if param == "" then
               doPlayerSendCancel(cid, "Command param required. Available: start, stop.")
           elseif string.lower(param) == "start" then
               if getGlobalStorageValue(config.storage) == 1 then
                   doPlayerSendCancel(cid, "You cannot start event, event is running.")
                   return true
               end
               doBroadcastMessage(config.message, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 1)
           elseif string.lower(param) == "stop" then
               doBroadcastMessage(config.finished, MESSAGE_STATUS_WARNING)
               setGlobalStorageValue(config.storage, 0)
           end
           return true
       end
       return true
   end
   ]]></talkaction>
   <event type="kill" name="SuperLoot" event="script"><![CDATA[
   domodlib('sloot')
   function onKill(cid, target, lastHit)
       if getGlobalStorageValue(config.storage) ~= 1 then
           return true
       end
       local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
       local pos = getCreaturePosition(target)
       if isMonster(target) and getCreatureMaster(target) == target then
           addEvent(function(pos, corpse)
               if isContainer(getTileItemById(pos, corpse).uid) then
                   local change = math.random(1, 100)
                   for i = 1, #config.items do
                       if chance <= config.items[i][3] then
                           local amount = config.items[i][2]
                           if amount > 1 and config.random_amount_if_more_than_one == "yes" then
                               amount = math.random(1, config.items[i][2])
                           end
                           doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
                       end
                   end
               end
           end, 1, pos, corpseId)
           return true
       end
       return true
   end
   ]]></event>
</mod>

and the talkaction what is it for? o_O
 
Lmao, man you should try to at least read the code a little bit instead of just copying and pasting and hoping for the best.
!holytimes start
Lua:
elseif string.lower(param) == "start" then
!holytimes stop
Lua:
elseif string.lower(param) == "stop" then
Do you see what I'm talkinga about?
 
Lmao, man you should try to at least read the code a little bit instead of just copying and pasting and hoping for the best.
!holytimes start
Lua:
elseif string.lower(param) == "start" then
!holytimes stop
Lua:
elseif string.lower(param) == "stop" then
Do you see what I'm talkinga about?
hell man then why you even help? of course i read the code and i see the talkaction is to start and end the event right? but you did this script with the intention to make it forever, without a start and end right? that's why im asking why is there a talkaction? :/
 
im sorry man if it not a trouble, could you make it to last forever? i mean that starts with the server up and ends with the server down? all the time working? like a normal loot list for every creature? if not's too much to ask ;c
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
       
           registerCreatureEvent(cid, "SuperLoot")
           
   </description>
   <config name="sloot"><![CDATA[
       config = {
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent},
           items = {
               {8888, 1, 100},
               {8889, 1, 5},
               {2160, 5, 33}
           }
       }
   ]]></config>
   <globalevent name="SuperLootAuto" type="startup" event="script"><![CDATA[
   domodlib('sloot')
   function onStartup()
       setGlobalStorageValue(config.storage, 1)
       return true
   end
   ]]></globalevent>
   <event type="kill" name="SuperLoot" event="script"><![CDATA[
   domodlib('sloot')
   function onKill(cid, target, lastHit)
       if getGlobalStorageValue(config.storage) ~= 1 then
           return true
       end
       local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
       local pos = getCreaturePosition(target)
       if isMonster(target) and getCreatureMaster(target) == target then
           addEvent(function(pos, corpse)
               if isContainer(getTileItemById(pos, corpse).uid) then
                   local change = math.random(1, 100)
                   for i = 1, #config.items do
                       if chance <= config.items[i][3] then
                           local amount = config.items[i][2]
                           if amount > 1 and config.random_amount_if_more_than_one == "yes" then
                               amount = math.random(1, config.items[i][2])
                           end
                           doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
                       end
                   end
               end
           end, 1, pos, corpseId)
           return true
       end
       return true
   end
   ]]></event>
</mod>
 
Solution
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Super Loot Event" version="1.0" author="GarQet" contact="https://otland.net/members/garqet.30076/" enabled="yes">
   <description>
       --Add lane to your login.lua in creaturescripts:
      
           registerCreatureEvent(cid, "SuperLoot")
          
   </description>
   <config name="sloot"><![CDATA[
       config = {
           storage = "111111",
           random_amount_if_more_than_one = "yes",
           -- {item_id, amount, percent},
           items = {
               {8888, 1, 100},
               {8889, 1, 5},
               {2160, 5, 33}
           }
       }
   ]]></config>
   <globalevent name="SuperLootAuto" type="startup" event="script"><![CDATA[
   domodlib('sloot')
   function onStartup()
       setGlobalStorageValue(config.storage, 1)
       return true
   end
   ]]></globalevent>
   <event type="kill" name="SuperLoot" event="script"><![CDATA[
   domodlib('sloot')
   function onKill(cid, target, lastHit)
       if getGlobalStorageValue(config.storage) ~= 1 then
           return true
       end
       local corpse = getMonsterInfo(getCreatureName(target)).lookCorpse
       local pos = getCreaturePosition(target)
       if isMonster(target) and getCreatureMaster(target) == target then
           addEvent(function(pos, corpse)
               if isContainer(getTileItemById(pos, corpse).uid) then
                   local change = math.random(1, 100)
                   for i = 1, #config.items do
                       if chance <= config.items[i][3] then
                           local amount = config.items[i][2]
                           if amount > 1 and config.random_amount_if_more_than_one == "yes" then
                               amount = math.random(1, config.items[i][2])
                           end
                           doAddContainerItem(getTileItemById(pos, corpse).uid, amount, config.items[i][1])
                       end
                   end
               end
           end, 1, pos, corpseId)
           return true
       end
       return true
   end
   ]]></event>
</mod>

wow thanks man!!! :D
i'll test it as soon as i can :D thank you!!
 
Back
Top