JU

[Encerrado] [PDA] Cria NPC

Por JulynaMiiy, 18 de mar. de 2013 em Tópicos Sem Resposta

11
1.1k
JulynaMiiyJ
18 de março de 2013 às 15:18

to fazendo uma Outland Main quest '-', mas..

Eu queria sabe como faz o npc pra da outfit, items e exp?

Tipo ele vai pedi o itens

Por exemplo:

Npc: Você tem 1 artefato?

Player: Yes

Npc: Parabéns toma seu premio.

Pra cada de promotion.

Psycraft, Malefic, Volcanic e não seja muito, só 1 que ganha outfit mesma promotion.

 

Não sou otima português. E_E

StyloMaldosoS
18 de março de 2013 às 15:46

fiz correndo aqui, creio eu que tera erros *-* fiz do psycraft, não deu pra entende muito mais vms la

data/npc/script/xxxx.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
msg = string.lower(msg)
---------

local RewardsOutlandPsy = {
Artefatos_Remove = xxxx,
Sto_Outfit = xxxx,
item_add = xxxx,
Sto_Add = 53512,
}

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then  
SelfSay("intão você você tem os artefatos?", cid)
talkState[talkUser] = 2
return true

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
		  if getPlayerItemCount(cid, RewardsOutlandPsy.Artefatos_Remove) >= 1 then
		  selfSay("Desculpe mais você não tem os artefatos necessarios para me ajuda.", cid)
		  return true
		  end
SelfSay("Muito bom, você me ajudou e muito", cid)
doPlayerRemoveItem(cid, RewardsOutlandPsy.Artefatos_Remove, 1)
doPlayerAddLevel(cid, 15)
setPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Outfit, 1)
SetPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Add, 1)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add, 1)
return true
end
return true
end


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

você sabe cria xml de npc né? só cria um mandando o npc fala outland ou help

 

vo tenta explica oque tu tem q altera ;x

essa é a tabela q tu vai te q modifica completamente adicionado os ids..

local RewardsOutlandPsy = {
Artefatos_Remove = xxxx,
Sto_Outfit = xxxx,
item_add = xxxx,
Sto_Add = 53512,
}

 

 

Artefatos_Remove = xxxx,

em xxxx, tu coloka o id do artefatos,

~~~~~~~~~~~~~~

Sto_Outfit = xxxx,

tu coloka a storage q da a outfit.. la em xml tu pode ve q nas outfit tem quest=xxxx, nas outfit..ai tu coloka isso na outfit da pscraft exemplo..

 

<outfit id="40" quest="xxxxx">

<list gender="0" lookType="1435" name="Psycraft Master"/>

<list gender="1" lookType="1426" name="Psycraft Master"/>

</outfit>

ai tu coloka no script qualquer numeros q tu quizer exemplo se ali na quest tiver esse numero na frente 63252 ai no script tu coloka

Sto_Outfit = 63252,

lembrando q eu nunca fiz npc q da outfit n sei se vai funfa isso ;x

~~~~~~~~

~item_add = xxxx,

em xxx tu coloka o id q vai adiiciona ao player quando ele completa a quest. qualquer item qualquer..

~~~~~~~~

~Sto_Add = 53512,

nem meixa..é storage q vai se adicionada para n completa 2x

 

 

 

ah esqueçi..em baixo disso no script do npc..

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then 

adiciona isso..

 getPlayerStorageValue(cid, Sto_Add) >= 0 then
  selfSay("Desculpe mais você ja fez essa quest", cid)
  talkState[talkUser] = 0
  return true
  end

 

ah sim e pra adiciona + item quando completa a quest na tabela em baixo disso...

 

 

item_add = xxxx,

adiciona isso

item_add2 = xxxx,
item_add3 = xxxx,
item_add4 = xxxx,
item_add5 = xxxx,

ai em baixo disso.. la no fim..

 doPlayerAddItem(cid, RewardsOutlandPsy.item_add, 1)

tu adiciona isso

doPlayerAddItem(cid, RewardsOutlandPsy.item_add2, 1)
  doPlayerAddItem(cid, RewardsOutlandPsy.item_add3, 1)
   doPlayerAddItem(cid, RewardsOutlandPsy.item_add4, 1)
    doPlayerAddItem(cid, RewardsOutlandPsy.item_add5, 1)

 

vo da um exemplo pra sabe edita a quantidade..

doPlayerAddItem(cid, RewardsOutlandPsy.item_add2, 1)

o 1 la no fim é a quantidade..

 

