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

Simple NPC, answer to keyword "amulet of loss"

Hellrage

Worr
Joined
Oct 30, 2007
Messages
2,477
Reaction score
5
Location
Sweden
Hello. I have made a custom NPC that sells runes, items etc for my pvp-e war server. I have changed so itemloss upon death is always 0% which means people dont need aol. But incase someone missed that, I want my npc to respond

"text"
to keywords

'amulet of loss', 'aol'

This is what the NPC looks like:

supplies.xml
Code:
<!-- This is an example NPC that can be used on Jiddo's NPC system -->
<!-- It is not in an in-game spawn -->

<!-- This is an example NPC that sells runes and uses parameter callbacks -->
<npc name="Seller" script="supplies.lua" autowalk="25">
	<health now="150" max="150"/>
	<look type="130" head="39" body="122" legs="125" feet="57" corpse="2212"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to buy anything?" />
		<parameter key="message_needmoremoney" value="You do not have enough money." />
		<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!" />
	</parameters>
</npc>

supplies.lua
Lua:
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

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'tempest rod', 'tempest'}, 2183, 0, 'tempest rod')
shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 0, 'wand of inferno')

shopModule:addBuyableItem({'ultimate healing', 'uh'}, 						2274, 0, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 							2268, 0, 2, 'sudden death rune')
shopModule:addBuyableItem({'mana fluid', 'manafluid', 'mf'}, 				2006, 0, 7, 'mana fluid')
shopModule:addBuyableItem({'magic wall', 'mw'}, 							2293, 0, 4, 'magic wall rune')

shopModule:addBuyableItem({'fire bomb rune', 'fire bomb'}, 					2305, 0, 3,	'fire bomb rune')
shopModule:addBuyableItem({'energy bomb'}, 									2262, 0, 3,	'energy bomb rune')
shopModule:addBuyableItem({'poison bomb'}, 									2286, 0, 3,	'poison bomb rune')

shopModule:addBuyableItem({'destroy field', 'destroy field rune', 'df'}, 	2261, 0, 3, 'destroy field rune')
shopModule:addBuyableItem({'desintegrate rune', 'desintegrate'}, 			2310, 0, 3, 'desintegrate rune')

shopModule:addBuyableItem({'great fireball rune', 'great fireball', 'gfb'}, 2304, 0, 2, 'great fireball rune')
shopModule:addBuyableItem({'explosion rune', 'explosion', 'explo'}, 		2313, 0, 3, 'explosion rune')

shopModule:addBuyableItem({'blank', 'rune'}, 								2260, 0, 	'blank rune')

shopModule:addBuyableItem({'rope'}, 										2120, 0, 	'rope')
shopModule:addBuyableItem({'shovel'}, 										2554, 0, 	'shovel')
shopModule:addBuyableItem({'machete'}, 										2420, 0, 	'rope')

shopModule:addBuyableItem({'crossbow'}, 									2455, 0, 	'crossbow')
shopModule:addBuyableItem({'bow'}, 											2456, 0, 	'bow')

shopModule:addBuyableItem({'time ring'}, 									2169, 0, 	'time ring')
shopModule:addBuyableItem({'energy ring'}, 									2167, 0, 	'energy ring')
shopModule:addBuyableItem({'ring of healing'}, 								2214, 0, 	'ring of healing')

shopModule:addBuyableItem({'brown mushroom', 'mushroom'}, 					2789, 0, 	'brown mushroom')

shopModule:addBuyableItem({'bolt'}, 										2543, 0, 	'bolt')
shopModule:addBuyableItem({'burst arrow'}, 								 	2546, 0, 	'burst arrow')

shopModule:addBuyableItem({'backpack'}, 									1988, 0, 	'backpack')
shopModule:addBuyableItem({'bag'}, 											1987, 0, 	'bag')

shopModule:addBuyableItem({'demon shield', 'shield'}, 						2520, 0, 	'demon shield')

npcHandler:addModule(FocusModule:new())

Can someone help me with this?
 
Add this in the .lua file:
Lua:
keywordHandler:addKeyword({'amulet of loss', 'aol'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "text"})
 
Add in supplies.xml:
PHP:
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="aol;amulet of loss" />
        <parameter key="keyword_reply1" value="AOL is good idea! When you die you didnt lose item" />
        <parameter key="keyword_reply2" value="AOL is good idea! When you die you didnt lose item" />
 
Back
Top