Ir para conteúdo

Featured Replies

Postado

Deve ser simples pra quem sabe

 

Queria editar esse auto loot pra em vez de ser ativado com /aloot add:2170

 

fosse ativado auatomaticamente qnd logava, já vinha adicionado o item gold coin, pq só queria esse autoloot pra catar gold coins não catar mais nada

 

http://www.tibiaking.com/forum/topic/8172-sistema-auto-loot/

  • Respostas 11
  • Visualizações 633
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Tente assim... vá em lib/050-funcions.lua e coloque isso no final function autoGP(cid, target, pos) local itemid = 2148 -- id do gold coin local function doStack(cid, itemid, new) local coun

  • Tags:    <event type="kill" name="alootGold" script="getgold.lua"/>     <event type="login" name="alootLogin" event="script" value="getgold.lua"/> Código: local gold = 2170         -

  • Estranho, eu havia testado meu codigo e ele funcionou perfeitamente. Voce o instalou corretamente? Se sim, remova a seguinte parte do script e relate se ele continua nao funcional: and isMonster(ta

Postado

Tente assim...
vá em lib/050-funcions.lua e coloque isso no final

function autoGP(cid, target, pos)
    local itemid = 2148 -- id do gold coin
	local function doStack(cid, itemid, new)
		local count = getPlayerItemCount(cid, itemid)
		if (count > 100) then
			count = count - math.floor(count / 100) * 100
		end
		local newCount = count + new
		if (count ~= 0) then
			local find = getPlayerItemById(cid, true, itemid, count).uid
			if (find > 0) then
				doRemoveItem(find)
			else
				newCount = new
			end
		end
		local item = doCreateItemEx(itemid, newCount)
		doPlayerAddItemEx(cid, item, true)
	end
	end

Depos vá em creatureevents/scripts e abra o login.lua e adicione isso

registerCreatureEvent(cid, "GP")

depois crie um arquivo chamado gp.lua e coloque isso dentro

 function onKill(cid, target, lastHit)
    if not isPlayer(target) then
    autoGP(cid, getCreatureName(target), getCreaturePosition(target))
    end
 return true
 end

e adicione isso em creatures,xml

<event type="kill" name="GP" event="script" value="gp.lua"/> 

PS: não testei, apenas segui uma certa logica.

Te ajudei?
Se você achar que eu mereço, me dê uma "rep+" e selecione meu post como "melhor resposta"

 

Skype: JoadsonAion

Postado

Tags:

    <event type="kill" name="alootGold" script="getgold.lua"/>
    <event type="login" name="alootLogin" event="script" value="getgold.lua"/>

Código:

local gold = 2170         --ID do gold coin.
function getGold(cid, target, pos)
    local count = 0
    local items = {}
    if not isPlayer(cid) then
        return true
    end
    for i = getTileInfo(pos).items, 1, -1 do
        pos.stackpos = i
        table.insert(items, getThingFromPos(pos))
    end
    if #items == 0 then
        return true
    end
    local corpse = -1
    for _, item in ipairs(items) do
        local name = getItemName(item.uid):lower()
        if name:find(target:lower()) then
            corpse = item.uid
            break
        end
    end
    if not isContainer(corpse) then
        return true
    end
    for i = 0, getContainerSize(corpse) - 1 do
        local item = getContainerItem(corpse, i)
        if item.itemid == gold then
            count = item.type
            doRemoveItem(item.uid)
            break
        end
    end
    if count ~= 0 then
        local player_gold = getPlayerItemCount(cid, gold)
        local soma = count + player_gold
        if soma <= 100 then
            doPlayerRemoveItem(cid, gold, player_gold)
            doPlayerAddItem(cid, gold, soma)
        else
            local s = soma - 100
            doPlayerRemoveItem(cid, gold, player_gold)
            doPlayerAddItem(cid, gold, s)
            doPlayerAddItem(cid, gold, 100)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Looted "..count.." "..getItemNameById(gold)..(count > 1 and "s" or "")..".")
    end
end
function onKill(cid, target)
    if isPlayer(cid) and isMonster(target) then
        addEvent(getGold, 5, cid, getCreatureName(target), getThingPos(target))
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "alootGold")
    return true
end

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

Postado
  • Autor

 

Tags:

    <event type="kill" name="alootGold" script="getgold.lua"/>
    <event type="login" name="alootLogin" event="script" value="getgold.lua"/>

Código:

local gold = 2170         --ID do gold coin.
function getGold(cid, target, pos)
    local count = 0
    local items = {}
    if not isPlayer(cid) then
        return true
    end
    for i = getTileInfo(pos).items, 1, -1 do
        pos.stackpos = i
        table.insert(items, getThingFromPos(pos))
    end
    if #items == 0 then
        return true
    end
    local corpse = -1
    for _, item in ipairs(items) do
        local name = getItemName(item.uid):lower()
        if name:find(target:lower()) then
            corpse = item.uid
            break
        end
    end
    if not isContainer(corpse) then
        return true
    end
    for i = 0, getContainerSize(corpse) - 1 do
        local item = getContainerItem(corpse, i)
        if item.itemid == gold then
            count = item.type
            doRemoveItem(item.uid)
            break
        end
    end
    if count ~= 0 then
        local player_gold = getPlayerItemCount(cid, gold)
        local soma = count + player_gold
        if soma <= 100 then
            doPlayerRemoveItem(cid, gold, player_gold)
            doPlayerAddItem(cid, gold, soma)
        else
            local s = soma - 100
            doPlayerRemoveItem(cid, gold, player_gold)
            doPlayerAddItem(cid, gold, s)
            doPlayerAddItem(cid, gold, 100)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Looted "..count.." "..getItemNameById(gold)..(count > 1 and "s" or "")..".")
    end
end
function onKill(cid, target)
    if isPlayer(cid) and isMonster(target) then
        addEvent(getGold, 5, cid, getCreatureName(target), getThingPos(target))
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "alootGold")
    return true
end

 

 

Tente assim...

vá em lib/050-funcions.lua e coloque isso no final

function autoGP(cid, target, pos)
    local itemid = 2148 -- id do gold coin
	local function doStack(cid, itemid, new)
		local count = getPlayerItemCount(cid, itemid)
		if (count > 100) then
			count = count - math.floor(count / 100) * 100
		end
		local newCount = count + new
		if (count ~= 0) then
			local find = getPlayerItemById(cid, true, itemid, count).uid
			if (find > 0) then
				doRemoveItem(find)
			else
				newCount = new
			end
		end
		local item = doCreateItemEx(itemid, newCount)
		doPlayerAddItemEx(cid, item, true)
	end
	end

Depos vá em creatureevents/scripts e abra o login.lua e adicione isso

registerCreatureEvent(cid, "GP")

depois crie um arquivo chamado gp.lua e coloque isso dentro

 function onKill(cid, target, lastHit)
    if not isPlayer(target) then
    autoGP(cid, getCreatureName(target), getCreaturePosition(target))
    end
 return true
 end

e adicione isso em creatures,xml

<event type="kill" name="GP" event="script" value="gp.lua"/> 

PS: não testei, apenas segui uma certa logica.

 

Desculpe fiquei sem internet, dei rep nos dois, mas testei os dois e não funcionaram, não deram erros na distro, nem nada, só matei o monstro e não veio nenhum loot

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo