nanduzenho
Member
Good afternoon, can someone make a script for a Ring that increases the chance of dropping loot from monsters? You can use any ring as an example. Thank u!
As simple as this but probably you didnt even triedI don't know how to edit
local ec = EventCallback
ec.onDropLoot = function(self, corpse)
if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
return
end
local player = Player(corpse:getCorpseOwner())
local mType = self:getType()
if not player or player:getStamina() > 840 then
local monsterLoot = mType:getLoot()
for i = 1, #monsterLoot do
-- // NEW CODE
local ring = player:getSlotItem(CONST_SLOT_RING)
if ring and ring:getId() == 2123 then
local extraPercent = 20
local default = monsterLoot[i].chance
if default < 100000 then...
I don't know how to editCheck this thread, there is a 20% loot feature
https://forums.otserv.com.br/index.php?/forums/topic/169730-revscript-sistema-vip/
If you don't know how to edit and you're not keen to learn it, then why do you try to host an OT? It won't be successful.I don't know how to edit
Monster:onDropLoot
function in events/monster.lua:local LootPercent = 0
if player:getStorageValue(YOUR_STORAGE_HERE) < 1 then
local percent = 20 -- 20% extra loot
if percent then
LootPercent = (percent / 100)
end
end
monsterLoot[i].chance = monsterLoot[i].chance + (monsterLoot[i].chance * LootPercent)
As simple as this but probably you didnt even triedI don't know how to edit
local ec = EventCallback
ec.onDropLoot = function(self, corpse)
if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
return
end
local player = Player(corpse:getCorpseOwner())
local mType = self:getType()
if not player or player:getStamina() > 840 then
local monsterLoot = mType:getLoot()
for i = 1, #monsterLoot do
-- // NEW CODE
local ring = player:getSlotItem(CONST_SLOT_RING)
if ring and ring:getId() == 2123 then
local extraPercent = 20
local default = monsterLoot[i].chance
if default < 100000 then
monsterLoot[i].chance = default + ((extraPercent * (default / 1000) / 100) * 1000)
end
end
-- // NEW CODE
local item = corpse:createLootItem(monsterLoot[i])
if not item then
print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
end
end
if player then
local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_LOOT, text)
end
end
else
local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_LOOT, text)
end
end
end
ec:register()
Can u make it for VIP please, if you are VIP u can wear it for x time then it is separated while the time ends. VIP System [The Forgotten Server 1.0] (https://otland.net/threads/vip-system-the-forgotten-server-1-0.224910/) for this scriptAs simple as this but probably you didnt even tried
Lua:local ec = EventCallback ec.onDropLoot = function(self, corpse) if configManager.getNumber(configKeys.RATE_LOOT) == 0 then return end local player = Player(corpse:getCorpseOwner()) local mType = self:getType() if not player or player:getStamina() > 840 then local monsterLoot = mType:getLoot() for i = 1, #monsterLoot do -- // NEW CODE local ring = player:getSlotItem(CONST_SLOT_RING) if ring and ring:getId() == 2123 then local extraPercent = 20 local default = monsterLoot[i].chance if default < 100000 then monsterLoot[i].chance = default + ((extraPercent * (default / 1000) / 100) * 1000) end end -- // NEW CODE local item = corpse:createLootItem(monsterLoot[i]) if not item then print('[Warning] DropLoot:', 'Could not add loot item to corpse.') end end if player then local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end else local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end end ec:register()
No problem but kinda didnt understand what you meant, you want to get extraPercent as long as player is VIP?Can u make it for VIP please, if you are VIP u can wear it for x time then it is separated while the time ends. VIP System [The Forgotten Server 1.0] (https://otland.net/threads/vip-system-the-forgotten-server-1-0.224910/) for this script
As simple as this but probably you didnt even tried
Lua:local ec = EventCallback ec.onDropLoot = function(self, corpse) if configManager.getNumber(configKeys.RATE_LOOT) == 0 then return end local player = Player(corpse:getCorpseOwner()) local mType = self:getType() if not player or player:getStamina() > 840 then local monsterLoot = mType:getLoot() for i = 1, #monsterLoot do -- // NEW CODE local ring = player:getSlotItem(CONST_SLOT_RING) if ring and ring:getId() == 2123 then local extraPercent = 20 local default = monsterLoot[i].chance if default < 100000 then monsterLoot[i].chance = default + ((extraPercent * (default / 1000) / 100) * 1000) end end -- // NEW CODE local item = corpse:createLootItem(monsterLoot[i]) if not item then print('[Warning] DropLoot:', 'Could not add loot item to corpse.') end end if player then local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end else local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end end ec:register()
data/scripts/yourfile.luaExcuse my ignorance, how do i install this script?
As simple as this but probably you didnt even tried
Lua:local ec = EventCallback ec.onDropLoot = function(self, corpse) if configManager.getNumber(configKeys.RATE_LOOT) == 0 then return end local player = Player(corpse:getCorpseOwner()) local mType = self:getType() if not player or player:getStamina() > 840 then local monsterLoot = mType:getLoot() for i = 1, #monsterLoot do -- // NEW CODE local ring = player:getSlotItem(CONST_SLOT_RING) if ring and ring:getId() == 2123 then local extraPercent = 20 local default = monsterLoot[i].chance if default < 100000 then monsterLoot[i].chance = default + ((extraPercent * (default / 1000) / 100) * 1000) end end -- // NEW CODE local item = corpse:createLootItem(monsterLoot[i]) if not item then print('[Warning] DropLoot:', 'Could not add loot item to corpse.') end end if player then local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end else local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end end ec:register()
data/scripts/eventcallbacks/monster/default_onDropLoot.luaView attachment 66127
i think my TFS 1.3 doesn't have EventCallback function
my server is TFS 1.3 - version 8.6, it doesn't have eventcallback folderdata/scripts/eventcallbacks/monster/default_onDropLoot.lua
data/scripts/eventcallbacks/monster/default_onDropLoot.lua
Yes, sir! and u can only wear it if you are VIP for x time.No problem but kinda didnt understand what you meant, you want to get extraPercent as long as player is VIP?
As simple as this but probably you didnt even tried
Lua:local ec = EventCallback ec.onDropLoot = function(self, corpse) if configManager.getNumber(configKeys.RATE_LOOT) == 0 then return end local player = Player(corpse:getCorpseOwner()) local mType = self:getType() if not player or player:getStamina() > 840 then local monsterLoot = mType:getLoot() for i = 1, #monsterLoot do -- // NEW CODE local ring = player:getSlotItem(CONST_SLOT_RING) if ring and ring:getId() == 2123 then local extraPercent = 20 local default = monsterLoot[i].chance if default < 100000 then monsterLoot[i].chance = default + ((extraPercent * (default / 1000) / 100) * 1000) end end -- // NEW CODE local item = corpse:createLootItem(monsterLoot[i]) if not item then print('[Warning] DropLoot:', 'Could not add loot item to corpse.') end end if player then local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end else local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription()) local party = player:getParty() if party then party:broadcastPartyLoot(text) else player:sendTextMessage(MESSAGE_LOOT, text) end end end ec:register()
local ec = EventCallback
ec.onDropLoot = function(self, corpse)
if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
return
end
local player = Player(corpse:getCorpseOwner())
local mType = self:getType()
if not player or player:getStamina() > 840 then
local monsterLoot = mType:getLoot()
for i = 1, #monsterLoot do
-- // NEW CODE
-- // local ring = player:getSlotItem(CONST_SLOT_RING)
-- //if ring and ring:getId() == 2123 then
if self:getStorageValue(44444) > os.time() then
local extraPercent = 20
local default = monsterLoot[i].chance
if default < 100000 then
monsterLoot[i].chance = default + ((extraPercent * (default / 1000) / 100) * 1000)
end
end
-- // NEW CODE
local item = corpse:createLootItem(monsterLoot[i])
if not item then
print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
end
end
if player then
local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_LOOT, text)
end
end
else
local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_LOOT, text)
end
end
end
ec:register()