Ir para conteúdo
  • Cadastre-se

(Resolvido)Npc não funciona da maneira certa


Ir para solução Resolvido por luangop,

Posts Recomendados

  • Moderador

[Servidor de DBO]

Tipo, se um jogador reborn for pegar uma nova vocação no npc, ele irá se tornar uma vocação sem reborn, mas com a storage do reborn, e com isso ele vai está com uma vocação sem reborn, por cima da reborn, e isso iria causar tumultos, dizendo que o jogador era editado, e coisas do tipo. Teria alguma forma do script puxar a storage do reborn? Tipo, se tu não é reborn e pega uma vocação, tu fica com a vocação sem reborn, e se tu é reborn e pega a vocação, tu ainda continua reborn. Alguém poderia me ajudar pfv?

 

Essa é a Storage do reborn > 30023

Espero que não fiquem confusos(as) com a explicação kk

 

Npc Xml

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Vocacao" script="vocacao.lua" walkinterval="0">
<health now="100" max="100"/>
<look type="546"/>
    <parameters>
    <parameter key="message_greet" value="Olá, |PLAYERNAME|! Eu tenho aqui as melhores vocações! Diga {vocacao}."/>
    </parameters>
</npc>

Npc Script

Spoiler

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
 
local choose = {}
local cancel = {}
local available = {}
function creatureSayCallback(cid, type, msg)
 
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
    
if(msgcontains(msg, "vocacao")) then  
        selfSay("Qual dessas vocacoes voce quer se tornar? Shenron(VIP), Vegetto(VIP), Tapion(FREE), Kame(VIP), King Vegeta(VIP), Kagome(VIP), Zaiko(VIP), Chilled(Free), C8(VIP), Bills(VIP), Whiss(VIP), Super Broly(VIP), Champa(VIP), Paikuhan(VIP), Botamo(Free), Jiren(VIP), Yamcha(Free), Zamasu(VIP), Goku Black(VIP).", cid)
        talkState[talkUser] = 1
    elseif msgcontains(msg, "shenron") or msgcontains(msg, "SHENRON") and talk_state == 1 then
        doPlayerSetVocation(cid, 376)
        selfSay("Parabens, voce virou um Shenron", cid)
        
    elseif msgcontains(msg, "vegetto") or msgcontains(msg, "VEGETTO") and talk_state == 1 then
        doPlayerSetVocation(cid, 388)
        selfSay("Parabens, voce virou um Vegetto", cid)
        
       elseif msgcontains(msg, "tapion") or msgcontains(msg, "TAPION") and talk_state == 1 then
        doPlayerSetVocation(cid, 400)
        selfSay("Parabens, voce virou um Tapion", cid)
        
    elseif msgcontains(msg, "kame") or msgcontains(msg, "KAME") and talk_state == 1 then
        doPlayerSetVocation(cid, 413)
        selfSay("Parabens, voce virou um Kame", cid)
        
    elseif msgcontains(msg, "king vegeta") or msgcontains(msg, "KING VEGETA") and talk_state == 1 then
        doPlayerSetVocation(cid, 425)
        selfSay("Parabens, voce virou um King Vegeta", cid)
        
    elseif msgcontains(msg, "kagome") or msgcontains(msg, "KAGOME") and talk_state == 1 then
        doPlayerSetVocation(cid, 437)
        selfSay("Parabens, voce virou um Kagome", cid)
        
    elseif msgcontains(msg, "zaiko") or msgcontains(msg, "ZAIKO") and talk_state == 1 then
        doPlayerSetVocation(cid, 449)
        selfSay("Parabens, voce virou um Zaiko", cid)
        
    elseif msgcontains(msg, "chilled") or msgcontains(msg, "CHILLED") and talk_state == 1 then
        doPlayerSetVocation(cid, 461)
        selfSay("Parabens, voce virou um Chilled", cid)

    elseif msgcontains(msg, "c8") or msgcontains(msg, "C8") and talk_state == 1 then
        doPlayerSetVocation(cid, 478)
        selfSay("Parabens, voce virou um C8", cid)
        
    elseif msgcontains(msg, "bills") or msgcontains(msg, "BILLS") and talk_state == 1 then
        doPlayerSetVocation(cid, 552)
        selfSay("Parabens, voce virou um Bills", cid)
        
    elseif msgcontains(msg, "whiss") or msgcontains(msg, "WHISS") and talk_state == 1 then
        doPlayerSetVocation(cid, 572)
        selfSay("Parabens, voce virou um Whiss", cid)
        
    elseif msgcontains(msg, "super broly") or msgcontains(msg, "SUPER BROLY") and talk_state == 1 then
        doPlayerSetVocation(cid, 587)
        selfSay("Parabens, voce virou um Super Broly", cid)
        
    elseif msgcontains(msg, "champa") or msgcontains(msg, "CHAMPA") and talk_state == 1 then
        doPlayerSetVocation(cid, 602)
        selfSay("Parabens, voce virou um Champa", cid)
        
    elseif msgcontains(msg, "paikuhan") or msgcontains(msg, "PAIKUHAN") and talk_state == 1 then
        doPlayerSetVocation(cid, 615)
        selfSay("Parabens, voce virou um Paikuhan", cid)
        
    elseif msgcontains(msg, "botamo") or msgcontains(msg, "BOTAMO") and talk_state == 1 then
        doPlayerSetVocation(cid, 627)
        selfSay("Parabens, voce virou um Botamo", cid)

    elseif msgcontains(msg, "jiren") or msgcontains(msg, "JIREN") and talk_state == 1 then
        doPlayerSetVocation(cid, 640)
        selfSay("Parabens, voce virou um Jiren", cid)
        
    elseif msgcontains(msg, "yamcha") or msgcontains(msg, "YAMCHA") and talk_state == 1 then
        doPlayerSetVocation(cid, 653)
        selfSay("Parabens, voce virou um Yamcha", cid)

    elseif msgcontains(msg, "zamasu") or msgcontains(msg, "ZAMASU") and talk_state == 1 then
        doPlayerSetVocation(cid, 667)
        selfSay("Parabens, voce virou um Zamasu", cid)

    elseif msgcontains(msg, "goku black") or msgcontains(msg, "GOKU BLACK") and talk_state == 1 then
        doPlayerSetVocation(cid, 681)
        selfSay("Parabens, voce virou um Goku Black", cid)            
        
    elseif(msgcontains(msg, "bye") or msgcontains(msg, "goodbye") or msgcontains(msg, "cya")) then
        selfSay("cya!", cid, TRUE)
        closeShopWindow(cid)
        removeFocus(cid)
    end
