• 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

vejsa

Banned User
Joined
Nov 3, 2007
Messages
434
Reaction score
0
Hello OTlanders.. I did not know where do do this request so I made it here in support (Its a kind of support prob)

So here is the case:
Im making a quest that involves Firewalking boots.. So what I'v done so far is that I have added a quest that contains an Item that has something to do with fire..
(That is the first part in the quest)

The second part is some kind of boots quest.. <- That is not what I need help with..
The thing I need help with is an NPC that will "Craft" the boots for you..

Example:
You need to bring him the "Item that has something to do with fire"..
Next thing you need to bring is the boots..
Then he will ask you: Do you have the required level do to this quest. In this case its 150.

NOTE: If the player is not the required level he says something like: "You are not the required level. Get lost!" Or what ever
When the players have given him the required items for the quest he acceptes them (ofcours).. after the npc has taken away the boots and the "fire item" the player will recive their firewalking boots.. (Only if they are level 150 or higher)

If this is possible to make.. Then please help me out here.. Im kind of stuck at this part.

Thanks in advance'd

Peace out =)
 
Just change the values of the items and text that the npc says as you see fit.

bootmaker.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	firerelated = xxxx --1 of the required items
	bootneeded = xxxx --1 of the required items
	newboots = xxxx --the reward or w/e
	
	if(msgcontains(msg, 'boots') or msgcontains(msg, 'quest')) then
		selfSay('I need you to bring me an item related to fire and boots, do you have them?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if getPlayerLevel(cid) >= 150 then
			if doPlayerRemoveItem(cid, firerelated, 1) == TRUE and doPlayerRemoveItem(cid, bootdeeded, 1) == TRUE then
				selfSay('Here take these new boots!', cid)
                                doPlayerAddItem(cid, newboots, 1)
			else
				selfSay('You do not have the required items.', cid)
			end
		else
			selfSay('You need level 150.', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end

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


Boot Crafter.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Boot Crafter" script="craftboot.lua" walkinterval="0" floorchange="0">
	<health now="100" max="100"/>
	<look type="128" head="20" body="100" legs="50" feet="99" corpse="2212"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you need some {boots}?"/>
	</parameters>
</npc>


Haven't tested and I'm terrible at npcs but I think it should work out I suppose we will find out tho xD
 
thanks for the replay.. but it aint working.. the npc takes away the fire item, but not the boots.. also it dont give me the firewalking boots
 
here, Luvin~ was close.. but he had a spelling error;

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	firerelated = xxxx --1 of the required items
	bootneeded = xxxx --1 of the required items
	newboots = xxxx --the reward or w/e
	
	if(msgcontains(msg, 'boots') or msgcontains(msg, 'quest')) then
		selfSay('I need you to bring me an item related to fire and boots, do you have them?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if getPlayerLevel(cid) >= 150 then
			if doPlayerRemoveItem(cid, firerelated, 1) == TRUE and doPlayerRemoveItem(cid, bootneeded, 1) == TRUE then
				selfSay('Here take these new boots!', cid)
                                doPlayerAddItem(cid, newboots, 1)
			else
				selfSay('You do not have the required items.', cid)
			end
		else
			selfSay('You need level 150.', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top