Ir para conteúdo

Featured Replies

Postado

@MatCollier verifica se o copiar do topico nao esta alterando os caracteres no editor de texto

  • Respostas 24
  • Visualizações 1.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • luanluciano93
    luanluciano93

    Resultado sobre o que pesquisei ...  Em data/events/scripts/monster.lua tem uma função que pelo que me parece gera o loot do monstro:  function Monster:onDropLoot(corpse) if configManager.getN

  • luanluciano93
    luanluciano93

Posted Images

Postado

@MatCollier Tenta assim, acho que faltou fechar o bloco do while

 

Spoiler

if getPlayerStorageValue(cid, stor) >= 0 then
		local stor = 12345 -- storage
		-- Apply rarity chance to corpse contents
       find_loot_Container(corpse:getPosition())
     
       -- Print loot list to Server Log
		if owner then
			local loot_msg = "[Lucky] Loot of " .. self:getNameDescription() .. ": " .. corpse:getContentDescription()
			if owner:getParty() then
               owner:getParty():broadcastLoot(loot_msg)
               owner:getParty():broadcastChannelLoot(loot_msg)
			else
               owner:sendTextMessage(MESSAGE_INFO_DESCR, loot_msg)
               -- Loot channel un-used on my server.
               -- owner:channelSay(nil, TALKTYPE_CHANNEL_O, loot_msg, 10)
			end
		end
		else
			local loot_msg = "Loot of " .. self:getNameDescription() .. ": nothing (due to low stamina)"
			if owner:getParty() then
			owner:getParty():broadcastLoot(loot_msg)
			owner:getParty():broadcastChannelLoot(loot_msg)
		else
			owner:sendTextMessage(MESSAGE_INFO_DESCR, loot_msg)
		end
   
		function MonsterType.createLootItem(self, lootBlock, modifier)
			local lootTable = {}
			local itemCount = 0
			local randvalue = math.random(0, 10000*10) / (configManager.getNumber(configKeys.RATE_LOOT) * modifier);
			if randvalue < lootBlock.chance then
				if (ItemType(lootBlock.itemId):isStackable()) then
					itemCount = randvalue % lootBlock.maxCount + 1;
				else
					itemCount = 1;
					while (itemCount > 0) do
						local n = math.min(itemCount, 100)
						itemCount = itemCount - n
						local item = Game.createItem(lootBlock.itemId, n)
						if item thenfunction Player:onGainExperience(source, exp, rawExp) 

if getPlayerStorageValue(cid, stor) >= 0 then
local stor = 12345 -- storage
    -- Apply rarity chance to corpse contents
       find_loot_Container(corpse:getPosition())
     
       -- Print loot list to Server Log
       if owner then
           local loot_msg = "Loot of " .. self:getNameDescription() .. ": " .. corpse:getContentDescription()

           if owner:getParty() then
               owner:getParty():broadcastLoot(loot_msg)
               owner:getParty():broadcastChannelLoot(loot_msg)
           else
               owner:sendTextMessage(MESSAGE_INFO_DESCR, loot_msg)
               -- Loot channel un-used on my server.
               -- owner:channelSay(nil, TALKTYPE_CHANNEL_O, loot_msg, 10)
           end
       end
   else
       local loot_msg = "Loot of " .. self:getNameDescription() .. ": nothing (due to low stamina)"

       if owner:getParty() then
           owner:getParty():broadcastLoot(loot_msg)
           owner:getParty():broadcastChannelLoot(loot_msg)
       else
           owner:sendTextMessage(MESSAGE_INFO_DESCR, loot_msg)
       end
   
--local corpse:decay() = 
corpse:decay()

function MonsterType.createLootItem(self, lootBlock, modifier)
   local lootTable = {}
   local itemCount = 0
   local randvalue = math.random(0, 100000) / (configManager.getNumber(configKeys.RATE_LOOT) * modifier);
      if randvalue < lootBlock.chance then
       if (ItemType(lootBlock.itemId):isStackable()) then
           itemCount = randvalue % lootBlock.maxCount + 1;
       else
           itemCount = 1;
   while (itemCount > 0) do
       local n = math.min(itemCount, 100)
       itemCount = itemCount - n

       local item = Game.createItem(lootBlock.itemId, n)

       if item then
           if lootBlock.subType ~= -1 then
               item:transform(lootBlock.itemId, lootBlock.subType)
           end

           if lootBlock.actionId ~= -1 then
               item:setActionId(lootBlock.actionId)
           end

           if lootBlock.text and lootBlock.text ~= "" then
               item:setAttribute(ITEM_ATTRIBUTE_TEXT, lootBlock.text)
           end

           table.insert(lootTable, item
       end
end
   

   return #lootTable == 0 and nil or lootTable
function MonsterType.createLootContainer(self, parent, lootBlock, modifier)
   if #lootBlock.childLoot == 0 then
       return true
   

   for _, v in pairs(lootBlock.childLoot) do
       if parent:getSize() < parent:getCapacity() then
           local itemList = self:createLootItem(v, modifier)
           if itemList then
               for _, item in ipairs(itemList) do
                   if item:isContainer() then
                       local lootContainer = self:createLootContainer(item, v, modifier)
                       if lootContainer then
                           parent:addItemEx(item)
                       end
                   else
                       parent:addItem(item, 1)
                   end
               end
           end
       end
   
   return #parent > 0
end
	return true
	end
	end
	end
	end
	end
	end
	end

	return exp

end

 

 

 

Postado
  • Autor

@CowBoysFHell Mano, sinceramente acho que tem muita coisa errada aí. Eu precisei mudar a posição de uns 10 ends pra parar de dar erro na distro, e mesmo assim não acontecia nada.

 

Com o movements a storage é setada, ele manda a msg "TESTE".

 

Mas essa parte do script em player.lua aí, não ta funcionando.

Postado

Resultado sobre o que pesquisei ... 

Em data/events/scripts/monster.lua tem uma função que pelo que me parece gera o loot do monstro: 

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()
		for i = 1, #monsterLoot do
			local item = corpse:createLootItem(monsterLoot[i])
			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

Existe um parte nele que usa a função corpse:createLootItem(monsterLoot), ou seja a função createLootItem que esta em data/lib/core/container.lua

function Container.createLootItem(self, item)
	if self:getEmptySlots() == 0 then
        return true
	end

	local itemCount = 0
	local randvalue = getLootRandom()
	if randvalue < item.chance 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

Você poderia usar esta linha: 

if randvalue < item.chance then

Para aumentar a chance do item se tiver com o uso do amuleto.

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo