Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

tente esse:

 

 

<npc name="Promote Lutador" script="data/npc/scripts/promote.lua" access="5" lookdir="1">
<health now="100" max="100"/>
<look type="300" head="0" body="0" legs="0" feet="0" addons="0"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. Hello I can change your vocation, are you sure ?" />
    </parameters>
</npc>

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

  • Respostas 11
  • Visualizações 959
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • editar: getPlayerVocationId(cid, 12) (vocação que ele precisa ser para virar lutador ou defensor) {name = "Lutador", id = 4}, -- nome da vocação, id {name = "Defensor", id = 8}

  • Exatamente no lugar onde esta defensor e guerreiro são as vocs que ele pode escolher e a id delas

  • tente esse:

Postado
  • Autor

Eu coloquei o script no xml do npc e arrumei tudo direitinho. Adicionei o npc ao mapa e se eu chego nele level menor que o requisitado no script ele me responde que eu não tenho level suficiente. Agora após o level necessário ao falar yes ou qualquer outra palavra para o npc ele não responde e aparece isso aqui nos processos do servidor:

 

 

23hok90.jpg

 

 

Aparentemente está dando erro com algumas funções do script e na referência com o npc handler. Como posso resolver isso?

Postado

@paulovbonfim

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
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 greetCallback(cid)
talkState[talkUser] = 0
return true
end
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
if(not npcHandler:isFocused(cid)) then 
return false 
end
local vocationsNameId = {
{name = "Lutador", id = 4}, -- nome da vocação, id
{name = "Defensor", id = 8}
}
local startstorageid = 30031
local msg = string.lower(msg)
if getPlayerLevel(cid) =< 49 then
selfSay("You need level 50 to change vocation.", cid)
npcHandler:onCreatureDisappear(cid)
end
if getPlayerStorageValue(cid, startstorageid) == 1 then
selfSay("You has changed your vocation!", cid)
npcHandler:onCreatureDisappear(cid)
end
if getPlayerVocationId(cid, 12) == false then
selfSay("You dont change your vocation!", cid)
npcHandler:onCreatureDisappear(cid)
end
if msgcontains(msg, 'yes') and talkState[talkUser] == nil or talkState[talkUser] == 0 then
selfSay("You want to change your vocation?", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'no') and talkState[talkUser] == nil or talkState[talkUser] == 0 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
selfSay("Ok, you change to {"..(vocationsNameId[1].name).."} or {"..(vocationsNameId[2].name).."}?", cid)
talkState[talkUser] = 3
elseif msgcontains(msg, 'no') and talkState[talkUser] == 2 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, string.lower(vocationsNameId[1].name)) and talkState[talkUser] == 3 then
selfSay("You want to change your vocation to {"..(vocationsNameId[1].name).."}?", cid)
setPlayerStorageValue(cid, startstorageid, 1)
talkState[talkUser] = 4
elseif msgcontains(msg, string.lower(vocationsNameId[2].name)) and talkState[talkUser] == 3 then
selfSay("You want to change your vocation to {"..(vocationsNameId[2].name).."}?", cid)
setPlayerStorageValue(cid, startstorageid, 1)
talkState[talkUser] = 4
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
doPlayerSetVocation(cid, vocationsNameId[getPlayerStorageValue(cid, startstorageid)].id)
doSendMagicEffect(getCreaturePosition(cid), 29)
setPlayerStorageValue(cid, startstorageid, 1)
selfSay("Ok, you have changed this vocation to vocation {"..(vocationsNameId[getPlayerStorageValue(cid, startstorageid)].name).."}.", cid)
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, 'no') and talkState[talkUser] == 4 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

Postado
  • Autor

