metiu11
Member
- Joined
- Mar 26, 2011
- Messages
- 94
- Solutions
- 2
- Reaction score
- 5
Hello,
i found script which give a loot everyone players who shoot boss.
But i dont know how to add it in creaturescript.xml
I was add this:
but its not worked... which event type is it?
i found script which give a loot everyone players who shoot boss.
But i dont know how to add it in creaturescript.xml
I was add this:
Code:
<event type="kill" name="kill" event="script" value="boss reward.lua"/>
but its not worked... which event type is it?
Code:
local config = {
["Bandit"] = {
loot = {{2663,4,1},{2656,4,1},{7730,4,1},{2202,4,1},{2640,4,1},{8849,4,1},{8926,4,1},{7407,4,1},{7450,4,1},{8911,4,1},{2534,4,1},{2157,50,50},{2157,25,100}},
message = "Congratulation For Defeating Poseidon,Your Reward is now in bag",
effect = CONST_ME_SOUND_PURPLE,
use_stats = false,
chance_attr = {{'lifesteal',5,{3,7},{"melee","wand","dist"}},{'dodge',5,{1,5},{"armor"}}},
animatedText = {COLOR_BLUE,"YA!"},
SendToDepot = false,
BagId = 9775
},
["Hypnos"] = {
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
if(getContainerItem(bag, 0).uid > 0)then -- check if the container has items or not
doSendMagicEffect(getThingPos(cid), monster.effect)
doSendAnimatedText(getThingPos(cid), monster.animatedText[2],monster.animatedText[1])
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
doPlayerSendTextMessage(cid, 25, "Better Luck Next Time,You Got No Reward.")
end
end
end
return true
end