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

Npc trade system directly! Rep++ Tfs: 0.3.6

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,780
Solutions
31
Reaction score
2,299
Location
Sweden?
Hello,

I need a script when you say hi, the npc trade will come directly instead saying hi, trade! Tfs: 0.3.6



Uploaded with ImageShack.us

Rep++
 
Last edited:
Go to data\npc\lib\npcsystem.lua
Find:
Code:
	-- Greeting and unGreeting keywords. For more information look at the top of modules.lua
	FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}
	FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'}

	-- The word for requesting trade window. For more information look at the top of modules.lua
	SHOP_TRADEREQUEST = {'offer', 'trade'}
Replace like this:
Code:
	-- Greeting and unGreeting keywords. For more information look at the top of modules.lua
	FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}
	FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'}

	-- The word for requesting trade window. For more information look at the top of modules.lua
	SHOP_TRADEREQUEST = {'hi', 'hello', 'hey', 'offer', 'trade'}
I think that should work :)
 
npchandler.lua
Code:
	-- Greets a new player.
	function NpcHandler:greet(cid)
		if(cid ~= 0) then
			local callback = self:getCallback(CALLBACK_GREET)
			if(callback == nil or callback(cid)) then
				if(self:processModuleCallback(CALLBACK_GREET, cid)) then
[B][COLOR="red"]					if #self.shopItems ~= 0 then
						openShopWindow(cid, self.shopItems,
							function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
								self:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
							end,
							function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
								self:onSell(cid, itemid, subType, amount, ignoreCap, inBackpacks)
							end
						)
					end[/COLOR][/B]

					local msg = self:getMessage(MESSAGE_GREET)
					local parseInfo = { [TAG_PLAYERNAME] = getCreatureName(cid) }
					msg = self:parseMessage(msg, parseInfo)

					self:say(msg)
					self:addFocus(cid)
					self:say(msg, cid)
				end
			end
		end
	end
 
Its works but the problem is the npc repeat him self!

if i say hi,

npc says: hi welcome 3x
 
[03/06/2011 11:31:53] [Error - NpcScript::onCreatureSay] NPC Name: John- Call stack overflow
 
Back
Top