• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Reputation Exchanger

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671

Reputation Exchanger
Made by Fresh , fixes: Lycefur
Required script : http://otland.net/f82/reputation-killing-monsters-players-47993/

What the NPC do ?
- It exchange the reputation points !reputation for items :thumbup:

data/npc/ Reputation Exchanger.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reputation Exchanger" script="data/npc/scripts/repitems.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150"/>
	<look type="255" head="78" body="114" legs="114" feet="114" corpse="0"/>
	<parameters>
		<parameter key="message_greet" value="Welcome |PLAYERNAME|. I can change your {reputation}(honor) for miscellanious {items}."/>
		<parameter key="message_walkaway" value="I hope to see you soon, hero!" />
		<parameter key="module_keywords" value="1" />
		<parameter key="keywords" value="items;reputation" />
		<parameter key="keyword_reply1" value="Check my offer: {elethriel's elemental bow} for {350 pkt}, {great shield} for {500 pkt} and {spellbook of lost souls} for {300 pkt}. If you want exchange reputation, just say item name!" />
		<parameter key="keyword_reply2" value="You can gain reputation from killing monsters and pkers." />
	</parameters>
</npc>

data/npc/scripts/ repitems.lua
PHP:
local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 
local Topic = {} 

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 greetCallback(cid)
	Topic[cid] = 0
	return true
end

function creatureSayCallback(cid, type, msg) 
	if not npcHandler:isFocused(cid) then 
		return false 
	elseif msgcontains(msg, 'elethriel elemental bow') or msgcontains(msg, 'elethriel\'s elemental bow') or msgcontains(msg, 'elethriels elemental bow') then 
		selfSay('Do you want change 350 reputation points for elethriel\'s elemental bow?', cid) 
		Topic[cid] = 1 
	elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then 
		if getPlayerStorageValue(cid, 666) >= 350 then
		setPlayerStorageValue(cid, 666, getPlayerStorageValue(cid,666)-350)
			doPlayerAddItem(cid, 8858, 1)
			selfSay('Here you are.', cid)
		else
			selfSay('You don\'t have required reputation points.', cid)
		end
	elseif msgcontains(msg, 'great shield') then
		selfSay('Do you want to change 500 reputation points for great shield?', cid)
		Topic[cid] = 2
	elseif msgcontains(msg, 'yes') and Topic[cid] == 2 then
		if getPlayerStorageValue(cid, 666) >= 500 then
			setPlayerStorageValue(cid, 666, getPlayerStorageValue(cid,666)-500)
			doPlayerAddItem(cid, 2522, 1)
			selfSay('Here you are.', cid)
		else
			selfSay('You don\'t have required reputation points.', cid)
		end
		Topic[cid] = 0
	elseif msgcontains(msg, 'spellbook of lost souls') then
		selfSay('Do you want change 300 reputation points for spellbook of lost souls?', cid)
		Topic[cid] = 3
	elseif msgcontains(msg, 'yes') and Topic[cid] == 3 then
		if getPlayerStorageValue(cid, 666) >= 300 then
			setPlayerStorageValue(cid, 666, getPlayerStorageValue(cid,666)-300)
			doPlayerAddItem(cid, 8903, 1)
			selfSay('Here you are.', cid)
		else
			selfSay('You don\'t have required reputation points.', cid)
		end
		Topic[cid] = 0
	elseif msgcontains(msg, 'no') and Topic[cid] > 0 then
		Topic[cid] = 0
		selfSay('Ok than...', cid)
	end
	return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())


You can change required points of reputation in this line:
if getPlayerStorageValue(cid, 666) >= 300 then
>= 300 - requires at least 300 reputations points for item.



Hope you like it & found appliance for Gain reputation by killing monsters and players script.

Regards,
Fresh & Lycefur.
:peace:​
 
Last edited:
Back
Top