• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Global Blessings

tae

Active Member
Joined
Oct 7, 2007
Messages
1,284
Reaction score
29
Location
Trap Block
well this is a simple script so i geuss for all the people who wants a pr0 real map could use it.

Eremo
Code:
<npc name="Eremo
" script="data/npc/scripts/the wisdom of solitude.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="131" head="110" body="69" legs="41" feet="91" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|." />
<parameter key="message_farewell" value="Good bye |PLAYERNAME|!" />
<parameter key="module_shop" value="1" />
<parameter key="shop_buyable" value="amulet of loss,2173,10000;" />

<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="name;offer" />
<parameter key="keyword_reply1" value="I sell the wisdom of solitude blessing and amulets of loss." />


</parameters>
</npc>

Code:
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

function creatureSayCallback(cid, type, msg)
	--- TODO: bless function in modules.lua
	if(npcHandler.focus ~= cid) then
		return FALSE
	end

	if msgcontains(msg, 'blessing') or msgcontains(msg, 'blessings') or msgcontains(msg, 'help') or msgcontains(msg, 'offer') then
		npcHandler:say("I can provide you with The Wisdom of Solitude blessing.")
		talkState = 0
	elseif msgcontains(msg, 'the wisdom of solitude') then
		npcHandler:say("Do you want to buy the wisdom of solitude blessing for 10000 gold?")
		talkState = 4
	elseif talkState > 0 then
		if msgcontains(msg, 'yes') then
			if getPlayerBlessing(cid, talkState) then
				npcHandler:say("A god has already blessed you with this blessing.")
			elseif isPremium(cid) == TRUE then
				if doPlayerRemoveMoney(cid, 10000) == TRUE then
					doPlayerAddBlessing(cid, talkState)
					npcHandler:say("You have been blessed by one of the five gods!")
				else
					npcHandler:say("You don't have enough money.")
				end
			else
				npcHandler:say("You need a premium account to buy blessings.")
			end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Then not.")
		end
		talkState = 0
	end
	return TRUE
end

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

Edela
Code:
<npc name="Edela" script="data/npc/scripts/the fire of suns.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="63" head="110" body="69" legs="41" feet="91" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME| would you like to buy a blessing?" />
<parameter key="message_farewell" value="Good bye |PLAYERNAME|!" />
<parameter key="module_shop" value="1" />
</parameters>
</npc>

Code:
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

function creatureSayCallback(cid, type, msg)
	--- TODO: bless function in modules.lua
	if(npcHandler.focus ~= cid) then
		return FALSE
	end

	if msgcontains(msg, 'blessing') or msgcontains(msg, 'blessings') or msgcontains(msg, 'help') or msgcontains(msg, 'offer') then
		npcHandler:say("I can provide you with the Fire of Suns blessing.")
		talkState = 0
	elseif msgcontains(msg, 'the fire of suns') then
		npcHandler:say("Do you want to buy the fire of suns blessing blessing for 10000 gold?")
		talkState = 1
	elseif talkState > 0 then
		if msgcontains(msg, 'yes') then
			if getPlayerBlessing(cid, talkState) then
				npcHandler:say("A god has already blessed you with this blessing.")
			elseif isPremium(cid) == TRUE then
				if doPlayerRemoveMoney(cid, 10000) == TRUE then
					doPlayerAddBlessing(cid, talkState)
					npcHandler:say("You have been blessed by one of the five gods!")
				else
					npcHandler:say("You don't have enough money.")
				end
			else
				npcHandler:say("You need a premium account to buy blessings.")
			end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Then not.")
		end
		talkState = 0
	end
	return TRUE
end

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

Humprey
Code:
<npc name="Humphrey" script="data/npc/scripts/the embrace of tibia.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="131" head="110" body="69" legs="41" feet="91" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|." />
<parameter key="message_farewell" value="Good bye |PLAYERNAME|!" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="tools;name;offer;help" />
<parameter key="keyword_reply1" value="I sell the embrace of tibia blessing." />

</parameters>
</npc>

Code:
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

