Ir para conteúdo
  • Cadastre-se

(Resolvido)NPC Informativo que marca no mapa.


Ir para solução Resolvido por GiovaniRodrigo,

Posts Recomendados

Tfs 0.4

 

Estou querendo um NPC informativo que eu possa digitar algumas informações sobre o game os npcs e o principal que é marcar o mapa. Exemplo sobre marcação quando o você digita "locais", ele lhe da informação sobre os locais como o templo, npc de equipamentos e o depot e lhe pergunta se você gostaria de marcar no mapa esse locais para o player poder se localizar melhor. Procurei na internet sobre esse npc mas não achei nada que funcione ou sobre o assunto mesmo. 

Link para o post
Compartilhar em outros sites
  • Solução

Tente isso:

.lua

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 markTable = {
--	{markPos = Coordenadas da marcação, markType = Tipo de marcação, markDescription = Descrição da marcação}
	{markPos = {x = 150, y = 150, z = 7}, markType = MAPMARK_TICK, markDescription = "Tick"},
	{markPos = {x = 155, y = 150, z = 7}, markType = MAPMARK_QUESTION, markDescription = "Question"},
	{markPos = {x = 160, y = 150, z = 7}, markType = MAPMARK_EXCLAMATION, markDescription = "Exclamation"},
	{markPos = {x = 165, y = 150, z = 7}, markType = MAPMARK_STAR, markDescription = "Star"},
	{markPos = {x = 170, y = 150, z = 7}, markType = MAPMARK_CROSS, markDescription = "Cross"},
	{markPos = {x = 175, y = 150, z = 7}, markType = MAPMARK_TEMPLE, markDescription = "Temple"},
	{markPos = {x = 180, y = 150, z = 7}, markType = MAPMARK_KISS, markDescription = "Kiss"},
	{markPos = {x = 185, y = 150, z = 7}, markType = MAPMARK_SHOVEL, markDescription = "Shovel"},
	{markPos = {x = 190, y = 150, z = 7}, markType = MAPMARK_SWORD, markDescription = "Sword"},
	{markPos = {x = 195, y = 150, z = 7}, markType = MAPMARK_FLAG, markDescription = "Flag"},
	{markPos = {x = 200, y = 150, z = 7}, markType = MAPMARK_LOCK, markDescription = "Lock"},
	{markPos = {x = 205, y = 150, z = 7}, markType = MAPMARK_BAG, markDescription = "Bag"},
	{markPos = {x = 210, y = 150, z = 7}, markType = MAPMARK_SKULL, markDescription = "Skull"},
	{markPos = {x = 215, y = 150, z = 7}, markType = MAPMARK_DOLLAR, markDescription = "Dollar"},
	{markPos = {x = 220, y = 150, z = 7}, markType = MAPMARK_REDNORTH, markDescription = "Red North"},
	{markPos = {x = 225, y = 150, z = 7}, markType = MAPMARK_REDSOUTH, markDescription = "Red South"},
	{markPos = {x = 230, y = 150, z = 7}, markType = MAPMARK_REDEAST, markDescription = "Red East"},
	{markPos = {x = 235, y = 150, z = 7}, markType = MAPMARK_REDWEST, markDescription = "Red West"},
	{markPos = {x = 240, y = 150, z = 7}, markType = MAPMARK_GREENNORTH, markDescription = "Green North"},
	{markPos = {x = 245, y = 150, z = 7}, markType = MAPMARK_GREENSOUTH, markDescription = "Green South"}
}

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
	
    local func_addMark = doPlayerAddMapMark
    if(not func_addMark) then
      func_addMark = doAddMapMark
    end
  
    if(msgcontains(msg, "locais")) then
		for mark, x in pairs(markTable) do
			func_addMark(cid, x.markPos, x.markType, x.markDescription ~= nil and x.markDescription or "")
		end
		selfSay("Oh, the locals, right?! Well, I marked some on your minimap", cid)
    end
end

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

TESTADO TFS 0.4 FUNCIONAL

 

MAPMASKS.thumb.png.2f1462b58872855c28a3db18fff5abc7.png

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

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}

if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

Link para o post
Compartilhar em outros sites

@GiovaniRodrigo teria para 0.3.6?

Compre seus Scripts Agora totalmente seguro e de forma rápida, aceitamos também encomendas.

discord.gg/phJZeHa2k4

 

Projeto ATS (Naruto)

Informações Abaixo

Facebook

Youtube
Discord

 

Tutoriais / Conteúdos

Clique Aqui

