Postado Outubro 20, 2019 5 anos Autor @luanluciano93 Entende muito mano! Mas como eu faço pra puxar a storage do player que ta com o amuleto por aí, tu sabe? Porque acho que esse self é o "container", corpo do monstro. E aí eu colocaria essa parte if randvalue < item.chance then Dentro de um if, que seria caso a storage == -1, fica esse normal, caso a storage == 1 (usando o amuleto), fica: if randvalue < item.chance * 1.05 then Que seria a item.chance aumentada em 5%. É isso?
Postado Outubro 21, 2019 5 anos 3 minutos atrás, luanluciano93 disse: function Monster:onDropLoot(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() local amuletChance = 1 local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) if amulet and amulet.itemid == ITEMID then amuletChance = 1.05 end for i = 1, #monsterLoot do local item = corpse:createLootItem(monsterLoot[i], amuletChance) 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 Spoiler function Container.createLootItem(self, item, amulet) if self:getEmptySlots() == 0 then return true end local itemCount = 0 local randvalue = getLootRandom() if randvalue < (item.chance * amulet) then if ItemType(item.itemId):isStackable() then itemCount = randvalue % item.maxCount + 1 else itemCount = 1 end end if itemCount > 0 then local tmpItem = self:addItem(item.itemId, math.min(itemCount, 100)) if not tmpItem then return false end if tmpItem:isContainer() then for i = 1, #item.childLoot do if not tmpItem:createLootItem(item.childLoot[i]) then tmpItem:remove() return false end end end if item.subType ~= -1 then tmpItem:setAttribute(ITEM_ATTRIBUTE_CHARGES, item.subType) end if item.actionId ~= -1 then tmpItem:setActionId(item.actionId) end if item.text and item.text ~= "" then tmpItem:setText(item.text) end end return true end Editado Outubro 21, 2019 5 anos por luanluciano93 (veja o histórico de edições) STYLLER OT 2022
Postado Outubro 21, 2019 5 anos Autor @luanluciano93 Primeiro, meu monster.lua nos scripts de events era só isso: Spoiler function Monster:onSpawn(position) return true end -- Example --[[ function Monster:onSpawn(position) local maxHealth = math.random(self:getHealth()) self:addHealth(-maxHealth) return true end ]] Aí adicionei essas 2 funções que tu mandou abaixo. Mas não mudou nada. Troquei a parte que diz ITEMID pelo ID do Lucky Clover Amulet (11393), e tentei colocar um número altíssimo ali em amuletchance, mas não mudou a taxa de drop dos itens. Editado Outubro 21, 2019 5 anos por MatCollier (veja o histórico de edições)
Postado Outubro 24, 2019 5 anos @luanluciano93 por experience event é mais facil fazer. Só vai precisar registar onkill e voltar storage, estou sem tempo no momento tenta ve se dar. ja que a weapon começa o event exp o onkill pode verificar se adicionou ou não e retornar o valor. Editado Outubro 24, 2019 5 anos por underewarr (veja o histórico de edições)
Postado Outubro 24, 2019 5 anos Autor @underewarr Aparentemente faz sentido o que tas dizendo, mas duvido muito que eu consiga fazer sozinho. Vou tentando aqui!
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.