end    

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

 

Editado por Phineasz (veja o histórico de edições)

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites

E oque tem que acontecer? se for reborn tem que perder o reborn?
Se for, isso vai resolver \/

 

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
 
local choose = {}
local cancel = {}
local available = {}
function creatureSayCallback(cid, type, msg)
 
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
    
if(msgcontains(msg, "vocacao")) then  
        selfSay("Qual dessas vocacoes voce quer se tornar? Shenron(VIP), Vegetto(VIP), Tapion(FREE), Kame(VIP), King Vegeta(VIP), Kagome(VIP), Zaiko(VIP), Chilled(Free), C8(VIP), Bills(VIP), Whiss(VIP), Super Broly(VIP), Champa(VIP), Paikuhan(VIP), Botamo(Free), Jiren(VIP), Yamcha(Free), Zamasu(VIP), Goku Black(VIP).", cid)
        talkState[talkUser] = 1
    elseif msgcontains(msg, "shenron") or msgcontains(msg, "SHENRON") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 376)
        selfSay("Parabens, voce virou um Shenron", cid)
        
    elseif msgcontains(msg, "vegetto") or msgcontains(msg, "VEGETTO") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 388)
        selfSay("Parabens, voce virou um Vegetto", cid)
        
       elseif msgcontains(msg, "tapion") or msgcontains(msg, "TAPION") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 400)
        selfSay("Parabens, voce virou um Tapion", cid)
        
    elseif msgcontains(msg, "kame") or msgcontains(msg, "KAME") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 413)
        selfSay("Parabens, voce virou um Kame", cid)
        
    elseif msgcontains(msg, "king vegeta") or msgcontains(msg, "KING VEGETA") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 425)
        selfSay("Parabens, voce virou um King Vegeta", cid)
        
    elseif msgcontains(msg, "kagome") or msgcontains(msg, "KAGOME") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 437)
        selfSay("Parabens, voce virou um Kagome", cid)
        
    elseif msgcontains(msg, "zaiko") or msgcontains(msg, "ZAIKO") and talk_state == 1 then
			if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 449)
        selfSay("Parabens, voce virou um Zaiko", cid)
        
    elseif msgcontains(msg, "chilled") or msgcontains(msg, "CHILLED") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 461)
        selfSay("Parabens, voce virou um Chilled", cid)

    elseif msgcontains(msg, "c8") or msgcontains(msg, "C8") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 478)
        selfSay("Parabens, voce virou um C8", cid)
        
    elseif msgcontains(msg, "bills") or msgcontains(msg, "BILLS") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 552)
        selfSay("Parabens, voce virou um Bills", cid)
        
    elseif msgcontains(msg, "whiss") or msgcontains(msg, "WHISS") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 572)
        selfSay("Parabens, voce virou um Whiss", cid)
        
    elseif msgcontains(msg, "super broly") or msgcontains(msg, "SUPER BROLY") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 587)
        selfSay("Parabens, voce virou um Super Broly", cid)
        
    elseif msgcontains(msg, "champa") or msgcontains(msg, "CHAMPA") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 602)
        selfSay("Parabens, voce virou um Champa", cid)
        
    elseif msgcontains(msg, "paikuhan") or msgcontains(msg, "PAIKUHAN") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 615)
        selfSay("Parabens, voce virou um Paikuhan", cid)
        
    elseif msgcontains(msg, "botamo") or msgcontains(msg, "BOTAMO") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 627)
        selfSay("Parabens, voce virou um Botamo", cid)

    elseif msgcontains(msg, "jiren") or msgcontains(msg, "JIREN") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 640)
        selfSay("Parabens, voce virou um Jiren", cid)
        
    elseif msgcontains(msg, "yamcha") or msgcontains(msg, "YAMCHA") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 653)
        selfSay("Parabens, voce virou um Yamcha", cid)

    elseif msgcontains(msg, "zamasu") or msgcontains(msg, "ZAMASU") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 667)
        selfSay("Parabens, voce virou um Zamasu", cid)

    elseif msgcontains(msg, "goku black") or msgcontains(msg, "GOKU BLACK") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
		setPlayerStorageValue(cid, 30023, -1)
		end
        doPlayerSetVocation(cid, 681)
        selfSay("Parabens, voce virou um Goku Black", cid)            
        
    elseif(msgcontains(msg, "bye") or msgcontains(msg, "goodbye") or msgcontains(msg, "cya")) then
        selfSay("cya!", cid, TRUE)
        closeShopWindow(cid)
        removeFocus(cid)
    end
