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

solved

tompan

Member
Joined
Dec 13, 2008
Messages
646
Reaction score
24
Location
Sweden
I need some help!! ive been trying and trying without any sleep tonight.. but it just wanna f**k with me..
so please someone help me out..
I have search for it but it dont seems to be here.

I need it to be shown at clocks...
and how to add it in npc..

in my global
Code:
function getTibiaTime()
	local worldTime = getWorldTime()
	local hours = 0
	while (worldTime > 60) do
		hours = hours + 1
		worldTime = worldTime - 60
	end

	return {hours = hours, minutes = worldTime}
end

and then i need it to be added in my Npc lua file..
Code:
-- This file contains a default npc script based on Jiddo's npc system
-- NPCs that are made only in XML can use this file as their Lua file

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

-- OTServ event handling functions start
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
-- OTServ event handling functions end

npcHandler:addModule(FocusModule:new())

Or in the xml file..

Code:
<?xml version="1.0"?>
<npc name="avar tar" script="avar.lua" walkinterval="1000" access="3" floorchange="0">
	<health now="100" max="100"/>
	<look type="73" head="0" body="0" legs="0" feet="0"/>
  <parameters>
  
    <parameter key="message_greet" value="Greetings, traveler." />
    <parameter key="message_farewell" value="It was a pleasure to help you." />
	<parameter key="message_walkaway" value="How rude!" />
	
	<parameter key="module_keywords" value="1" />
    <parameter key="keywords" value="bye;name;job;whyslftrxtcytv;king;tibianus;quest;army;ferumbras;excalibug;thais;tibia;carlin;new;rumor;" />
	<parameter key="keyword_reply1" value="See you later." />
	<parameter key="keyword_reply2" value="I am Avar Tar, slayer of monsters, saviour of princesses, and defender of the weak." />
	<parameter key="keyword_reply3" value="I am a professional hero." />
	<parameter key="keyword_reply4" value="what?" />
	<parameter key="keyword_reply5" value="I am on a quest for the Thaian king ... as usual, of course." />
	<parameter key="keyword_reply6" value="I am on a quest for the Thaian king ... as usual, of course." />
	<parameter key="keyword_reply7" value="I am on a quest for the Thaian king ... as usual, of course." />
	<parameter key="keyword_reply8" value="Where the army fails a hero like me is needed." />
	<parameter key="keyword_reply9" value="I fought him serveral times, sometimes he killed me, sometimes I killed him, I would say we are even right now, but I am getting better and more powerful each day." />
	<parameter key="keyword_reply10" value="I am sure it's hidden in a vault of the Nightmare Knights beneath the Plains of Havoc. I plan an expedition to go there and rout out the Ruthless Seven, but I have to save the world first." />
	<parameter key="keyword_reply11" value="If I had the time I would restore peace in this once proud city, but there's too much to do before I can start that quest." />
	<parameter key="keyword_reply12" value="I've seen it all and done it all ... at least twice." />
	<parameter key="keyword_reply13" value="I saved the women there once or twice." />
	<parameter key="keyword_reply14" value="There is a great evil lurking beneath this isle ... and beneath the Plains of Havoc and in the ancient necropolis and beneath the Ghostlands ... well everywhere basically." />
	<parameter key="keyword_reply15" value="There is a great evil lurking beneath this isle ... and beneath the Plains of Havoc and in the ancient necropolis and beneath the Ghostlands ... well everywhere basically." />
    

	
  </parameters>
</npc>


Thank you so much if you fix this or even try help me in directions.
 
i have the code,
Code:
if msgcontains(msg, 'time') then
selfSay('The time is ' .. getTibiaTime() .. '.')
end

But i get error while sumon npc..
Code:
data/npc/scripts/lib/npc.lua:50: bad argument #1 to 'find' (string expected, got
 nil)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/avar.lua

the line in npc.lua
Code:
function msgcontains(txt, str)
	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

Thank you for helpin!!
 
Code:
	if msgcontains(msg, 'time') then
	local time = getTibiaTime()
	npcHandler:say('It is '.. time.hours .. string.char(58) .. time.minutes ..', so you are late. Hurry!')


there you go must work;) /\ support's avesta
 
Back
Top