Ir para conteúdo
  • 0

[Npc] Npc Que Da Experiencia Ao Player Se Tiver X Storage.


Janmix

Pergunta

Queria um npc que desse vamos supor 100000 de exp ao player que tive-se a storage 4124, 2

e desse ao player storage 4124, 3

o player nao iria precisar entregar nada só ter a storage 4124, 2 para ganhar a experiencia.

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

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
-- Conversa Jogador/NPC

local storage = 506 -- Aqui bote a storage q vai usar
local exp = 10000 -- Aqui bote a exp

if(msgcontains(msg, 'help') and getStor(cid, storage) >= 1) then
if getStor(cid, 305) >= 1 then selfSay('You a realyd my missiom.') return true end
doSendAnimatedText(getThingPos(cid), ""..exp.."")
doPlayerAddExp(cid, exp)
setStor(cid, 305, 1)
else
selfSay('Sorry you need a quest for reward.')
return true
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
function setStor(cid, sto, value)
return setPlayerStorageValue(cid, sto, value)
end
function getStor(cid, value)
return getPlayerStorageValue(cid, value)
end

 

Fale "help" e ganhe a exp, se tiver a storage..

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

  • 0

ta dando esse erro

[26/09/2012 21:33:08] [Error - Npc interface]

[26/09/2012 21:33:08] (Unknown script file)

[26/09/2012 21:33:08] Description:

[26/09/2012 21:33:08] attempt to call a nil value

[26/09/2012 21:33:08] stack traceback:

Link para o comentário
Compartilhar em outros sites

  • 0

[26/09/2012 21:42:47] [Error - LuaScriptInterface::loadFile] data/npc/scripts/mission.lua:38: 'end' expected (to close 'function' at line 11) near '<eof>'

[26/09/2012 21:42:47] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/mission.lua

[26/09/2012 21:42:47] data/npc/scripts/mission.lua:38: 'end' expected (to close 'function' at line 11) near '<eof>'

Link para o comentário
Compartilhar em outros sites

  • 0

[26/09/2012 21:52:54] [Error - LuaScriptInterface::loadFile] data/npc/scripts/mission.lua:21: ')' expected near '&'

[26/09/2012 21:52:54] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/mission.lua

[26/09/2012 21:52:54] data/npc/scripts/mission.lua:21: ')' expected near '&'

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...