Ir para conteúdo

Featured Replies

Postado

eae galera blz ? eu estava estudando um pouco de script então tentei criar um npc que vc conversa com ele e ele te da um item ai eu fiz tudo certinho, quando fui colocar o npc no meu OT deu alguns erros na distro mas já consertei ai quando terminei tudo, sem erro coloquei o script, sumonei o npc tudo certo até ai, ai quando vou falar com ele não da erro na distro não acontece nada!!! Exclusivamente nada!! quem puder me ajudar, estarei agradecido 

 

NPC.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Kelvin" script="item.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="78" body="92" legs="76" feet="0" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Ola |PLAYERNAME|, Eu sou o Kelvin quer algums {items} ?."/>
	</parameters>
</npc>

NPC.lua

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

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 

	if not npcHandler:isFocused(cid) then
		return false
	end

	if getPlayerStorageValue(cid, 99746) == false then
		if msgcontains(msg, 'item') then
			npcHandler:say('Opa, então voce ainda não tem items e precisa de ajuda ? tome isto vai lhe ajudar em sua jornada', cid)
			doPlayerAddItem(cid, 2160, 100)
			setPlayerStorageValue(cid, 99746)
			
	return true
end
else 
npcHandler:say('Saia daqui já lhe ajudei', cid)
end


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

Pronto postei o script, quem puder consertar e me reportar o que eu errei agradecerei e ganhara Rep+

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

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Resolvido por joadson

Ir para solução
  • Respostas 9
  • Visualizações 472
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCre

Postado
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 onCreatureSayCallBack(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    if getPlayerStorageValue(cid, 99746) == false then
        if msgcontains(msg, 'item') then
            npcHandler:say('Opa, então voce ainda não tem items e precisa de ajuda ? tome isto vai lhe ajudar em sua jornada', cid)
            doPlayerAddItem(cid, 2160, 100)
            setPlayerStorageValue(cid, 99746)
            return true
        end
    else
        npcHandler:say('Saia daqui já lhe ajudei', cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "onCreatureSayCallback")
npcHandler:addModule(FocusModule:new())
Postado

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, 'item') then
		if getPlayerStorageValue(cid, 99746)  < 1 then
			npcHandler:say('Opa, então voce ainda não tem items e precisa de ajuda ? tome isto vai lhe ajudar em sua jornada', cid)
			doPlayerAddItem(cid, 2160, 100)
			setPlayerStorageValue(cid, 99746)
			talkState[talkUser] = 0
		else
			npcHandler:say('Saia daqui já lhe ajudei', cid)
			talkState[talkUser] = 0
		end		
	end
return true	
end

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

Recomendo ler uns tutoriais do fórum ;D

#editado tinha esquecido a callback

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

Postado
  • Autor
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 onCreatureSayCallBack(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    if getPlayerStorageValue(cid, 99746) == false then
        if msgcontains(msg, 'item') then
            npcHandler:say('Opa, então voce ainda não tem items e precisa de ajuda ? tome isto vai lhe ajudar em sua jornada', cid)
            doPlayerAddItem(cid, 2160, 100)
            setPlayerStorageValue(cid, 99746)
            return true
        end
    else
        npcHandler:say('Saia daqui já lhe ajudei', cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "onCreatureSayCallback")
npcHandler:addModule(FocusModule:new())

O seu o npc esta falando e tudo e tals mais não esta dando o item. afs

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Postado
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 onCreatureSayCallBack(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    if(msgcontains(msg, 'item')) then
         if(getPlayerStorageValue(cid, 99746) == -1) then
            npcHandler:say('Opa, então voce ainda não tem items e precisa de ajuda ? tome isto vai lhe ajudar em sua jornada', cid)
            doPlayerAddItem(cid, 2160, 100)
            setPlayerStorageValue(cid, 99746, 1)
            return true
        end
    else
        npcHandler:say('Saia daqui já lhe ajudei', cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "onCreatureSayCallback")
npcHandler:addModule(FocusModule:new())

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