@paulovbonfim

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
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 greetCallback(cid)
talkState[talkUser] = 0
return true
end
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
if(not npcHandler:isFocused(cid)) then 
return false 
end
local vocationsNameId = {
{name = "Lutador", id = 4}, -- nome da vocação, id
{name = "Defensor", id = 8}
}
local startstorageid = 30031
local msg = string.lower(msg)
if getPlayerLevel(cid) =< 49 then
selfSay("You need level 50 to change vocation.", cid)
npcHandler:onCreatureDisappear(cid)
end
if getPlayerStorageValue(cid, startstorageid) == 1 then
selfSay("You has changed your vocation!", cid)
npcHandler:onCreatureDisappear(cid)
end
if getPlayerVocationId(cid, 12) == false then
selfSay("You dont change your vocation!", cid)
npcHandler:onCreatureDisappear(cid)
end
if msgcontains(msg, 'yes') and talkState[talkUser] == nil or talkState[talkUser] == 0 then
selfSay("You want to change your vocation?", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'no') and talkState[talkUser] == nil or talkState[talkUser] == 0 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
selfSay("Ok, you change to {"..(vocationsNameId[1].name).."} or {"..(vocationsNameId[2].name).."}?", cid)
talkState[talkUser] = 3
elseif msgcontains(msg, 'no') and talkState[talkUser] == 2 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, string.lower(vocationsNameId[1].name)) and talkState[talkUser] == 3 then
selfSay("You want to change your vocation to {"..(vocationsNameId[1].name).."}?", cid)
setPlayerStorageValue(cid, startstorageid, 1)
talkState[talkUser] = 4
elseif msgcontains(msg, string.lower(vocationsNameId[2].name)) and talkState[talkUser] == 3 then
selfSay("You want to change your vocation to {"..(vocationsNameId[2].name).."}?", cid)
setPlayerStorageValue(cid, startstorageid, 1)
talkState[talkUser] = 4
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
doPlayerSetVocation(cid, vocationsNameId[getPlayerStorageValue(cid, startstorageid)].id)
doSendMagicEffect(getCreaturePosition(cid), 29)
setPlayerStorageValue(cid, startstorageid, 1)
selfSay("Ok, you have changed this vocation to vocation {"..(vocationsNameId[getPlayerStorageValue(cid, startstorageid)].name).."}.", cid)
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, 'no') and talkState[talkUser] == 4 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Continua sem funcionar :/ e nesse nao tava nem sumonando o npc pelo =<49. ficava dando erro. 

Faz diferente, vou fazer um npc pra cada promote. Dai só me passa um script de um npc de promote normal que olha a vocação e lvl, se for a id da vocação que pode promover  ele promote senao fala que nao pode.

Algo do tipo sei la kkk 

 

e muitissimo obrigado pela ajuda

Postado

erro meu... não é =< é <=

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
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 greetCallback(cid)
talkState[talkUser] = 0
return true
end
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
if(not npcHandler:isFocused(cid)) then 
return false 
end
local vocationsNameId = {
{name = "Lutador", id = 4}, -- nome da vocação, id
{name = "Defensor", id = 8}
}
local startstorageid = 30031
local msg = string.lower(msg)
if getPlayerStorageValue(cid, startstorageid) == 1 then
selfSay("You has changed your vocation!", cid)
npcHandler:onCreatureDisappear(cid)
end
if getPlayerVocationId(cid, 12) == false then
elseif getPlayerLevel(cid) <= 49 then
selfSay("You dont change your vocation and You need level 50 to change vocation.", cid)
npcHandler:onCreatureDisappear(cid)
end
if msgcontains(msg, 'yes') and talkState[talkUser] == nil or talkState[talkUser] == 0 then
selfSay("You want to change your vocation?", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'no') and talkState[talkUser] == nil or talkState[talkUser] == 0 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
selfSay("Ok, you change to {"..(vocationsNameId[1].name).."} or {"..(vocationsNameId[2].name).."}?", cid)
talkState[talkUser] = 3
elseif msgcontains(msg, 'no') and talkState[talkUser] == 2 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, string.lower(vocationsNameId[1].name)) and talkState[talkUser] == 3 then
selfSay("You want to change your vocation to {"..(vocationsNameId[1].name).."}?", cid)
setPlayerStorageValue(cid, startstorageid, 1)
talkState[talkUser] = 4
elseif msgcontains(msg, string.lower(vocationsNameId[2].name)) and talkState[talkUser] == 3 then
selfSay("You want to change your vocation to {"..(vocationsNameId[2].name).."}?", cid)
setPlayerStorageValue(cid, startstorageid, 1)
talkState[talkUser] = 4
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
doPlayerSetVocation(cid, vocationsNameId[getPlayerStorageValue(cid, startstorageid)].id)
doSendMagicEffect(getCreaturePosition(cid), 29)
setPlayerStorageValue(cid, startstorageid, 1)
selfSay("Ok, you have changed this vocation to vocation {"..(vocationsNameId[getPlayerStorageValue(cid, startstorageid)].name).."}.", cid)
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
elseif msgcontains(msg, 'no') and talkState[talkUser] == 4 then
talkState[talkUser] = 0
npcHandler:onCreatureDisappear(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

não prestei atenção nas aulas de LP  :D

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

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