sucibob
Member
- Joined
- Mar 28, 2017
- Messages
- 128
- Reaction score
- 13
how to create a prey system, using the monster of the day 0.4 from @buchaLL
monsteroftheday_onkill.lua
1) a action that player can use each 24 hours to change the monster have to kill
2) so after this, the player have 1000 monster with this bonus to kill
3) how this loot bonus works?
how can i change the % loot rates?
Code:
<event type="death" name="monsteroftheday_onkill" event="script" value="monsteroftheday_onkill.lua"/>
monsteroftheday_onkill.lua
Code:
local BOOSTED_MONSTER = 56405
local boostedMonstersList = {"rat", "spider", "troll", "orc", "minotaur", "dwarf", "elf", "skeleton", "amazon", "valkirie", "dark apprentice", "ghoul", "cyclops", "dwarf guard", "necromancer", "vampire", "werewolf", "dragon", "dragon lord", "wyrm", "giant spider", "hydra", "warlock", "demon"}
local bonus = 0.5
function onDeath(cid, corpse, deathList)
local master = getCreatureMaster(cid)
if (master and master ~= cid) then
return true
end
local boostedMonster = boostedMonstersList[getGlobalStorageValue(BOOSTED_MONSTER)]
if getCreatureName(cid):lower() == boostedMonster then
for i = 1, #deathList do
-- loot bonus
local lootList = getMonsterLootList(getCreatureName(cid))
for i, _ in pairs(lootList) do
if lootList[i].count > 1 then
local numb = math.random(1, lootList[i].count)
doAddContainerItem(corpse.uid, lootList[i].id, numb)
elseif math.random(1,100000) <= lootList[i].chance then
doAddContainerItem(corpse.uid, lootList[i].id, 1)
end
end
end
end
return true
end
Code:
<script>
<event name="monsteroftheday_onkill"/>
</script>
1) a action that player can use each 24 hours to change the monster have to kill
2) so after this, the player have 1000 monster with this bonus to kill
3) how this loot bonus works?
how can i change the % loot rates?