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

account manager (adding new voc)

Swiff

Member
Joined
Apr 6, 2009
Messages
366
Reaction score
12
Location
Sweden
So, I've checked the config, I've checked the acc manager in my database, and I've even tried to make an npc who will give out a single vocation. But I'm failing hard here, the closest I got was:

HTML:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
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 oracle(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local cityNode = node:getParent():getParent()
	local vocNode = node:getParent()
 
	local destination = cityNode:getParameters().destination
	local town = cityNode:getParameters().town
	local vocation = vocNode:getParameters().vocation
 
	if(destination ~= nil and vocation ~= nil and town ~= nil) then
		if(getPlayerLevel(cid) < parameters.level) then
			npcHandler:say('You must first reach level ' .. parameters.level .. '!', cid)
			npcHandler:resetNpc()
		else
			if(getPlayerVocation(cid) > 0) then
				npcHandler:say('Sorry, You already have a vocation!')
				npcHandler:resetNpc()
			else
				doPlayerSetVocation(cid, vocation)
				doPlayerSetTown(cid, town)
				npcHandler:resetNpc()
 
				local tmp = getCreaturePosition(cid)
				doTeleportThing(cid, destination)
				doSendMagicEffect(tmp, CONST_ME_POFF)
				doSendMagicEffect(destination, CONST_ME_TELEPORT)
			end
		end
	end
 
	return true
end
 
function greetCallback(cid)
	if(getPlayerLevel(cid) < 8) then
		npcHandler:say('You need to be stronger!')
		return false
	else
		return true
	end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to be a Merchant?')
 
local yesNode = KeywordNode:new({'yes'}, oracle, {level = 8})
local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Your loss!'})
 
local node1 = keywordHandler:addKeyword({'yes'}, oracle, {level = 8}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in? {Wild}?'})
	local node2 = node1:addChildKeyword({'wild'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 1, destination = {x=68, y=44, z=7}, text = 'Wild, eh?'})
		local node3 = node2:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, vocation = 17, onlyFocus = true, text = 'A gold maker in living flesh and blood, are you sure? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
 
keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then come back when you are ready.'})
 
npcHandler:addModule(FocusModule:new())

This one won't respond to "yes"
I found it when searching for this type of npc, but seemingly it was never finished. I tried to do some myself but, I have very little idea what i can edit and not without screwing things up, so ofc I screw it up :)

What I wanted from the beginning was adding the choice to the in-game acc manager I have now, and later to my webpage (but that won't be for a week or so).

I couldn't find where to edit this manager using TFS 0.3.6pl1. I'd just like to add a little small line like:
ifPlayerSay"merchant"
dosendplayermessage"are you sure?"
Ifplayersay"yes"
doSetPlayervocation = 17
else
dosenplayermessage"that is not an option"

along with the lines of the 4 other basic vocations.. How hard can it be >.<

Some help would be very appriciated:)
 
Back
Top