• 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 Upgrade System REP++

Skitscher

New Member
Joined
Apr 7, 2009
Messages
33
Reaction score
0
I just want to ask if a upgrade system like "Give and Get" exsists...
For example you give your Leather Boots and 200gp to an NPC and you get Steel Boots :D

I rep++ for all good answers and I would love ya if you make me a complete script <3
 
Not 100% sure if this work:

Lua:
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

local otswe = {
removeitem1 = itemid1, --leather boots
removeitem2 =  itemid2, --money
prizeitem = itemid3  --steelboots
}
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	if msgcontains(msg, 'help') or msgcontains(msg, 'boots') or msgcontains(msg, 'upgrade') then
			npcHandler:say('Hello i can upgrade your boots just.', cid)
			npcHandler:say('Do you want to upgrade? {yes}.', cid)
			elseif(msgcontains(msg, 'yes')) then
			if doPlayerRemoveItem(cid, otswe.removeitem1, 1) and doPlayerRemoveItem(cid, otswe.removeitem2, 1) then
				npcHandler:say('Thank you!', cid)
				doPlayerAddItem(cid,otswe.prizeitem,1)
				focus = 0
			else
				npcHandler:say('Are you kidding me ? I dont see any money or leather boots with you! You didn\'t get them! Grrr... come back when you\'ve got them.', cid)
		end
	end
	return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
really thank you for this fast answer :p
I'll try it now if it works :D Ill hope so^^

- - - Updated - - -

OMG such nice :D Ty bro
But i have 1 question left: How i add other upgrades to this script?
 
Back
Top