end    

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

 

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

Link para o post
Compartilhar em outros sites
  • Moderador

@luangop Deixa eu tentar explicar melhor, vamos supor que você é um Shenron, e está preste a rebornar, depois que você rebornou tu viu que o Shenron é feio e coisa do tipo, ai você vai lá no npc e vai pegar x vocação, nessa que você pegou a nova vocação, você vai vim com ela sem reborn, mas você já vai tá rebornado entendeu? E não é pra acontecer isso, por que você terá mais vida do que o normal. Eu acho que a solução seria colocar uma storage para que se você não fosse reborn, tu ganhava uma vocação, e se fosse reborn, ganhava outra vocação, mais infelizmente não sei fazer script

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
  • Solução
3 minutos atrás, Phineasz disse:

@luangop Deixa eu tentar explicar melhor, vamos supor que você é um Shenron, e está preste a rebornar, depois que você rebornou tu viu que o Shenron é feio e coisa do tipo, ai você vai lá no npc e vai pegar x vocação, nessa que você pegou a nova vocação, você vai vim com ela sem reborn, mas você já vai tá rebornado entendeu? E não é pra acontecer isso, por que você terá mais vida do que o normal. Eu acho que a solução seria colocar uma storage para que se você não fosse reborn, tu ganhava uma vocação, e se fosse reborn, ganhava outra vocação, mais infelizmente não sei fazer script

 

Entendi.. Vou te ensinar a pescar nos 2 primeiros, o resto vc pesca sozinho.

    elseif msgcontains(msg, "shenron") or msgcontains(msg, "SHENRON") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
			doPlayerSetVocation(cid, XXX) -- Vocation rebornada.
			selfSay("Parabens, voce virou um Shenron Reborn.", cid)
			else
			doPlayerSetVocation(cid, 376)  -- Vocation normal.
			selfSay("Parabens, voce virou um Shenron.", cid)
		end
		
	elseif msgcontains(msg, "vegetto") or msgcontains(msg, "VEGETTO") and talk_state == 1 then
		if getPlayerStorageValue(cid, 30023) >= 1 then
			doPlayerSetVocation(cid, XXX) -- Vocation rebornada.
			selfSay("Parabens, voce virou um Vegetto Reborn.", cid)
			else
			doPlayerSetVocation(cid, 388)  -- Vocation normal.
			selfSay("Parabens, voce virou um Veggeto.", cid)
		end

 

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

Link para o post
Compartilhar em outros sites
  • Moderador

@luangop Funcionou, obrigado

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo