Ir para conteúdo

Featured Replies

Postado

Procuro duas script's:

 

Uma para quando matar x boss, quem deu o last hit receber um item em sua bp e outra script para quem deu mais dano ao total

 

Duvidas:

- Se não tem cap ou espaço para receber o item?

R: Poderia ser mandado para o dp ou "coloca-lo a força" ficando com sobrecarga

 

Quem puder ajudar ou dar uma ideia como fazer agradeço :D 

 

Postado

Estou pelo cell então n tenho como te passar o script agora. A idéia: bom, não estou mt certo da função last hit então n posso dizer agr qual seria usada. Sobre o item ir pro player, não dá pra "sobrecarregar" então a solução eh mandar pro dp, pra fazer isso basta fazer uma checagem na cap atual do player e se a mesma for menor que o peso do item, ai manda pro dp através de uma "query' pra data base.

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado
Uma para quando matar x boss, quem deu o last hit receber um item em sua bp e outra script para quem deu mais dano ao total

 

Ambos (lasthitkiller / mostdamagekiller) recebem um item?

Se for:

bossreward.lua (data\creaturescripts\scripts):

local lasthit = {5432, 1} -- lasthitkiller = {itemid, amount}
local mostdmg = {5432, 1} -- mostdamagekiller = {itemid, amount}

function doPlayerAddDepotItems(pid, item, count) -- function by magus - modified by vodkart
    local item, count = {item}, {(count or 1)}
    
    for k, v in ipairs(item) do
        local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = "..pid.." ORDER BY `sid` DESC LIMIT 1")
        return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES ("..pid..", "..(ls:getDataInt("sid")+1)..", 101, "..v..", "..count[k]..", '')") or false
    end
    
end

function onDeath(cid, corpse, deathList)
    local last, most = deathList[1], deathList[2]
    
    if isPlayer(last) then
        if getPlayerFreeCap(last) > getItemWeightById(lasthit[1], lasthit[2]) then
            doPlayerAddItem(last, lasthit[1], lasthit[2])
            doPlayerSendTextMessage(last, MESSAGE_INFO_DESCR, 'You have received a reward for being the player that gave the last hit on the BOSS.')
        else
            doPlayerAddDepotItems(last, lasthit[1], lasthit[2])
            doPlayerSendTextMessage(last, MESSAGE_STATUS_CONSOLE_BLUE, 'You have received a reward for being the player that gave the last hit on the BOSS. But you don\'t have enought cap, so it was sent to your depot.')
        end
    end
    
    if isPlayer(most) then
        if getPlayerFreeCap(most) > getItemWeightById(mostdmg[1], mostdmg[2]) then
            doPlayerAddItem(most, mostdmg[1], mostdmg[2])
            doPlayerSendTextMessage(most, MESSAGE_INFO_DESCR, 'You have received a reward for being the player that gave the most damage on the BOSS.')
        else
            doPlayerAddDepotItems(most, mostdmg[1], mostdmg[2])
            doPlayerSendTextMessage(most, MESSAGE_STATUS_CONSOLE_BLUE, 'You have received a reward for being the player that gave the most damage on the BOSS. But you don\'t have enought cap, so it was sent to your depot.')
        end
    end
    
    return true
end

 

Tag - creaturescripts.xml (data\creaturescripts):

<event type="death" name="BOSSReward" event="script" value="bossreward.lua"/>

 

Registre o creature event no XML do monster:

<script>
	<event name="BOSSReward"/>
</script>

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

The corrupt fear us.

The honest support us.

The heroic join us.

Postado

 

Ambos (lasthitkiller / mostdamagekiller) recebem um item?

Se for:

bossreward.lua (data\creaturescripts\scripts):

local lasthit = {5432, 1} -- lasthitkiller = {itemid, amount}
local mostdmg = {5432, 1} -- mostdamagekiller = {itemid, amount}

function doPlayerAddDepotItems(pid, item, count) -- function by magus - modified by vodkart
    local item, count = {item}, {(count or 1)}
    
    for k, v in ipairs(item) do
        local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = "..pid.." ORDER BY `sid` DESC LIMIT 1")
        return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES ("..pid..", "..(ls:getDataInt("sid")+1)..", 101, "..v..", "..count[k]..", '')") or false
    end
    
end

function onDeath(cid, corpse, deathList)
    local last, most = deathList[1], deathList[2]
    
    if isPlayer(last) then
        if getPlayerFreeCap(last) > getItemWeightById(lasthit[1], lasthit[2]) then
            doPlayerAddItem(last, lasthit[1], lashit[2])
        else
            doPlayerAddDepotItems(last, lasthit[1], lashit[2])
            doPlayerSendTextMessage(last, MESSAGE_INFO_DESCR, 'You have received a reward for being the player that gave the last hit on the BOSS. But you don\'t have enought cap, so it was sent to your depot.')
        end
    end
    
    if isPlayer(most) then
        if getPlayerFreeCap(most) > getItemWeightById(mostdmg[1], mostdmg[2]) then
            doPlayerAddItem(most, mostdmg[1], mostdmg[2])
        else
            doPlayerAddDepotItems(most, mostdmg[1], mostdmg[2])
            doPlayerSendTextMessage(most, MESSAGE_INFO_DESCR, 'You have received a reward for being the player that gave the most damage on the BOSS. But you don\'t have enought cap, so it was sent to your depot.')
        end
    end
    
    return true
end

 

Tag - creaturescripts.xml (data\creaturescripts):

<event type="death" name="BOSSReward" event="script" value="bossreward.lua"/>

 

Registre o creature event no XML do monster:

<script>
	<event name="BOSSReward"/>
</script>

No caso:

 

doPlayerAddDepotItems(last, lasthit[1], lashit[2])

Era pra ser ?

 

doPlayerAddDepotItems(last, lasthit[1], lasthit[2])

O lasthit[2] está como lashit, corrige por favor :P

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Postado

O lasthit[2] está como lashit, corrige por favor :P

Acabei digitando o nome incorreto da tabela, apenas isso.

De qualquer forma, foi um erro de atenção. Obrigado por avisar.

The corrupt fear us.

The honest support us.

The heroic join us.

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.6k

Informação Importante

Confirmação de Termo