avisa quais bug pode ter no script pq to meio ocupadinho

bjos

Editado Março 18 por StyloMaldoso

JulynaMiiyJ
18 de março de 2013 às 16:21

Error:

[18/03/2013 16:20:22] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Psycraft Outland.lua:42: unexpected symbol near '>='

[18/03/2013 16:20:22] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Psycraft Outland.lua

[18/03/2013 16:20:22] data/npc/scripts/Psycraft Outland.lua:42: unexpected symbol near '>='

Data/npc/scripts

 

 

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

msg = string.lower(msg)

---------

 

local RewardsOutlandPsy = {

Artefatos_Remove = 12331,

Sto_Outfit = 85428,

item_add = 2160,

item_add2 = 11452,

item_add3 = 11444,

item_add4 = 11451,

item_add5 = 11445,

item_add6 = 11443,

item_add7 = 11454,

item_add8 = 11449,

item_add9 = 11448,

item_add10 = 11450,

item_add11 = 11447,

item_add12 = 11442,

item_add13 = 11441,

item_add14 = 11446,

item_add15 = 11453,

Sto_Add = 53512,

}

 

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then

SelfSay("intão você você tem os artefatos?", cid)

talkState[talkUser] = 2

getPlayerStorageValue(cid, Sto_Add) >= 0 then

selfSay("Desculpe mais você ja fez essa quest", cid)

talkState[talkUser] = 0

return true

end

 

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then

if getPlayerItemCount(cid, RewardsOutlandPsy.Artefatos_Remove) >= 1 then

selfSay("Desculpe mais você não tem os artefatos necessarios para me ajuda.", cid)

return true

end

SelfSay("Muito bom, você me ajudou e muito", cid)

doPlayerRemoveItem(cid, RewardsOutlandPsy.Artefatos_Remove, 1)

doPlayerAddLevel(cid, 15)

setPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Outfit, 1)

SetPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Add, 1)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add, 200)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add2, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add3, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add4, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add5, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add6, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add7, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add8, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add9, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add10, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add11, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add12, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add13, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add14, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add15, 50)

return true

end

return true

end

 

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

StyloMaldosoS
18 de março de 2013 às 16:24

tenta troca essa linha

getPlayerStorageValue(cid, Sto_Add) >= 0 then

por essa ;x

if getPlayerStorageValue(cid, Sto_Add) <= 0 then

Editado Março 18 por StyloMaldoso

JulynaMiiyJ
18 de março de 2013 às 16:30

Veja isso:

[18/03/2013 16:29:23] [Error - Npc interface]

[18/03/2013 16:29:23] data/npc/scripts/Psycraft Outland.lua:onCreatureSay

[18/03/2013 16:29:23] Description:

[18/03/2013 16:29:23] data/npc/scripts/Psycraft Outland.lua:40: attempt to call global 'SelfSay' (a nil value)

[18/03/2013 16:29:23] stack traceback:

[18/03/2013 16:29:23] data/npc/scripts/Psycraft Outland.lua:40: in function 'callback'

[18/03/2013 16:29:23] data/npc/lib/npcsystem/npchandler.lua:391: in function 'onCreatureSay'

[18/03/2013 16:29:23] data/npc/scripts/Psycraft Outland.lua:7: in function <data/npc/scripts/Psycraft Outland.lua:7>

Npc/Scripts:

 

 

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

msg = string.lower(msg)

---------

 

local RewardsOutlandPsy = {

Artefatos_Remove = 12331,

Sto_Outfit = 85428,

item_add = 2160,

item_add2 = 11452,

item_add3 = 11444,

item_add4 = 11451,

item_add5 = 11445,

item_add6 = 11443,

item_add7 = 11454,

item_add8 = 11449,

item_add9 = 11448,

item_add10 = 11450,

item_add11 = 11447,

item_add12 = 11442,

item_add13 = 11441,

item_add14 = 11446,

item_add15 = 11453,

Sto_Add = 53512,

}

 

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then

SelfSay("intão você você tem os artefatos?", cid)

talkState[talkUser] = 2

if getPlayerStorageValue(cid, Sto_Add) <= 0 then

selfSay("Desculpe mais você ja fez essa quest", cid)

talkState[talkUser] = 0

return true

end

 

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then

if getPlayerItemCount(cid, RewardsOutlandPsy.Artefatos_Remove) >= 1 then

selfSay("Desculpe mais você não tem os artefatos necessarios para me ajuda.", cid)

return true

end

