Guerra
Member
Dears,
I am having some errors in the extra loot system provided here on the forum by zbizu. The System predicts that I choose the monsters that will have an extra loot added, but in reality it is not only selecting the monsters that we put in the system. It's giving extra loot to all the monsters on the server. I would like the loot to be only for those that I configured in the code. In addition to this problem, when killing some monsters there is an error on my server, an error that I will post below so you can help me fix it !! I ask everyone's help because I have no idea how to solve it.
finally, print the error on my console
I am having some errors in the extra loot system provided here on the forum by zbizu. The System predicts that I choose the monsters that will have an extra loot added, but in reality it is not only selecting the monsters that we put in the system. It's giving extra loot to all the monsters on the server. I would like the loot to be only for those that I configured in the code. In addition to this problem, when killing some monsters there is an error on my server, an error that I will post below so you can help me fix it !! I ask everyone's help because I have no idea how to solve it.
CreatureEvent - [TFS 1.1] Extra loot system
Based on @Eldin 's request It adds items randomly to killed monsters. Configurable group of monsters and chance events.xml (this line exist in your file already, just set enabled to "1") creature.lua event below: function Creature:onTargetCombat(target) add: if not self then return true end...
otland.net
Lua:
math.randomseed(os.time())
local extra_loot = {
{hasName = "dragon", "giant spider", "cyclops drone", "cyclops smith", "frost giant", "ogre brute", "ogre savage", "ogre shaman", "orclops doomhauler", "orclops ravager", "bog raider", "nightmare scion", "hero", "black knight", "necromancer", "renegade knight", "vile grandmaster", "vicious squire", "clomp", "stone rhino", "vulcongra", "banshee", "blood beast", "lich", "spectre", "vampire bride", "vampire viscount", "vicious manbat", "lizard dragon priest", "lizard high guard", "lizard legionnaire", "sea serpent", "stampor", "ancient scarab", "crawler", "lost basher", "lost exile", "lost husher", "lost thrower", "minotaur amazon", "minotaur hunter", "minotaur invader", "mooh'tah warrior", "dragon lord", "hydra", "frost dragon", "wyrm", "elder wyrm", "undead dragon", "behemoth", "grim reaper", "ghastly dragon", "betrayed wraith", "draken abomination", "draken elite", "draken spellweaver", "draken warmaster", "ice dragon", "ogre rowdy", "ogre rufian", "dragonling", "nightmare", "askarak prince", "destroyer", "hellspawn", "nightfiend", "shaburak prince", "infernalist", "warlock", "hideous fungus", "humongous fungus", "draptor", "lizard chosen", "lizard zaogun", "seacrest serpent", "serpent spawn", "defiler", "enslaved dwarf", "moohtant", "choking fear", "frazzlemaw", "guzzlemaw", "medusa", "retching horror", "silencer", "terrorsleep", "dark torturer", "dawnfire asura", "demon", "demon outcast", "fury", "grimeleech", "hellfire fighter", "hellflayer", "hellhound", "midnight asura", "plaguesmith", "vexclaw", "falcon knight", "falcon paladin", "blightwalker", "hand of cursed fate", "lost soul", "lizard magistratus", "lizard noble", "lost berserker", items = {
{id = 2152, countMax = 12, chance = 10000}, -- Platinum Coin
{id = 2160, countMax = 2, chance = 1000} -- Crystal Coin
}},
{items = {
{id = 6507, chance = 10000}, -- Hunt Bag T1
{id = 6508, chance = 3000}, -- Hunt Bag T2
{id = 6509, chance = 1000} -- Hunt Bag t3
}},
}
function Container:addExtraLoot(c, t)
if t.hasName then
local cn = c:getName():lower()
local cm = t.hasName:lower()
if not cn:match(cm) then
return true
end
end
for i = 1, #t.items do
local count = 1
if t.items[i].count then
if t.items[i].countMax then
count = math.random(t.items[i].count, t.items[i].countMax)
else
count = t.items[i].count
end
else
if t.items[i].countMax then
count = math.random(1, t.items[i].countMax)
end
end
if math.random(0, 100000) <= t.items[i].chance then
self:addItem(t.items[i].id, count)
end
end
end
function onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if not creature:isMonster() then return true end
if corpse and corpse:isContainer() then
for i = 1, #extra_loot do
corpse:addExtraLoot(creature, extra_loot[i])
end
end
return true
end
finally, print the error on my console
Last edited: