Ir para conteúdo

[Duvida] Npc


miikro

Posts Recomendados

Galera, to com um scrip de um npc. Olhando os scripts vocês já irão saber o que eu desejo fazer, que são apenas falas, sem nenhuma ação. Mais esta dando erro, alguém da uma mão?

 

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, 'story') then

 

selfSay('Story? Since this city is here, a dark soul it's attacking and disturbing a lot of cities.', cid)

talkState[talkUser] = 2

 

 

elseif talkState[talkUser] == 2 then

 

if msgcontains(msg, 'city') then

selfSay('I can tell you one name but be careful! You can find a lot of dangerous monsters in your trip. The city name is Icya. Find a

 

citizen named Junaaq, he can help you better than me.', cid)

talkState[talkUser] = 3

 

 

 

 

end

 

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

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

<npc name="Lumri" script="data/npc/scripts/quests.lua" walkinterval="2000" floorchange="0">

 

<health now="100" max="100"/>

<look type="153" head="1" body="117" legs="97" feet="76" addons="2"/>

 

<parameters>

<parameter key="message_greet" value="Greetings |PLAYERNAME|. What i can do for you?"/>

<parameter key="keyword_reply2" value="Story? Since this city is here, a dark soul it's attacking and disturbing a lot of cities." />

<parameter key="keyword_reply3" value="I can tell you one name but be careful you can find a lot of dangerous monsters in your trip. The city name is Icya. Find a citizen named Junaaq, he can help you better than me." />

</parameters>

 

</npc>

 

@Edit: Ok, se é para 5 pessoas entrar e ninguém comentar então pode fechar. Não vale o esforço de checar todo dia o post sendo que ninguém responde.

 

Tópico Fechado

Link para o comentário
Compartilhar em outros sites

Nossa que 'Stress'
:rolleyes:

 

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, 'Story') or msgcontains(msg, 'story')) and getPlayerStorageValue(cid,45600) < 1 then
selfSay('Story? Since this {city} is here, a dark soul its attacking and disturbing a lot of cities', cid)
talkState[talkUser] = 1

   elseif((msgcontains(msg, 'City') or msgcontains(msg, 'city')) and talkState[talkUser] == 1) then
selfSay('I can tell you one name but be careful! You can find a lot of dangerous monsters in your trip. The city name is Icya. Find a citizen named {Junaaq}, he can help you better than me.', cid)
setPlayerStorageValue(cid, 45600, 1)
setPlayerStorageValue(cid, 45601, 1)
talkState[talkUser] = 0

elseif(msgcontains(msg, 'Story') or msgcontains(msg, 'story')) and getPlayerStorageValue(cid,45601) == 1 then
selfSay('What are you waiting for? Go to the city that I informed him.', cid)

	end	  
return TRUE
end

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

 

Abraços !! :smile_positivo:

Editado por Frenesy
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...