Ir para conteúdo
  • Cadastre-se

Monster/NPC NPC Bless, Mapping e Heal


Posts Recomendados

Venho trazer pra vocês npc pra custom map, ou até mesmo global..  o Script foi testado tfs 1.2, mas creio eu que funcione tfs 1.0+ etc.

Basicamente ele marca o map com icones.

 

16xoPvF.jpg

 

configurável

local marks = {
		{mark = 5, pos = {x = 160, y = 51, z = 7}, desc = "Enigma City Temple"},
		{mark = 10, pos = {x = 130, y = 52, z = 7}, desc = "Depot with bank"},
		{mark = 13, pos = {x = 146, y = 44, z = 7}, desc = "Food store"},
		{mark = 8, pos = {x = 278, y = 236, z = 7}, desc = "Smithery"},
		{mark = 8, pos = {x = 130, y = 56, z = 7}, desc = "Distance weapons shop"},
		{mark = 13, pos = {x = 268, y = 241, z = 7}, desc = "Jewelry, magic store and music instruments shop"},
		{mark = 13, pos = {x = 303, y = 247, z = 7}, desc = "Food shop and magic store"},
		{mark = 7, pos = {x = 174, y = 61, z = 7}, desc = "Tools and furniture"},
		{mark = 13, pos = {x = 180, y = 68, z = 7}, desc = "Creature products and fashion"},
		{mark = 9, pos = {x = 199, y = 74, z = 7}, desc = "Ship"},

 

Vamos a instalação.

vá até npcs e crie um .xml

 

Alice.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Alice" script="blessevoguide.lua" walkinterval="2000" floorchange="0" speechbubble="1">
	<health now="100" max="100"/>
	<look type="138" head="58" body="114" legs="87" addons="3"/>
	<parameters>
<!-- 		<parameter key="message_greet" value="Be greeted. If you need {something} just ask me."/> -->
		<parameter key="message_farewell" value="See you soon!"/>
		<parameter key="message_walkaway" value="Bye." />
		<parameter key="module_keywords" value="1" />
		<parameter key="keywords" value="bless;help;temple;priestess;job;something;food;guide;blessings;enigma" />
		<parameter key="keyword_reply1" value="I can grant you blessings such as {Wisdom} {of} {Solitude}, {Spark} {of} {The} {Phoenix}, our {Fire} {of} {Two} {Suns}, {Spiritual} {Shielding} and {The Embrace}. I can also grant you {all} of these blessings, just ask me." />
		<parameter key="keyword_reply2" value="I can give you {blessings}, {heal} you if you are wounded and help you finding yourself by {marking} your {map}" />
		<parameter key="keyword_reply3" value="I am last {Priestess} left in Enigma City. I wrote my knowledge in books in hope it will be saved. I am also a {guide} of Enigma City." />
		<parameter key="keyword_reply4" value="We are here to {guide} people in their lives." />
		<parameter key="keyword_reply5" value="We are here to {guide} people in their lives." />
		<parameter key="keyword_reply6" value="I can give you {bless}ings and help you finding yourself by {marking} your {map}." />
		<parameter key="keyword_reply7" value="You can earn some by hunting animals or buy some in stores near Depot." />
		<parameter key="keyword_reply8" value="I can show you way around and set some {marks} on your {map}" />
		<parameter key="keyword_reply9" value="I can grant you blessings such as {Wisdom} {of} {Solitude}, {Spark} {of} {The} {Phoenix}, our {Fire} {of} {Two} {Suns}, {Spiritual} {Shielding} and {The Embrace}. I can also grant you {all} of these blessings, just ask me." />
		<parameter key="keyword_reply10" value="Our home. Great city of great prosperity. Isn't it a magical place?" />
	</parameters>
	</npc>

 

 

vá até /scripts e crie um .lua

 

blessevoguide.lua

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local random_texts = {'Welcome to our humble temple.', 'If you are hurt ask me, I\'ll heal you.', 'Feeling lost? Ask me for help.', 'Praise our God. He has power to revive adventurers whose adventure is not over yet!'}
local random_texts_chance = 40 -- percent
local random_texts_interval = 120 -- seconds
random_word_bless = 0
local talkState = {}
local function round(num, idp)
    local mult = 10^(idp or 0)
    if num >= 0 then return math.floor(num * mult + 0.5) / mult
    else return math.ceil(num * mult - 0.5) / mult end
end

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()
	if(random_word_bless < os.time()) then
		random_word_bless = (os.time() + random_texts_interval)
		if(math.random(1, 100) < random_texts_chance) then
			selfSay(random_texts[math.random(1, #random_texts)])
		end
	end
	npcHandler:onThink()
end
function onPlayerEndTrade(cid)				npcHandler:onPlayerEndTrade(cid)			end
function onPlayerCloseChannel(cid)			npcHandler:onPlayerCloseChannel(cid)		end
		function greetCallback(cid)
	local talkUser = cid
	local msg = {
		"Be greeted. If you need {something} just ask me.", 
		"Welcome to our humble temple, " .. getPlayerName(cid) .. ".", 
		"Welcome, " .. getPlayerName(cid) .. "! Welcome to the temple of {Enigma City}. If you need {healing}, I can help you.", 
		"Hello. How may I help you " .. getPlayerName(cid) .. "?", 
		"Come in, " .. getPlayerName(cid) .. "."
	}
	npcHandler:setMessage(MESSAGE_GREET, msg[math.random(1, #msg)])
	talkState[talkUser] = 0
	return true
end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = cid
	if(msgcontains(msg, 'map') or msgcontains(msg, 'mark')) then
	selfSay('Do you want me to mark your map with important locations in our town?', cid)
	talkState[talkUser] = 1
	return true
	end
	if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		local marks = {
		{mark = 5, pos = {x = 160, y = 51, z = 7}, desc = "Enigma City Temple"},
		{mark = 10, pos = {x = 130, y = 52, z = 7}, desc = "Depot with bank"},
		{mark = 13, pos = {x = 146, y = 44, z = 7}, desc = "Food store"},
		{mark = 8, pos = {x = 278, y = 236, z = 7}, desc = "Smithery"},
		{mark = 8, pos = {x = 130, y = 56, z = 7}, desc = "Distance weapons shop"},
		{mark = 13, pos = {x = 268, y = 241, z = 7}, desc = "Jewelry, magic store and music instruments shop"},
		{mark = 13, pos = {x = 303, y = 247, z = 7}, desc = "Food shop and magic store"},
		{mark = 7, pos = {x = 174, y = 61, z = 7}, desc = "Tools and furniture"},
		{mark = 13, pos = {x = 180, y = 68, z = 7}, desc = "Creature products and fashion"},
		{mark = 9, pos = {x = 199, y = 74, z = 7}, desc = "Ship"},
	}
	local f_addMark = doPlayerAddMapMark
	if(not f_addMark) then f_addMark = doAddMapMark end
	for _, m  in pairs(marks) do
		f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
	end
	selfSay('Here you are.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if msgcontains(msg, "no") and talkState[talkUser] ~= 0 then
	selfSay('May God guide your path then.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if msgcontains(msg, "heal") then
		if getCreatureCondition(cid, CONDITION_FIRE) then
			selfSay("You are burning. I will help you.", cid)
			doRemoveCondition(cid, CONDITION_FIRE)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
		elseif getCreatureCondition(cid, CONDITION_POISON) then
			selfSay("You are poisoned. I will cure you.", cid)
			doRemoveCondition(cid, CONDITION_POISON)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
		elseif getCreatureCondition(cid, CONDITION_ENERGY) then
			selfSay("You are electrificed. I will help you.", cid)
			doRemoveCondition(cid, CONDITION_ENERGY)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
		elseif getCreatureCondition(cid, CONDITION_PARALYZE) then
			selfSay("You are paralyzed. I will cure you.", cid)
			doRemoveCondition(cid, CONDITION_PARALYZE)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
		elseif getCreatureCondition(cid, CONDITION_DROWN) then
			selfSay("You are drowing. I will help you.", cid)
			doRemoveCondition(cid, CONDITION_DROWN)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
		elseif getCreatureCondition(cid, CONDITION_FREEZING) then
			selfSay("You are cold! I will help you.", cid)
			doRemoveCondition(cid, CONDITION_FREEZING)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HITBYFIRE)
		elseif getCreatureCondition(cid, CONDITION_BLEEDING) then
			selfSay("You are bleeding! I will help you.", cid)
			doRemoveCondition(cid, CONDITION_BLEEDING)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
		elseif getCreatureCondition(cid, CONDITION_DAZZLED) then
			selfSay("You are dazzled! Do not mess with holy creatures anymore!", cid)
			doRemoveCondition(cid, CONDITION_DAZZLED)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_PURPLEENERGY)
		elseif getCreatureCondition(cid, CONDITION_CURSED) then
			selfSay("You are cursed! I will remove it.", cid)
			doRemoveCondition(cid, CONDITION_CURSED)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_PURPLEENERGY)
		elseif getCreatureHealth(cid) < 65 then
			selfSay("You are looking really bad. Let me heal your wounds.", cid)
			doCreatureAddHealth(cid, 65 - getCreatureHealth(cid))
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
		elseif getCreatureHealth(cid) < 2000 then
			selfSay("I did my best to fix your wounds.", cid)
			doCreatureAddHealth(cid, 2000 - getCreatureHealth(cid))
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
		else
			local msgheal = {
				"You aren't looking really bad, " .. getCreatureName(cid) .. ". I only help in cases of real emergencies. Raise your health simply by eating {food}.", 
				"Seriously? It's just a scratch", 
				"Don't be a child. You don't need any help with your health.", 
				"I'm not an expert. If you need help find a medic.", 
				"Don't even waste my time, I have bigger problems than your scratched armor."
			}
			selfSay("" .. msgheal[math.random(1, #msgheal)] .. "", cid)
		end
	return true
	end
	
	if(msgcontains(msg, 'white') and msgcontains(msg, 'magic')) then
	selfSay('The white magic book, I saw it recently in library. If you are lucky enough you may still find it there.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if(msgcontains(msg, 'expert') and msgcontains(msg, 'spell')) then
	selfSay('They are available only for highest level wizards. They are mostly support and protection spells.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if(msgcontains(msg, 'stationary') and msgcontains(msg, 'shield')) then
	selfSay('Princess Estalice told me to learn this spell. It might be useful during assault of the hive one day.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if(msgcontains(msg, 'age') and msgcontains(msg, 'spell')) then
	selfSay('This one is available only for highest level wizards. I am not skilled enough to cast it.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if(msgcontains(msg, 'soft') and msgcontains(msg, 'wings')) then
	selfSay('This one allows to fly and walk on clouds by summoning mentioned wings, but they are very fragile and the spell is very complicated itself. I casted this spell once, but its user didn\'t appreciated my effort.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if(msgcontains(msg, 'lightbringer')) then
	selfSay('They are very rare creatures. Seeing one is like spotting a unicorn. They live in highest layers of clouds, a very little is known about them.', cid)
	talkState[talkUser] = 0
	return true
	end
	
	if(msgcontains(msg, 'cloudwalking')) then
	local spelldur = round((getPlayerStorageValue(cid, 22444)-os.time())/3600)
		if getPlayerStorageValue(cid,22444) < os.time() then
			if getPlayerMoney(cid) > 4999 then
			selfSay('The cloudwalking spell is simpler alternative of {soft wings} spell, but it\'s more dangerous also. You have to watch youself - if you fall from a cloud, nothing can save you. This spell lasts for three days. Do you want me to cast it on you for a small donation of 5000 gold?', cid)
			talkState[talkUser] = 9
			else
			selfSay('The cloudwalking spell is simpler alternative of {soft wings} spell, but it\'s more dangerous also. You have to watch youself - if you fall from a cloud, nothing can save you. This spell lasts for three days.', cid)
			talkState[talkUser] = 0
			end
		else
			if getPlayerMoney(cid) > 4999 then
			if spelldur == 1 then rt = '' else rt = 's' end
			selfSay('It seems you still have ' .. spelldur .. ' hour' .. rt .. ' of spell left. Do you want to extend your spell for 5000 gold? It will work for three days from now.', cid)			talkState[talkUser] = 9
			else
			selfSay('The cloudwalking spell is simpler alternative of {soft wings} spell, but it\'s more dangerous also. You have to watch youself - if you fall from a cloud, nothing can save you. This spell lasts for three days. You have ' .. spelldur .. ' hour' .. rt .. ' of spell left.', cid)
			talkState[talkUser] = 0
			end		
		end
		return true
	end
	
	if msgcontains(msg, "yes") and talkState[talkUser] == 9 then
	if(doPlayerRemoveMoney(cid, 5000)) then
	doCreatureSetStorage(cid, 22444, os.time() + (86400 * 3))
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
	selfSay('So be it! I hope you know what you are doing.', cid)
	talkState[talkUser] = 0
	else
	selfSay('Come back when you decide to bring me donation for serious. I don\'t work with cheaters.', cid)
	talkState[talkUser] = 0
	end
	return true
	end
	
	if msgcontains(msg, "yes") and talkState[talkUser] > 90 and talkState[talkUser] < 96 then
		if getPlayerBlessing(cid, talkState[talkUser] - 90) then
			selfSay("You already have this blessing!", cid)
		else
			b_price = (2000 + ((math.min(130, getPlayerLevel(cid)) - 30) * 200))
			if b_price < 2000 then b_price = 2000 end
			
			if doPlayerRemoveMoney(cid, b_price) then
				selfSay("You have been blessed by one of the five gods!", cid)
				doPlayerAddBlessing(cid, talkState[talkUser] - 90)
				doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
			else
				selfSay("I'm sorry. We need money to keep this temple up.", cid)
			end
		end
		talkState[talkUser] = 0
		return true
	end
	
	if msgcontains(msg, "yes") and talkState[talkUser] == 96 then
		havebless = {}
		
		for i = 1, 5 do
			if(getPlayerBlessing(cid, i)) then
				table.insert(havebless,i)
			end
		end
		
		if #havebless == 5 then
			selfSay('You already have all available blessings.',cid)
			talkState[talkUser] = 0
			return true
		end
		
		b_price = (2000 + ((math.min(130, getPlayerLevel(cid)) - 30) * 200))
		if b_price < 2000 then b_price = 2000 end
		b_price = ((5 - #havebless) * b_price)
		
		if doPlayerRemoveMoney(cid, b_price) then
			selfSay("You have been blessed by the five gods!", cid)
			for i = 1, 5 do doPlayerAddBlessing(cid, i) end
			doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		else
			selfSay("I'm sorry. We need money to keep this temple up.", cid)
		end
			
		talkState[talkUser] = 0
		return true
	end
	
	if msgcontains(msg, "all") then
		havebless = {}
		b_price = (2000 + ((math.min(130, getPlayerLevel(cid)) - 30) * 200))
		if b_price < 2000 then b_price = 2000 end
		
		for i = 1, 5 do
			if(getPlayerBlessing(cid, i)) then
				table.insert(havebless,i)
			end
		end
		
		b_price = ((5 - #havebless) * b_price)
		
		if b_price == 0 then
			selfSay('You already have all available blessings.',cid)
			talkState[talkUser] = 0
			return true
		end
		
		selfSay('Do you want to receive all blessings for ' .. b_price .. ' gold?',cid)
		talkState[talkUser] = 96
		return true
	end
	
	local blesskeywords = {'wisdom', 'spark', 'fire', 'spiritual', 'embrace'}
	local blessnames = {'Wisdom of Solitude', 'Spark of The Phoenix', 'Fire of Two Suns', 'Spiritual Shielding', 'The Embrace'}
	for i = 1, #blesskeywords do
		if msgcontains(msg, blesskeywords[i]) then
		
			b_price = (2000 + ((math.min(130, getPlayerLevel(cid)) - 30) * 200))
			if b_price < 2000 then b_price = 2000 end
			
			selfSay('Do you want me to grant you ' .. blessnames[i] .. ' blessing for ' .. b_price .. ' gold?',cid)
			talkState[talkUser] = 90 + i
			return true
		end
	end
	
	return true
end
			
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

créditos zbizu.

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

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

Link para o post
Compartilhar em outros sites

Tente utilizar as funções mais atualizadas em seus scripts, evitando usar o compat principalmente se você está utilizando The Forgotten Server 1.2+

discord.pngDiscord: vankk #7765

Precisando de ajuda? Entre em contato comigo via Discord.

 

Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.

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.

  • Conteúdo Similar

    • Por Henrique Gaudard
      Olá pessoal, primeiramente quero dizer que acho muito complicado mecher em monsters, poís qualquer erro, é fatal!! não sei porque quando fasso algumas modficações nos monsters/npcs que é quando eu modfico algumas coisas.., não entendo, só edito os nomes tipo assim;
      name "sfdsdfds" eu ponho "dhfudshgusopofkpsdakfgjid" (obs: não é no nome do arquivo lua mais sim o nome do monster mesmo já na edição) e dá erro. Se eu meche-se nas parada lá nos código todo doido de scripting tudo bem mais eu só quero editar e quando eu vou colocá-lo no mapa acontece o seguinte:
       
      Quando ligo aparece: "[Spawn : : addMonster] Cannot find "Ninja Star"" (ele está no presente no mapa e é um script obviamente). Falo!!
       
      Sistema Operacional: Windows 10

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo