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

{request}changes in NPC system

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,979
Solutions
100
Reaction score
3,423
Location
Poland
GitHub
gesior
Can anyone write me what i have to change in NPC system if i want to NPC accept "yes" and "tak" as a 'yes', "no" and "nie" as a 'no'.
I have 95% of NPC texts polish and i want NPCs accept also "tak" and "nie" when someone buy/sell something.

Where can i change NPC "view" distance? I want NPCs who say 'MESSAGE_WALKAWAY' when player distance from NPC is higher than 3 (x > 3 or y > 3).
Thank you for help!
 
Where can i change NPC "view" distance? I want NPCs who say 'MESSAGE_WALKAWAY' when player distance from NPC is higher than 3 (x > 3 or y > 3).
Thank you for help!


in:

Code:
npc/lib/npcsystem/npchandler.lua

Code:
	MESSAGE_WALKAWAY 	= 10 -- When the player walks out of the talkRadius of the npc.

Code:
			[MESSAGE_WALKAWAY] 		= 'How rude!',


Can anyone write me what i have to change in NPC system if i want to NPC accept "yes" and "tak" as a 'yes', "no" and "nie" as a 'no'.
I have 95% of NPC texts polish and i want NPCs accept also "tak" and "nie" when someone buy/sell something.


in:
Code:
npc/lib/npcsystem/modules.lua


Code:
if(Modules == nil) then
	-- default words for greeting and ungreeting the npc. Should be a talbe containing all such words.
	FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}
	FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'}
	
	-- The word for accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! Should be a teble with a single string value.
	SHOP_YESWORD = {'[COLOR="lime"]yes[/COLOR]'}
	SHOP_NOWORD = {'[COLOR="lime"]no[/COLOR]'}

in:

Code:
npc/lib/npcsystem/npcsystem.lua

Code:
	-- Global npc constants:
	
	-- Keyword nestling behavior. For more information look at the top of keywordhandler.lua
	KEYWORD_BEHAVIOR = BEHAVIOR_NORMAL_EXTENDED
	
	-- 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 accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! For more information look at the top of modules.lua
	SHOP_YESWORD = {'[COLOR="lime"]yes[/COLOR]'}
	SHOP_NOWORD = {'[COLOR="Lime"]no[/COLOR]'}

Just change the green 'yes' and 'no' to 'tak' and 'nie' and it should work.

Hope I've helped you out!

Kjeld~
 
I want NPCs who accept 'yes' and 'tak' as an 'accept'. I tired
Code:
	SHOP_YESWORD = {'yes', 'tak'}
	SHOP_NOWORD = {'no', 'no'}
but it doesnt work. It really "CAN ONLY CONTAIN ONE FIELD!". Maybe someone know is it possible to change it to accept two or few fields in table (source?)?

Not "[MESSAGE_WALKAWAY] = 'How rude!'". I've change it 2 days ago :p
Its request to PROoo.. programists who know where NPCs from NPC system calculate distance from player (i cant find "getdistance..." in NPC System).
Talaturen? :)

----------------------------------------------------
EDIT:
----------------------------------------------------
I found in modules.lua
Code:
	function ShopModule:addBuyableItem(names, itemid, cost, charges, realname)
		for i, name in pairs(names) do
			local parameters = {
					itemid = itemid,
					cost = cost,
					eventType = SHOPMODULE_BUY_ITEM,
					module = self
				}
			if(realname ~= nil) then
				parameters.realname = realname
			end
			if(isItemRune(itemid) == TRUE or isItemFluidContainer(itemid) == TRUE) then
				parameters.charges = charges
			end
			keywords = {}
			table.insert(keywords, name)
			local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
			node:addChildKeywordNode(self.yesNode)
			node:addChildKeywordNode(self.noNode)
		end
	end
	
	-- Adds a new sellable item. 
	--	names = A table containing one or more strings of alternative names to this item.
	--	itemid = the itemid of the buyable item
	--	cost = the price of one single item with item id itemid ^^
	--	realname - The real, full name for the item. Will be used as ITEMNAME in MESSAGE_ONBUY and MESSAGE_ONSELL if defined. Default value is nil (keywords[2]/names will be used)
	function ShopModule:addSellableItem(names, itemid, cost, realname)
		for i, name in pairs(names) do
			local parameters = {
					itemid = itemid,
					cost = cost,
					eventType = SHOPMODULE_SELL_ITEM,
					module = self
				}
			if(realname ~= nil) then
				parameters.realname = realname
			end
			keywords = {}
			table.insert(keywords, 'sell')
			table.insert(keywords, name)
			local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
			node:addChildKeywordNode(self.yesNode)
			node:addChildKeywordNode(self.noNode)
		end
	end
Can anyone change "node:addChildKeywordNode(self.yesNode)" to code that accept "yes" and "tak"? Is it possible?
 
Last edited:
Back
Top