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

Changing greetwords for 1 npc

Moeder

New Member
Joined
Jun 30, 2007
Messages
23
Reaction score
0
TFS 0.3.6pl1
--
I want to change the following values for making the Blind Orc, but without affecting the values for other npcs.

NPCSYSTEM.LUA
Code:
FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}
FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'}
SHOP_TRADEREQUEST = {'offer', 'trade'}
SHOP_YESWORD = {'yes'}
SHOP_NOWORD = {'no'}

How to make this, but for the Blind Orc only?

Code:
FOCUS_GREETWORDS = {'charach'}
FOCUS_FAREWELLWORDS = {'futchi', 'ikem rambo zambo'}
SHOP_TRADEREQUEST = {'goshak', 'pashak'}
SHOP_YESWORD = {'mok'}
SHOP_NOWORD = {'burp'}

I have put this code into Blind Orc.lua (NOT into npcsystem.lua), but that also affected all npcs.


Blind orc only changes I needed to make that affected npchandler.lua were -i think- successfully solved in this way:
BLIND ORC.LUA
Code:
npcHandler:setMessage(MESSAGE_GREET, "Charach, |PLAYERNAME|!")
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic, Amount, Price, Type = {}, {}, {}, {}

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)
	if msgcontains(msg, "charach") and (not npcHandler:isFocused(cid)) then
		npcHandler:say("Ikem Charach maruk.", cid, TRUE)
		npcHandler:addFocus(cid)
		Topic[cid] = 0
	elseif (not npcHandler:isFocused(cid)) then
		npcHandler:say("Buta humak!", cid, TRUE)
	elseif msgcontains(msg, "futchi") then
		npcHandler:say("Futchi.", cid, TRUE)
		npcHandler:releaseFocus(cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "ikem") and msgcontains(msg, "goshak") then
		npcHandler:say("Ikem pashak porak, bata, dora. Ba goshak maruk?", cid)
		Topic[cid], Amount[cid], Price[cid], Type[cid] = 0, 0, 0, 0
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "porak") then
		npcHandler:say("Ikem pashak charcha, burka, burka bata, hakhak. Ba goshak maruk?", cid)
		Topic[cid], Amount[cid], Price[cid], Type[cid] = 0, 0, 0, 0
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "charcha") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 25
		Type[cid] = 2385
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "burka") and msgcontains(msg, "bata") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 85
		Type[cid] = 2376
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "burka") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 30
		Type[cid] = 2406
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "hakhak") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 85
		Type[cid] = 2388
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "bata") then
		npcHandler:say("Ikem pashak aka bora, tulak bora, grofa. Ba goshak maruk?", cid)
		Topic[cid], Amount[cid], Price[cid], Type[cid] = 0, 0, 0, 0
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "tulak") and msgcontains(msg, "bora") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 90
		Type[cid] = 2484
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "bora") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 25
		Type[cid] = 2467
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "grofa") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 60
		Type[cid] = 2482
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "dora") then
		npcHandler:say("Ikem pashak donga. Ba goshak maruk?", cid)
		Topic[cid], Amount[cid], Price[cid], Type[cid] = 0, 0, 0, 0
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "donga") then
		npcHandler:say("Maruk goshak ta?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 65
		Type[cid] = 2511
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "batuk") then
		npcHandler:say("Ahhhh, maruk goshak batuk?", cid)
		Topic[cid] = 1
		Amount[cid] = 1
		Price[cid] = 400
		Type[cid] = 2456
	elseif msgcontains(msg, "goshak") and msgcontains(msg, "pixo") then
		npcHandler:say("Maruk goshak tefar pixo ul batuk?", cid)
		Topic[cid] = 1
		Amount[cid] = 10
		Price[cid] = 30
		Type[cid] = 2544
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "mok") then
			if doPlayerRemoveMoney(cid, Price[cid]) then
				npcHandler:say("Maruk rambo zambo!", cid)
				doPlayerAddItem(cid, Type[cid], Amount[cid])
			else
				npcHandler:say("Maruk nixda!", cid)
			end
		else
			npcHandler:say("Buta maruk klamuk!", cid)
		end
		Topic[cid], Amount[cid], Price[cid], Type[cid] = 0, 0, 0, 0
	elseif msgcontains(msg, "trade") then
		npcHandler:say("Uh?", cid)
		Topic[cid], Amount[cid], Price[cid], Type[cid] = 0, 0, 0, 0
	end
	return true
end

npcHandler:setMessage(MESSAGE_WALKAWAY, "Futchi.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
 
Back
Top