Ir para conteúdo

Featured Replies

Postado

Fala Pessoal do TK.

 

Então estou criando meu OTserv, Mapa barão... ele vem com NPC " Colecionador De Ossos " Até ai tudo bem.

 

Testei ele está funcionando certinho, os bones os itens, so que quando mata player ele nao da bones :/

 

como coloca pra ganhar bones á cada player morto.

 

 

Olha seguites arquivos -->

 

Raiz : C:\Users\Vitor Lucas\Desktop\Baiak Barao OT\data\npc

Arquivo: Colecionador De Ossos.xlm

 

-----------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Colecionador De Ossos" script="data/npc/scripts/colecionador de ossos.lua" access="3" lookdir="3"  walkinterval="2000" floorchange="0">
    <health now="4" max="100"/>
    <look type="145" head="40" body="37" legs="116" feet="95" addons="3"/>
    <parameters>
        <parameter key="message_greet" value="E ae matador! Você trouxe mais {bones} para mim? Preciso de 30 bones, se você trouxe diga {bones}."/>
        <parameter key="message_farewell" value="Mas que beleza... Quantos ossos!" />
        <parameter key="message_walkaway" value="Yeah, mate mais! ò.ó" />
        <parameter key="message_onsendtrade" value="Yeah, mate mais! ò.ó" />
        <parameter key="module_shop" value="1" />
    </parameters>
</npc>

 

 

-----------------------------------------------------------------------------

 

Raiz: C:\Users\Vitor Lucas\Desktop\Baiak Barao OT\data\npc\scripts

Arquivo: colecionador de ossos.lua

 

-----------------------------------------------------------------------------

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid    

    if(msgcontains(msg, 'ossos') or msgcontains(msg, 'bones') or msgcontains(msg, 'bone')) then
        selfSay('Você realmente deseja trocar seus preciosos bones por um item aleatório? Diga {yes}.', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if(getPlayerItemCount(cid, 5925) >= 30) then
            if(doPlayerRemoveItem(cid, 5925, 30) == TRUE) then                
                doPlayerAddItem(cid, 6571)
                selfSay('Here you are.', cid)
            else
                selfSay('Desculpe, mas você não tem 30 bones.', cid)
            end
        else
            selfSay('Desculpe, mas você não tem 30 bones.', cid)
        end
        talkState[talkUser] = 0
    elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
        talkState[talkUser] = 0
        selfSay('Ok then.', cid)
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 

-----------------------------------------------------------------------------

 

Me Ajudem... OBG agradeço muito.

 

 

 

 

  • Respostas 6
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Aqui... Vaá em creaturescript/script e crie um arquivo chamado reward e coloque isso dentro function onDeath(cid, corpse, deathList) if isPlayer(cid) and isPlayer(deathList[1]) then local v = { re

  • Vá em creaturescripts.xml e adicione isso :   <event type="kill" name="killitem" event="script" value="lootkill.lua"/>   Depois crie um arquivo em com nome lootkill.lua em creaturescripts/sc

Postado
  • Autor

Amigo, isso não é no NPC, é um creaturescript que o player ganha o item ao matar o outro.

Precisa verificar quais as condições para que ganhe o item...

 

Sim, foi como falei NPC esta funcionando corretamente, mais como faço pra quando matar um player ele ganha o item " Bones " Att; Vitor Lucas ! Obg

Postado

Vá em creaturescripts.xml e adicione isso :

 

<event type="kill" name="killitem" event="script" value="lootkill.lua"/>

 

Depois crie um arquivo em com nome lootkill.lua em creaturescripts/scripts

 

e adicione isso :

 

function onKill(cid, target, lastHit)

local item,count = 5925,1
if isPlayer(cid) and isPlayer(target) and getPlayerIp(target) ~= getPlayerIp(cid) then
doPlayerAddItem(cid, item, count)
end
return TRUE
end
 
Pronto...
 
 
Ah e adicione esse tag, em login.lua :
 
registerCreatureEvent(cid, "killitem")

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

Postado
  • Autor

 

Vá em creaturescripts.xml e adicione isso :

 

<event type="kill" name="killitem" event="script" value="lootkill.lua"/>

 

Depois crie um arquivo em com nome lootkill.lua em creaturescripts/scripts

 

e adicione isso :

 

function onKill(cid, target, lastHit)

local item,count = 5925,1
if isPlayer(cid) and isPlayer(target) and getPlayerIp(target) ~= getPlayerIp(cid) then
doPlayerAddItem(cid, item, count)
end
return TRUE
end
 
Pronto...
 
 
Ah e adicione esse tag, em login.lua :
 
registerCreatureEvent(cid, "killitem")

 

 

Então cara fiz tudo isso e nada que vem o bone

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

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