SelfSay("Muito bom, você me ajudou e muito", cid)

doPlayerRemoveItem(cid, RewardsOutlandPsy.Artefatos_Remove, 1)

doPlayerAddLevel(cid, 15)

setPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Outfit, 1)

SetPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Add, 1)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add, 200)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add2, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add3, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add4, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add5, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add6, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add7, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add8, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add9, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add10, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add11, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add12, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add13, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add14, 50)

doPlayerAddItem(cid, RewardsOutlandPsy.item_add15, 50)

return true

end

return true

end

 

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

StyloMaldosoS
18 de março de 2013 às 16:34

fiz correndo..hahua troca ai essa linha

SelfSay("intão você você tem os artefatos?", cid)

e troque por essa..

selfSay("intão você você tem os artefatos?", cid)

alias no começo do teu script ta assim..

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then
selfSay("intão você você tem os artefatos?", cid)
talkState[talkUser] = 2
if getPlayerStorageValue(cid, Sto_Add) >= 0 then
selfSay("Desculpe mais você ja fez essa quest", cid)
talkState[talkUser] = 0
return true
end

 

decha assim.. ;x

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then
	 if getPlayerStorageValue(cid, Sto_Add) >= 0 then
	 selfSay("Desculpe mais você ja fez essa quest", cid)
	 talkState[talkUser] = 0
	 return true
	 end
selfSay("intão você você tem os artefatos?", cid)
talkState[talkUser] = 2
return true

 

alias usa esse script q arrumei os erro do selfSay..e dps q eu volta vo assiti malhação vo da uma ajeitada no script u-u

 

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
msg = string.lower(msg)
---------

local RewardsOutlandPsy = {
Artefatos_Remove = 12331,
Sto_Outfit = 85428,
item_add = 2160,
item_add2 = 11452,
item_add3 = 11444,
item_add4 = 11451,
item_add5 = 11445,
item_add6 = 11443,
item_add7 = 11454,
item_add8 = 11449,
item_add9 = 11448,
item_add10 = 11450,
item_add11 = 11447,
item_add12 = 11442,
item_add13 = 11441,
item_add14 = 11446,
item_add15 = 11453,
Sto_Add = 53512,
}

if (msgcontains(msg, 'outland') or msgcontains(msg, 'help')) then
			 if getPlayerStorageValue(cid, Sto_Add) >= 0 then
			 selfSay("Desculpe mais você ja fez essa quest", cid)
			 talkState[talkUser] = 0
			 return true
			 end
selfSay("intão você você tem os artefatos?", cid)
talkState[talkUser] = 2
return true

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
if getPlayerItemCount(cid, RewardsOutlandPsy.Artefatos_Remove) >= 1 then
selfSay("Desculpe mais você não tem os artefatos necessarios para me ajuda.", cid)
return true
end
selfSay("Muito bom, você me ajudou e muito", cid)
doPlayerRemoveItem(cid, RewardsOutlandPsy.Artefatos_Remove, 1)
doPlayerAddLevel(cid, 15)
setPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Outfit, 1)
SetPlayerStorageValue(cid, RewardsOutlandPsy.Sto_Add, 1)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add, 200)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add2, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add3, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add4, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add5, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add6, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add7, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add8, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add9, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add10, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add11, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add12, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add13, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add14, 50)
doPlayerAddItem(cid, RewardsOutlandPsy.item_add15, 50)
return true
end
return true
end


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

 

Editado Março 18 por StyloMaldoso

JulynaMiiyJ
18 de março de 2013 às 16:59

Veja só:

[18/03/2013 16:59:22] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Psycraft Outland.lua:50: unexpected symbol near 'then'

[18/03/2013 16:59:22] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Psycraft Outland.lua

[18/03/2013 16:59:22] data/npc/scripts/Psycraft Outland.lua:50: unexpected symbol near 'then

StyloMaldosoS
18 de março de 2013 às 17:02

burrise ou n ? hauuha troca essa linha

if getPlayerItemCount(cid, RewardsOutlandPsy.Artefatos_Remove) <= 1 then

por..

if getPlayerItemCount(cid, RewardsOutlandPsy.Artefatos_Remove) < 1 then

JulynaMiiyJ
18 de março de 2013 às 18:25

Obrigada Slicer. '-'

Dúvida Sanada. e.e

RoksasR
18 de março de 2013 às 18:31

Tópico movido para pedidos e dúvidas resolvidos.

5 anos depois...
StigalS
21 de abril de 2018 às 02:43
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.