Ir para conteúdo
  • Cadastre-se

[Pedido] NPC Escolha Promotion


Posts Recomendados

Bom galera, estou melhorando o OT e coloquei duas especializações para cada classe.

 

Exemplo: Knight no lvl 50 pode escolher entre virar Defensor e Guerreiro. Paladino pode virar Arqueiro e Assassino. E assim vai.

 

Gostaria que alguém me passasse um script e o xml do npc que o player pudesse escolher entre essas vocações. O npc deve dar as opções de vocações de acordo com a vocação do player. Se for knight só vai dar a opção de Defensor e Guerreiro por exemplo. 

 

Segue o id e nome das vocações:

 

<vocation id="1" name="Mago" description="a Mago" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="5" gainmanaticks="1" gainmanaamount="5" manamultiplier="1.1" attackspeed="1600" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="2" name="Curandeiro" description="a Curandeiro" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="5" gainmanaticks="1" gainmanaamount="5" manamultiplier="1.1" attackspeed="1600" soulmax="100" gainsoulticks="120" fromvoc="2">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.3" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="3" name="Ladino" description="a Ladino" needpremium="0" gaincap="20" gainhp="10" gainmana="10" gainhpticks="2" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.4" attackspeed="1600" soulmax="100" gainsoulticks="120" fromvoc="3">
<formula meleeDamage="1.2" distDamage="1.2" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.8" sword="1.0" axe="1.8" distance="1.0" shielding="1.8" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="4" name="Lutador" description="a Lutador" needpremium="0" gaincap="25" gainhp="20" gainmana="5" gainhpticks="2" gainhpamount="20" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.5" attackspeed="1000" soulmax="100" gainsoulticks="120" fromvoc="4">
<formula meleeDamage="1.5" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="2.0" defense="1.2" magDefense="1.2" armor="1.2"/>
<skill fist="1.1" club="1.0" sword="1.8" axe="1.0" distance="1.8" shielding="1.0" fishing="1.1" experience="1.0"/>
</vocation>
<vocation id="5" name="Necromancer" description="a Necromancer" needpremium="1" gaincap="10" gainhp="10" gainmana="60" gainhpticks="2" gainhpamount="10" gainmanaticks="1" gainmanaamount="10" manamultiplier="1.3" attackspeed="1200" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="50">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.5" magDamage="1.3" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.1"/>
</vocation>
<vocation id="6" name="Meister" description="a Meister" needpremium="1" gaincap="10" gainhp="10" gainmana="60" gainhpticks="2" gainhpamount="10" gainmanaticks="2" gainmanaamount="60" manamultiplier="1.3" attackspeed="1200" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="50">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.1" magDamage="1.0" magHealingDamage="2.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.1"/>
</vocation>
<vocation id="7" name="Arqueiro" description="an Arqueiro" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="2" gainhpamount="10" gainmanaticks="2" gainmanaamount="20" manamultiplier="1.3" attackspeed="1050" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="50">
<formula meleeDamage="1.0" distDamage="1.3" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.6" sword="1.6" axe="1.6" distance="1.0" shielding="1.6" fishing="1.1" experience="1.1"/>
</vocation>
<vocation id="8" name="Defensor" description="a Defensor" needpremium="1" gaincap="35" gainhp="60" gainmana="10" gainhpticks="2" gainhpamount="50" gainmanaticks="2" gainmanaamount="20" manamultiplier="1.2" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="50">
<formula meleeDamage="1.2" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="2.0" magDefense="2.0" armor="2.0"/>
<skill fist="1.1" club="1.0" sword="1.2" axe="1.2" distance="1.4" shielding="1.0" fishing="1.1" experience="1.1"/>
</vocation>
<!--
<vocation id="9" name="Wizard" description="a Wizard" needpremium="0" gaincap="15" gainhp="15" gainmana="60" gainhpticks="2" gainhpamount="10" gainmanaticks="2" gainmanaamount="60" manamultiplier="1.3" attackspeed="1100" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="50">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.1"/>
</vocation>
<vocation id="10" name="Metamorfo" description="a Metamorfo" needpremium="0" gaincap="15" gainhp="25" gainmana="25" gainhpticks="2" gainhpamount="20" gainmanaticks="2" gainmanaamount="30" manamultiplier="1.3" attackspeed="1000" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="50">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.5" club="1.8" sword="1.1" axe="1.8" distance="1.8" shielding="1.3" fishing="1.1" experience="1.1"/>
</vocation>
<vocation id="11" name="Assassino" description="an Assassino" needpremium="0" gaincap="20" gainhp="20" gainmana="10" gainhpticks="2" gainhpamount="15" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.4" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="50">
<formula meleeDamage="1.4" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.2" club="1.8" sword="1.0" axe="1.8" distance="1.4" shielding="2.1" fishing="1.1" experience="1.1"/>
</vocation>
<vocation id="12" name="Guerreiro" description="a Guerreiro" needpremium="0" gaincap="25" gainhp="35" gainmana="15" gainhpticks="2" gainhpamount="25" gainmanaticks="2" gainmanaamount="25" manamultiplier="1.3" attackspeed="800" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="50">
<formula meleeDamage="1.3" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill fist="1.1" club="1.5" sword="1.8" axe="1.0" distance="1.4" shielding="1.4" fishing="1.1" experience="1.1"/>
</vocation>

 

