Ir para conteúdo

Missão Por Experiencia


Dado157

Posts Recomendados

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

 

NPC Mission

Servidor testado: TFS

Autor: kawon

Retirado: Otland

 

 

Primeiro crie um arquivo npc_mission.xml dentro da pasta data/npc/.

E coloque isso:

 

Código:

<npc name="Npc Mission" script="data/npc/scripts/mission.lua" walkinterval="1" floorchange="0" access="5" level="1" maglevel="1">

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

<look type="132" head="57" body="59" legs="40" feet="76" addons="3"/>

<parameters>

<parameter key="message_greet" value="Hello |PLAYERNAME|. You can started 'quest'?" />

</parameters>

</npc>

 

 

Em seguida crie um arquivo mission.lua na pasta /data/npc/scripts/

E adicione isso:

 

Código:

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

selfSay('Ok, you can started "first mission"?', cid)

end

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

if(msgcontains(msg, 'first mission')) then

selfSay('Please bring me 10 "meat"', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'meat') and talkState[talkUser] == 1) then

if (getPlayerStorageValue(cid,100) > 0) then

selfSay('You finished this mission.', cid)

else

if(doPlayerRemoveItem(cid, 2666, 10) == TRUE) then

setPlayerStorageValue(cid,100,1)

doPlayerAddExperience(cid,1000)

selfSay('Thank you! You can started "second mission".. (you received 1000 points of experience)', cid)

else

selfSay('You must have more items', cid)

end

end

return true

end

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

if(msgcontains(msg, 'second mission')) then

selfSay('Please bring me 10 "ham"', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then

if (getPlayerStorageValue(cid,101) > 0) then

selfSay('You finished this mission.', cid)

else

if(doPlayerRemoveItem(cid, 2671, 10) == TRUE) then

setPlayerStorageValue(cid,101,1)

doPlayerAddExperience(cid,1000)

selfSay('Thank you! You can started "third mission".. (you received 1000 points of experience)', cid)

else

selfSay('You must have more items', cid)

end

end

return true

end

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

if(msgcontains(msg, 'third mission')) then

selfSay('Please bring me 20 "ham"', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then

if (getPlayerStorageValue(cid,102) > 0) then

selfSay('You finished this mission.', cid)

else

if(doPlayerRemoveItem(cid, 2671, 20) == TRUE) then

setPlayerStorageValue(cid,102,1)

doPlayerAddExperience(cid,1000)

selfSay('Thank you! You finished all missions. (you received 1000 points of experience)', cid)

else

selfSay('You must have more items', cid)

end

end

return true

end

 

 

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Transcrições:

 

PLAYER: hi

NPC: Hello |PLAYERNAME|. You can started 'quest'?

PLAYER: quest

NPC: Ok, you can started "first mission"?

PLAYER: first mission

NPC: Please bring me 10 "meat"

PLAYER: meat

When player finish this mission

NPC: You finished this mission.

When player do first once

NPC: Thank you! You can started "second mission".. (you received 1000 points of experience)

When player don't have 10 meat

NPC: You must have more items

 

 

 

 

__________________

 

 

-

 

 

Comming soon... Quer entrar na equipe? mande PM.

-

 

 

 

 

--

 

 

COMPRO CHAR NO P.O (SILVER)

Link para o comentário
Compartilhar em outros sites

Cara, alguem sabe pelo amor de Deus como faço pra colocar o seguinte:

O player pra fazer a second e third mission, antes tem que ter completado a FIRST mission, pra fazer third, tem que ter completado a first e second missions. Tipo aquelas tasks, tem que completar umas pra liberar as outras.

Sei que é adicionando storage values, mas nao sei como e em qual linha. Alguem por favor poderia me ajudar?

.

.

Dou rep+

VLW!

Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...
×
×
  • Criar Novo...