function creatureSayCallback(cid, type, msg)
	--- TODO: bless function in modules.lua
	if(npcHandler.focus ~= cid) then
		return FALSE
	end

	if msgcontains(msg, 'blessing') or msgcontains(msg, 'blessings') or msgcontains(msg, 'help') or msgcontains(msg, 'offer') then
		npcHandler:say("I can provide you with The Embrace of Tibia blessing.")
		talkState = 0
	elseif msgcontains(msg, 'The Embrace of Tibia') then
		npcHandler:say("Do you want to buy the embrace of tibia blessing for 10000 gold?")
		talkState = 3
	elseif talkState > 0 then
		if msgcontains(msg, 'yes') then
			if getPlayerBlessing(cid, talkState) then
				npcHandler:say("A god has already blessed you with this blessing.")
			elseif isPremium(cid) == TRUE then
				if doPlayerRemoveMoney(cid, 10000) == TRUE then
					doPlayerAddBlessing(cid, talkState)
					npcHandler:say("You have been blessed by one of the five gods!")
				else
					npcHandler:say("You don't have enough money.")
				end
			else
				npcHandler:say("You need a premium account to buy blessings.")
			end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Then not.")
		end
		talkState = 0
	end
	return TRUE
end

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

Kawill
Code:
<npc name="Kawill" script="data/npc/scripts/the spark of phoenix.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="131" head="110" body="69" legs="41" feet="91" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|." />
<parameter key="message_farewell" value="Good bye |PLAYERNAME|!" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="offer" />
<parameter key="keyword_reply1" value="I sell the spark of the phoenix blessing." />

</parameters>
</npc>

Code:
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)
	--- TODO: bless function in modules.lua
	if(npcHandler.focus ~= cid) then
		return FALSE
	end

	if msgcontains(msg, 'blessing') or msgcontains(msg, 'blessings') or msgcontains(msg, 'help') or msgcontains(msg, 'offer') then
		npcHandler:say("I can provide you with The Spark of the Phoenix blessing.")
		talkState = 0
	elseif msgcontains(msg, 'the spark of the phoenix') then
		npcHandler:say("Do you want to buy the spark of phoenix blessing for 10000 gold?")
		talkState = 5
	elseif talkState > 0 then
		if msgcontains(msg, 'yes') then
			if getPlayerBlessing(cid, talkState) then
				npcHandler:say("A god has already blessed you with this blessing.")
			elseif isPremium(cid) == TRUE then
				if doPlayerRemoveMoney(cid, 10000) == TRUE then
					doPlayerAddBlessing(cid, talkState)
					npcHandler:say("You have been blessed by one of the five gods!")
				else
					npcHandler:say("You don't have enough money.")
				end
			else
				npcHandler:say("You need a premium account to buy blessings.")
			end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Then not.")
		end
		talkState = 0
	end
	return TRUE
end

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

Norf
Code:
<npc name="Norf" script="data/npc/scripts/the spiritual shielding.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="57" head="110" body="69" legs="41" feet="91" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|." />
<parameter key="message_farewell" value="Good bye |PLAYERNAME|!" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="offer" />
<parameter key="keyword_reply1" value="I sell Spiritual Shielding blessing." />
</parameters>
</npc>

Code:
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

function creatureSayCallback(cid, type, msg)
	--- TODO: bless function in modules.lua
	if(npcHandler.focus ~= cid) then
		return FALSE
	end

	if msgcontains(msg, 'blessing') or msgcontains(msg, 'blessings') or msgcontains(msg, 'help') or msgcontains(msg, 'offer') then
		npcHandler:say("I can provide you with The Spiritual Shielding blessing.")
		talkState = 0
	elseif msgcontains(msg, 'the spiritual shielding') then
		npcHandler:say("Do you want to buy the spiritual shielding blessing+ for 10000 gold?")
		talkState = 2
	elseif talkState > 0 then
		if msgcontains(msg, 'yes') then
			if getPlayerBlessing(cid, talkState) then
				npcHandler:say("A god has already blessed you with this blessing.")
			elseif isPremium(cid) == TRUE then
				if doPlayerRemoveMoney(cid, 10000) == TRUE then
					doPlayerAddBlessing(cid, talkState)
					npcHandler:say("You have been blessed by one of the five gods!")
				else
					npcHandler:say("You don't have enough money.")
				end
			else
				npcHandler:say("You need a premium account to buy blessings.")
			end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Then not.")
		end
		talkState = 0
	end
	return TRUE
end

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

these npcs where scripted for theforgottenserver but i dont know if they would work for any others if you find any bugs please feel free to report them to me :]
 
It doesnt work with TFS 8.21. I wonder how to change these scripts to make it works.
 
Back
Top