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

Optional Greeting Messages

SunMage

New Member
Joined
Jun 1, 2013
Messages
58
Reaction score
4
So, to be more clear on what I'm wanting to do here is optional words for greeting a specific NPC, one that comes to mind is King Tibianus.
You're supposed to say "Hail king", "Hail tibianus" or something in that direction to greet him (to be able to talk with him basically).

Here is a parameter for when you have greeted the NPC.
PHP:
<parameter key="message_greet" value="I greet thee, my loyal subject." />

But what is the parameter key for making optional greeting messages?
I've tried to search in library for a key that works, but none that I have found.
I'm using the latest TFS.


This is what it should look like in-game:

Code:
[B]Player:[/B] hail king
[B]King Tibianus:[/B] I greet thee, my loyal subject.

or

Code:
[B]Player:[/B] hail tibianus
[B]King Tibianus:[/B] I greet thee, my loyal subject.

Note: You should not be able to say 'hi' or 'hello' or the normal greet words.


I know it's in the .lua files but... I can't seem to decrypt the locals to make a custom one in the .lua files :/



________________________________________________________________________________________________________________
EDIT:
PHP:
keywordHandler:addKeyword({'hail king'}, StdModule.greetPlayer, {npcHandler = npcHandler, onlyFocus = true, text = 'I greet thee, my loyal subject.'})

That's the best I can honestly think of to work, but it doesn't work :/
 
Last edited:
http://otland.net/search.php?do=finduser&userid=2928&contenttype=vBForum_Post&showposts=1

This? Not really sure what i'm looking for here, would be 100x easier if you'd direct me where.
thx <3





__________________________________________
EDIT:

Possibly found what you were referring to, and I created

PHP:
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "hail king") and (not npcHandler:isFocused(cid)) then
npcHandler:addFocus(cid)
npcHandler:say("I greet thee, my loyal subject.", cid, TRUE)
talkState[talkUser] = 1
end
end

Still doesn't work.
 
Last edited:
Jesus christ.. Oh alright. ^^
You don't have to make the whole script by the way.
Just tell me what functions to use and i'll handle the rest.
But if you feel like it, do it all man.
Appreciated, thanks <3
 
Just make it without npcHandler:addModule(FocusModule:new()) and add focus after saying the words you want.
Like this (second version).
http://otland.net/f83/quest-missions-185514/

Next time, post in Support

Well, this helped, now it works.
Only problem is that I can not really set my foot on what I'm doing.
I need to know exactly what i'm doing then i'd feel more comfy.
I am semi-noob in .lua :/

Thanks anyway for your help <3



>> STILL LOOKING FOR MORE HELP ON THIS TOPIC!
 
You need to do something like this
Lua:
if not npcHandler:isFocused(cid) then
	if msgcontains(msg, 'hail king') then
		selfSay("I greet thee, my loyal subject.", cid)
		npcHandler:addFocus(cid)
	else
		return false
	end
end

Try to explain what you don't understand.
 
Last edited:
When I removed
PHP:
npcHandler:addModule(FocusModule:new())

You were right, the hi/bye functions didn't work and I put together this:

PHP:
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
 		  if msgcontains(msg, 'hail king') then
		  npcHandler:addFocus(cid)
		  	selfSay('I greet thee, my loyal {subject}.', cid)
			talkState[talkUser] = 0
		end
	end

if npcHandler:isFocused(cid) then
     if msgcontains(msg, 'bye') then
	     npcHandler:say("Good bye!", cid)
	      npcHandler:releaseFocus(cid)
         end
 	end
end

Now "hail king" greets him and "bye" farewells him, only problem I've experienced now is that
PHP:
|PLAYERNAME|
Does not work. Maybe it has something to do with the removal of npcHandler:addModule(FocusModule:new()) .

I want him to say the players name in the good bye.

Code:
[B]Player:[/B] hail king  /  hail the king  / hail tibianus
[B]King Tibianus:[/B] I greet thee, my loyal {subject}.

[B]Player:[/B] bye  / goodbye  /  farewell
[B]King Tibianus[/B]: Good bye, |PLAYERNAME|!

That is exactly how I want it.
What is TalkState and how do I use it properly?
 
use getCreatureName(cid) rather than |PLAYERNAME|

But if I do it like this

PHP:
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
           if msgcontains(msg, 'hail king') then
          npcHandler:addFocus(cid)
              selfSay('I greet thee, my loyal {subject}.', cid)
            talkState[talkUser] = 0
        end
    end

if npcHandler:isFocused(cid) then
     if msgcontains(msg, 'bye') then
         npcHandler:say("Good bye, getCreatureName(cid)!", cid)
          npcHandler:releaseFocus(cid)
         end
     end
end

It won't work right?

Only thing I could think of is doing this but i'm sure that won't work either.

PHP:
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
           if msgcontains(msg, 'hail king') then
          npcHandler:addFocus(cid)
              selfSay('I greet thee, my loyal {subject}.', cid)
            talkState[talkUser] = 0
        end
    end

if npcHandler:isFocused(cid) then
     if msgcontains(msg, 'bye') then
         npcHandler:say("Good bye, "..getCreatureName(cid)."!", cid)
          npcHandler:releaseFocus(cid)
         end
     end
end
 
small error at the bottom change this
Lua:
if npcHandler:isFocused(cid) then
     if msgcontains(msg, 'bye') then
         npcHandler:say("Good bye, "..getCreatureName(cid)."!", cid)
          npcHandler:releaseFocus(cid)
         end
     end
end
to this period missing after getCreatureName(cid)
Lua:
if npcHandler:isFocused(cid) then
     if msgcontains(msg, 'bye') then
         npcHandler:say("Good bye, "..getCreatureName(cid).."!", cid)
          npcHandler:releaseFocus(cid)
         end
     end
end

and that will work just fine, not as fun to put that in the middle of a message, but it will do exactly what you need it to.
 
So I was right. Well it was just a guess.
I haven't tested it yet but if you say it works, it probably works.

Thanks.
 
Back
Top