• 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 Towncryer

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Here's my npc Towncryer. He alerts you when a mini-world change is running.

The NPC recognizes when a mini-world change is running if the storage for that mini-world change is > 0.

data/npc/Towncryer.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Towncryer" script="towncryer.lua" walkinterval="3000" floorchange="0">
	<health now="100" max="100"/>
	<look type="131" head="95" body="86" legs="0" feet="114" addons="1"/>
	
	<interaction range="3" idletime="60">
		<interact keywords="hi" focus="1">
			<keywords>hello</keywords>

			<response text="Sorry, I'm busy.">
				<action name="idle" value="1"/>
			</response>
		</interact>
	</interaction>
</npc>

data/npc/scripts/towncryer.lua
Lua:
local messages =
{
	--[id] = {storage = x, message = ""}
	[1] = {storage = 61250, message = "Hear me! Hear me! The mage Wyrdin in the Edron academy is looking for brave adventurers to undertake a task!"},
	[2] = {storage = 61251, message = "Hear me! Hear me! The postmaster's guild has open spots for aspiring postmen! Contact Kevin Postner at the post office in the plains south of Kazordoon!"},
	[3] = {storage = 61252, message = "Hear me! Hear me! The inquisition is looking for daring people to fight evil! Apply at the inquisition headquarters next to the Thaian jail!"},
	[4] = {storage = 61253, message = "Hear me! Hear me! Stand and deliver! That's what they shout, robbing banks in main's coastal towns and then hide out. Catch the thieves and make us proud, bring back the gold to please the crowd!"},
	[5] = {storage = 61254, message = "Hear me! Hear me! A river is flooding, south of the outlaw base. Explore a new isle, an unknown place. Don't be afraid, but ready your blade."},
	[6] = {storage = 61255, message = "Hear me! Hear me! The volcano on Goroma is spitting fire. Creatures are spawning, strong and dire. Lava is heading up the land. Adventurer, be careful or it will be your last stand!"},
	[7] = {storage = 61256, message = "Hear me! Hear me! It is Kingsday, people, let us celebrate and sing! Decorate Thais and let the bells ring! Come to the arena to hear the swords cling. Let us rejoice! Hail to the King!"},
	[8] = {storage = 61257, message = "Hear me! Hear me! North of the Queen's town, the royal trees are cut down. Will you deal with the suspect or report such kind of disrespect?"},
	[9] = {storage = 61258, message = "Hear me! Hear me! Noodles is gone, the King in despair! Find the little rascal, look everywhere. Bring him back to get rewarded for your care!"},
	[10] = {storage = 61259, message = "Hear me! Hear me! Ankrahmun's desert is the nomads' land. Find their camp in the golden sand, and a treasure may be close at hand!"},
	[11] = {storage = 61260, message = "Hear me! Hear me! What a lucky and beautiful day! Visit Carlin, Ankrahmun, or Liberty Bay. Yasir, the oriental trader might be there. Gather your creature products, for this chance is rare."},
	[12] = {storage = 61261, message = "Hear me! Hear me! In Zao Steppe the river runs deep. If you catch a strange fish it is yours to keep."},
	[13] = {storage = 61262, message = "Hear me! Hear me! Tiquanda's elephants are terrified, the Ape God's footsteps are a scary sight. So hunt for theirs tusks while they are filled with fright!"},
	[14] = {storage = 61263, message = "Hear me! Hear me! Mammoths silently watch as the snow melts away. It reveals special flowers which are not meant to stay. Grow their seeds to brighten up your day!"},
	[15] = {storage = 61264, message = "Hear me! Hear me! The witch Wyda seems to be bored. Pay her a visit but sharpen your sword. She might come up with a terrible surprise, are you brave enough to believe your eyes?"}
}

local int = 0
function onThink(interval)
	int = int + 1
	if int >= math.random(20, 40) then
		local random = math.random(1, #messages)
		if getStorage(messages[random].storage) > 0 then
			doCreatureSay(getNpcCid(), messages[random].message, TALKTYPE_SAY)
		end
		int = 0
	end
	return true		
end
 
Back
Top