Link para o post
Compartilhar em outros sites
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 config = {
            [{"shovel","rope","backpack","riona"}] = {type = MAPMARK_SHOVEL, pos = {x=149,y=47,z=7}, name = "Riona\'s Tool Shop"},
            [{"demon","demons"}] = {type = MAPMARK_TICK, pos = {x=133,y=38,z=7}, name = "Demons"}
        }
       
           for var, ret in pairs(config) do
                for _, check in pairs(var) do
                    if msg == check then
                        type,pos,name = ret.type,ret.pos,ret.name
                        selfSay('Do you want me to add a mapmark '..msg..'? {yes}', cid)
                        talkState[talkUser] = 1
                    end
                end
            end
        if(msgcontains(msg, 'yes') and talkState[talkUser] >= 1) then
        doPlayerAddMapMark(cid, pos, type, name)
      npcHandler:say('Here you are.', cid)
      talkState[talkUser] = 0
    elseif(msgcontains(msg, 'no') and talkState[talkUser] >= 1) then
        selfSay('Well then, hope you can find it yourself!', cid)
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

@Brunds Não sei se existe diferença entre o dois, testa e vê se retorna algum erro. Se retornar, poste aqui.

Spoiler

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}

if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

Link para o post
Compartilhar em outros sites

@GiovaniRodrigo o script postado pelo vod funciona 100% no 0.3.6 vlw ^^

Compre seus Scripts Agora totalmente seguro e de forma rápida, aceitamos também encomendas.

discord.gg/phJZeHa2k4

 

Projeto ATS (Naruto)

Informações Abaixo

Facebook

Youtube
Discord

 

Tutoriais / Conteúdos

Clique Aqui

Link para o post
Compartilhar em outros sites

 

20 horas atrás, GiovaniRodrigo disse:

Tente isso:

.lua


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 markTable = {
--	{markPos = Coordenadas da marcação, markType = Tipo de marcação, markDescription = Descrição da marcação}
	{markPos = {x = 150, y = 150, z = 7}, markType = MAPMARK_TICK, markDescription = "Tick"},
	{markPos = {x = 155, y = 150, z = 7}, markType = MAPMARK_QUESTION, markDescription = "Question"},
	{markPos = {x = 160, y = 150, z = 7}, markType = MAPMARK_EXCLAMATION, markDescription = "Exclamation"},
	{markPos = {x = 165, y = 150, z = 7}, markType = MAPMARK_STAR, markDescription = "Star"},
	{markPos = {x = 170, y = 150, z = 7}, markType = MAPMARK_CROSS, markDescription = "Cross"},
	{markPos = {x = 175, y = 150, z = 7}, markType = MAPMARK_TEMPLE, markDescription = "Temple"},
	{markPos = {x = 180, y = 150, z = 7}, markType = MAPMARK_KISS, markDescription = "Kiss"},
	{markPos = {x = 185, y = 150, z = 7}, markType = MAPMARK_SHOVEL, markDescription = "Shovel"},
	{markPos = {x = 190, y = 150, z = 7}, markType = MAPMARK_SWORD, markDescription = "Sword"},
	{markPos = {x = 195, y = 150, z = 7}, markType = MAPMARK_FLAG, markDescription = "Flag"},
	{markPos = {x = 200, y = 150, z = 7}, markType = MAPMARK_LOCK, markDescription = "Lock"},
	{markPos = {x = 205, y = 150, z = 7}, markType = MAPMARK_BAG, markDescription = "Bag"},
	{markPos = {x = 210, y = 150, z = 7}, markType = MAPMARK_SKULL, markDescription = "Skull"},
	{markPos = {x = 215, y = 150, z = 7}, markType = MAPMARK_DOLLAR, markDescription = "Dollar"},
	{markPos = {x = 220, y = 150, z = 7}, markType = MAPMARK_REDNORTH, markDescription = "Red North"},
	{markPos = {x = 225, y = 150, z = 7}, markType = MAPMARK_REDSOUTH, markDescription = "Red South"},
	{markPos = {x = 230, y = 150, z = 7}, markType = MAPMARK_REDEAST, markDescription = "Red East"},
	{markPos = {x = 235, y = 150, z = 7}, markType = MAPMARK_REDWEST, markDescription = "Red West"},
	{markPos = {x = 240, y = 150, z = 7}, markType = MAPMARK_GREENNORTH, markDescription = "Green North"},
	{markPos = {x = 245, y = 150, z = 7}, markType = MAPMARK_GREENSOUTH, markDescription = "Green South"}
}

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
	
	local func_addMark = doPlayerAddMapMark
	if(not func_addMark) then
		func_addMark = doAddMapMark
	end
	
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if(msgcontains(msg, "locais")) then
		for mark, x in pairs(markTable) do
			func_addMark(cid, x.markPos, x.markType, x.markDescription ~= nil and x.markDescription or "")
		end
		selfSay("Oh, the locals, right?! Well, I marked some on your minimap", cid)
    end
end

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

TESTADO TFS 0.4 FUNCIONAL

 

MAPMASKS.thumb.png.2f1462b58872855c28a3db18fff5abc7.png

 

 

 

Funcionando perfeitamente obrigado.

Link para o post
Compartilhar em outros sites

@Mazarati Sempre que precisar, estaremos aqui para ajudar.

Spoiler

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}

if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

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