Agradeço desde ja.

Editado por paulovbonfim (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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) < 50 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())

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}

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

Link para o post
Compartilhar em outros sites

 

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) < 50 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())

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}

 

Primeiramente muitissímo obrigado pela velocidade da resposta.

 

No caso a primeira voc é lutador, e dela vira defensor ou guerreiro. Dai ficaria:

 

getPlayerVocationId(cid, 4) (lutador no caso) e

 

{name = "Guerreiro", id = 12}, -- nome da vocação, id

{name = "Defensor", id = 8}

 

isso mesmo ?

Link para o post
Compartilhar em outros sites

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

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

Link para o post
Compartilhar em outros sites

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

n54lxu.png

 

 

O npc não responde nada. Qual o problema ? Coloquei o script na pasta scripts como promote.lua. e criei o .xml

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Promoter Lutador" script="promote.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="139" head="59" body="57" legs="59" feet="75" addons="3"/>
</npc>
Link para o post
Compartilhar em outros sites

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

Link para o post
Compartilhar em outros sites

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?

Link para o post
Compartilhar em outros sites

@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

Link para o post
Compartilhar em outros sites

@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

Link para o post
Compartilhar em outros sites

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

Link para o post
Compartilhar em outros sites

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

 

 

Também não funcionou. :( ele fica parado na primeira frase. 

 

" 20:40 Promoter Lutador: Hello Mr Tank. Hello I can change your vocation, are you sure ?

20:40 Mr Tank [115]: yes
20:40 Mr Tank [115]: change
20:40 Mr Tank [115]: vocation
20:41 Mr Tank [115]: defensor
20:41 Mr Tank [115]: guerreiro"
 
consegui fazer um aqui, ta trocando a vocação o unico problema é que não salva, quando o char reloga ele ta na vocação inicial vou passar ele aqui
 

<npc name="Oracle Lutador Promoter" floorchange="0" walkinterval="0" access="5">
<health now="150" max="150"/>
<look typeex="1448"/>
<interaction range="3" idletime="30">
<interact keywords="hi" focus="1">
<!--These are the keywords will trigger this interaction-->
<keywords>hello</keywords>
<keywords>greet</keywords>
 
<response>
<action name="script">
<![CDATA[
if(getPlayerLevel(cid)) >= 50 then
selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?")
_state.b1 = (isPremium(cid) == TRUE)
_state.topic = 1
else
selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!")
_state.isidle = true
end
]]>
</action>
</response>
</interact>
 
<interact keywords="yes" topic="1">
<response text=" WHAT PROFESSION HAVE YOU CHOSEN: Defensor or Guerreiro?">
<!--n1: 1 = prudence, 2 = edron, 3 = thais, 4 = venore-->
<action name="script">
<![CDATA[
_state.topic = 2
]]>
</action>
</response>
</interact>
 
<interact keywords="defensor" topic="2">
<response text="Um Defensor, grande defesa e vida sem limites, pronto para proteger seus amigos em dungeons e contra monstros que sem voce seria hitkill em todo o grupo. Voce sera imortal!! Esta pronto para este destino ?">
<!--n2: 8 = defensor, 12 = guerreiro-->
<action name="script">
<![CDATA[
_state.n2 = 8
_state.topic = 4
]]>
</action>
</response>
</interact>
 
<interact keywords="guerreiro" topic="2">
<response text="Um Guerreiro! Um combatente de forças inimaginaveis capaz de causar danos estrondosos aos inimigos com seus machados de duas mãos. São capazes de matar inimigos com um unico golpe! Tem certeza deste destino?">
<!--n2: 8 = defensor, 12 = guerreiro-->
<action name="script">
<![CDATA[
_state.n2 = 12
_state.topic = 4
]]>
</action>
</response>
</interact>
 
 
<!--If the player does not say any profession, repeat our question-->
<interact keywords="|*|" topic="3">
<response text="Guerreiro ou Defensor?"/>
</interact>
 
<interact keywords="yes" topic="4">
<response>
<!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
<!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
<action name="script">
<![CDATA[
 
selfSay("SO BE IT!")
doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
doPlayerSetVocation(cid, _state.n2)
return true
]]>
</action>
<action name="idle" value="1"/>
</response>
</interact>
 
<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response text="Good bye. Recommend us, if you were satisfied with our service."/>
</interact>
 
<!--This event triggers if the player goes to far away from the npc/logout/idle timeout-->
<interact event="onPlayerLeave" focus="0">
<response text="How Rude!"/>
</interact>
</interaction>
 
</npc>

 
 
 
Editado por paulovbonfim (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

<npc name="Oracle Lutador Promoter" floorchange="0" walkinterval="0" access="5">
<health now="150" max="150"/>
<look typeex="1448"/>
<interaction range="3" idletime="30">
<interact keywords="hi" focus="1">
<!--These are the keywords will trigger this interaction-->
<keywords>hello</keywords>
<keywords>greet</keywords>
 
<response>
<action name="script">
<![CDATA[
if(getPlayerLevel(cid)) >= 50 then
selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?")
_state.b1 = (isPremium(cid) == TRUE)
_state.topic = 1
else
selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!")
_state.isidle = true
end
]]>
</action>
</response>
</interact>
 
<interact keywords="yes" topic="1">
<response text=" WHAT PROFESSION HAVE YOU CHOSEN: Defensor or Guerreiro?">
<!--n1: 1 = prudence, 2 = edron, 3 = thais, 4 = venore-->
<action name="script">
<![CDATA[
_state.topic = 2
]]>
</action>
</response>
</interact>
 
<interact keywords="defensor" topic="2">
<response text="Um Defensor, grande defesa e vida sem limites, pronto para proteger seus amigos em dungeons e contra monstros que sem voce seria hitkill em todo o grupo. Voce sera imortal!! Esta pronto para este destino ?">
<!--n2: 8 = defensor, 12 = guerreiro-->
<action name="script">
<![CDATA[
_state.n2 = 8
_state.topic = 4
]]>
</action>
</response>
</interact>
 
<interact keywords="guerreiro" topic="2">
<response text="Um Guerreiro! Um combatente de forças inimaginaveis capaz de causar danos estrondosos aos inimigos com seus machados de duas mãos. São capazes de matar inimigos com um unico golpe! Tem certeza deste destino?">
<!--n2: 8 = defensor, 12 = guerreiro-->
<action name="script">
<![CDATA[
_state.n2 = 12
_state.topic = 4
]]>
</action>
</response>
</interact>
 
 
<!--If the player does not say any profession, repeat our question-->
<interact keywords="|*|" topic="3">
<response text="Guerreiro ou Defensor?"/>
</interact>
 
<interact keywords="yes" topic="4">
<response>
<!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
<!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
<action name="script">
<![CDATA[
 
selfSay("SO BE IT!")
doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
doPlayerSetVocation(cid, _state.n2)
doRemoveCreature(cid)
return true
]]>
</action>
<action name="idle" value="1"/>
</response>
</interact>
 
<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response text="Good bye. Recommend us, if you were satisfied with our service."/>
</interact>
 
<!--This event triggers if the player goes to far away from the npc/logout/idle timeout-->
<interact event="onPlayerLeave" focus="0">
<response text="How Rude!"/>
</interact>
</interaction>
 
</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

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo