freaked1
Active Member
Hello, is there anyway to make bossloot like real tibia for TFS 1.1?
For example when you kill Gaz'Haragoth you get loot sent to you in a chest with a bag containing the loot.
Or make it so that you get a bag directly with the loot.
I have tried with: https://otland.net/threads/boss-reward.243418/
Now I have kinda messed around with the script and changed some stuff, I can't get it to work good.
If 2 people does damage to the monster at the "same" time when it dies both gets loot some of the times.
If one hit it normal while the other SDs it the last ~800health only the one who SDed get the loot.
How my code looks:
IF there is any other script that may work for this I would be glad to see, don't wanna use PARTY share loot as then everyone has to be in party for world bosses.
For example when you kill Gaz'Haragoth you get loot sent to you in a chest with a bag containing the loot.
Or make it so that you get a bag directly with the loot.
I have tried with: https://otland.net/threads/boss-reward.243418/
Now I have kinda messed around with the script and changed some stuff, I can't get it to work good.
If 2 people does damage to the monster at the "same" time when it dies both gets loot some of the times.
If one hit it normal while the other SDs it the last ~800health only the one who SDed get the loot.
How my code looks:
Lua:
local config = {
["Orshabaal"] = {
loot = {{2514,15,1},{2520,20,1},{2472,15,1},{2421,5,1},{5808,15,1},{2470,10,1},{2195,50,1},{2363,10,1},{2152,50,50},{2152,50,50},{2160,50,1},{2134,15,10},{2134,15,10},{9970,15,15},{8299,20,10}},
use_stats = true,
chance_attr = {{'lifesteal',5,{3,7},{"melee","wand","dist"}},{'dodge',5,{1,5},{"all"}}},
SendToDepot = false,
BagId = 9775
},
["Ferumbras"] = {
loot = {{2493,4,1},{2494,4,1},{2495,4,1},{2214,4,1},{5462,4,1},{8850,4,1},{8925,4,1},{7382,4,1},{2436,4,1},{8921,4,1},{6391,4,1},{2157,50,75},{2157,50,50},{2157,25,100}},
message = "Congratulation For Defeating Hypnos,Your Reward is now in bag",
effect = CONST_ME_SOUND_YELLOW,
use_stats = false,
chance_attr = {{'lifesteal',4,{3,7},{"melee","wand","dist"}},{'dodge',4,{1,5},{"armor"}}},
animatedText = {COLOR_MAYABLUE,"YA!"},
SendToDepot = false,
BagId = 2000
},
["Hades"] = {
loot = {{2533,4,1},{7899,4,1},{7894,4,1},{2209,4,1},{7891,4,1},{8851,4,1},{8924,4,1},{7385,4,1},{2421,4,1},{8922,4,1},{2496,4,1},{2157,50,100},{2157,50,100},{2157,25,100}},
message = "Congratulation For Defeating Hades,Your Reward is now in depot",
effect = CONST_ME_FIREWORK_RED,
use_stats = false,
chance_attr = {{'lifesteal',3,{3,7},{"melee","wand","dist"}},{'dodge',3,{1,5},{"all"}}},
animatedText = {COLOR_RED,"YA!"},
SendToDepot = true,
BagId = 9775
},
["Devil"] = {
loot = {{2542,4,1},{7902,4,1},{7897,4,1},{7896,4,1},{2124,4,1},{7892,4,1},{8852,4,1},{7455,4,1},{7420,4,1},{2445,4,1},{7424,4,1},{2157,50,100},{2157,50,100},{2157,50,100},{2157,25,100}},
message = "Congratulation For Defeating Devil,Your Reward is now in depot",
effect = CONST_ME_HEARTS,
use_stats = false,
chance_attr = {{'lifesteal',1,{3,7},{"melee","wand","dist"}},{'dodge',1,{1,5},{"armor"}}},
animatedText = {COLOR_PINK,"YA!"},
SendToDepot = true,
BagId = 9775
}
--[[
["NameOfMonster"] = {
loot = {{itemid,chance,count},{itemid,chance,count}},
message = "Message produced when you kill the boss",
effect = "Effect when you kill boss",
use_stats = false -- if it is true then special attribute will be added
chance_attr = {{'attribute name',chance,{min,max},{applied weapons}},{'attribute name',chance,{min,max},{applied weapons}}},
animatedText = {Color of text,"Text produced"},
SendToDepot = true will send item to the depot, false will send item to player bag auto,
BagId = dont need explanation
}
]]
}
--forgive this part V couldn't think of any better solution
function ItemInfo(array,item)
for i = 1,#array do
if(array[i] == "melee")then
if getItemInfo(item).weaponType == WEAPON_SWORD or getItemInfo(item).weaponType == WEAPON_CLUB or getItemInfo(item).weaponType == WEAPON_AXE then
return true
end
elseif(array[i] == "armor")then
if getItemInfo(item).armor ~= 0 and getItemInfo(item).wieldPosition ~= CONST_SLOT_NECKLACE then
return true
end
elseif(array[i] == "wand")then
if getItemInfo(item).weaponType == WEAPON_WAND then
return true
end
elseif(array[i] == "dist")then
if getItemInfo(item).weaponType == WEAPON_DIST and getItemInfo(item).ammoType ~= 0 then
return true
end
elseif(array[i] == "shield")then
if getItemInfo(item).weaponType == WEAPON_SHIELD and getItemInfo(item).defense ~= 0 then
return true
end
elseif(array[i] == "all")then
return true
end
end
return false
end
--- info scanner End
function onKill(cid, target, damage, flags,war)
if isPlayer(cid) and isMonster(target) then
local monster = config[getCreatureName(target)]
if monster then
local bag = doCreateItemEx(monster.BagId, 1)
for i = 1,#monster.loot do
if monster.loot[i][2] >= math.random(1,100) then -- random chance to get the item
local item = doAddContainerItem(bag, monster.loot[i][1],monster.loot[i][3])
if (monster.use_stats) then
for z = 1,#monster.chance_attr do
if(monster.chance_attr[z][2] >= math.random(1,100) and ItemInfo(monster.chance_attr[z][4], monster.loot[i][1]))then
doItemSetAttribute(item, monster.chance_attr[z][1], math.random(monster.chance_attr[z][3][1],monster.chance_attr[z][3][2])) -- add attribute
end
end
end
end
end
local player = Player(cid)
local playerPos = player:getPosition()
if(getContainerItem(bag, 0).uid > 0)then -- check if the container has items or not
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, ("Congratulations! Your loot is in the bag."))
playerPos:sendMagicEffect(CONST_ME_MAGIC_GREEN)
if monster.SendToDepot then
doPlayerSendMailByName(getCreatureName(cid), bag, getPlayerTown(cid), "Admin") -- send to depot
else
doPlayerAddItemEx(cid, bag,true) -- send to bag
end
doPlayerSendTextMessage(cid, 25, monster.message)
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, ("You got no reward, better luck next time."))
end
end
end
return true
end
IF there is any other script that may work for this I would be glad to see, don't wanna use PARTY share loot as then everyone has to be in party for world bosses.