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

Problem with new vocations.

Ironwilln

New Member
Joined
Apr 19, 2013
Messages
4
Reaction score
0
¡Hello OTland!

I'm starting with an OT with peculiar features, but I'm stucked on a point because of an error about adding new vocations. I'll explain:

Before we start, I'll make clear that I'm using an OTX Necron 9.70 server, with an Uniserver (Last version) + Gesior2012 TFS 0.4 (rev 3703) for the page. The problem began when I tried to modify vocations from Config.php, just on ""# Create Character Options". I had already created on Vocations.xml inside my server folder some new clases, having the first of them ID 9 (before Elite Knight), called "Warrior". No error on console, so I acces to Conif.php and edit this:


"5 => 'Warrior Sample'" (Yes, I've created the character with that name and ID 9). I'll let you downhere the code from Config.php:

Code:
<?PHP
# Account Maker Config
$config['site']['serverPath'] = "(My server address, correctly)";
$config['site']['useServerConfigCache'] = false;
$config['site']['worlds'] = array(0 => 'F');
$towns_list[0] = array(1 => 'Thais', 2 => 'Venore', 5 => 'Carlin');

$config['site']['outfit_images_url'] = 'http://outfit-images.ots.me/outfit.php';
$config['site']['item_images_url'] = 'http://item-images.ots.me/960/';
$config['site']['item_images_extension'] = '.gif';
$config['site']['flag_images_url'] = 'http://flag-images.ots.me/';
$config['site']['flag_images_extension'] = '.png';

# Create Account Options
$config['site']['one_email'] = false;
$config['site']['create_account_verify_mail'] = false;
$config['site']['verify_code'] = true;
$config['site']['email_days_to_change'] = 3;
$config['site']['newaccount_premdays'] = 0;
$config['site']['send_register_email'] = false;

# Create Character Options
$config['site']['newchar_vocations'][0] = array(1 => 'Sorcerer Sample', 2 => 'Druid Sample', 3 => 'Paladin Sample', 4 => 'Knight Sample', 5 => 'Warrior Sample');
$config['site']['newchar_towns'][0] = array(1 => '1', 2 => '2');
$config['site']['max_players_per_account'] = 7;


# Emails Config
$config['site']['send_emails'] = true;
$config['site']['mail_address'] = "[email protected]";
$config['site']['smtp_enabled'] = true;
$config['site']['smtp_host'] = "mail.gmx.com";
$config['site']['smtp_port'] = 25;
$config['site']['smtp_auth'] = false;
$config['site']['smtp_user'] = "[email protected]";
$config['site']['smtp_pass'] = "xxxx";

# PAGE: whoisonline.php
$config['site']['private-servlist.com_server_id'] = 1;
/*
Server id on 'private-servlist.com' to show Players Online Chart (whoisonline.php page), set 0 to disable Chart feature.
To use this feature you must register on 'private-servlist.com' and add your server.
Format: number, 0 [disable] or higher
*/

# PAGE: characters.php
$config['site']['quests'] = array();
$config['site']['show_skills_info'] = true;
$config['site']['show_vip_storage'] = 0;

# PAGE: accountmanagement.php
$config['site']['send_mail_when_change_password'] = true;
$config['site']['send_mail_when_generate_reckey'] = true;
$config['site']['generate_new_reckey'] = false;
$config['site']['generate_new_reckey_price'] = 500;

# PAGE: guilds.php
$config['site']['guild_need_level'] = 15;
$config['site']['guild_need_pacc'] = false;
$config['site']['guild_image_size_kb'] = 50;
$config['site']['guild_description_chars_limit'] = 2000;
$config['site']['guild_description_lines_limit'] = 6;
$config['site']['guild_motd_chars_limit'] = 250;

# PAGE: adminpanel.php
$config['site']['access_admin_panel'] = 5;

# PAGE: latestnews.php
$config['site']['news_limit'] = 6;

# PAGE: killstatistics.php
$config['site']['last_deaths_limit'] = 40;

# PAGE: team.php
$config['site']['groups_support'] = array(2, 3, 4, 5, 6);

# PAGE: highscores.php
$config['site']['groups_hidden'] = array(4, 5, 6);
$config['site']['accounts_hidden'] = array(1, 2, 3);

# PAGE: shopsystem.php
$config['site']['shop_system'] = true;

# PAGE: lostaccount.php
$config['site']['email_lai_sec_interval'] = 180;

# Layout Config
$config['site']['layout'] = 'cyber';
$config['site']['vdarkborder'] = '#505050';
$config['site']['darkborder'] = '#D4C0A1';
$config['site']['lightborder'] = '#F1E0C6';
$config['site']['download_page'] = true;
$config['site']['serverinfo_page'] = true;

And, when I want to create an account on the website, I find this:

errorenvocations.jpg



Then I go to PhpMyAdmin to check that the character "Warrior Sample" still has its ID, but it's not, instead has another random ID (sometimes 5, others 8), like some kind of problem was denying the creation of any ID higher than 8, wich goes for Elite Knight.
On the other hand, I though... well, I can make that new characters starts as Rook (ID 0) and, inside the game through "The Oracle" script they get their desired vocation... but here I find another problem. Here's "The Oracle" script:



Code:
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 onPlayerEndTrade(cid)				npcHandler:onPlayerEndTrade(cid)			end
function onPlayerCloseChannel(cid)			npcHandler:onPlayerCloseChannel(cid)		end

function oracle(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local cityNode, vocationNode = node:getParent():getParent(), node:getParent()
	local params = {
		['vocation'] = vocationNode:getParameters().vocation,
		['town'] = cityNode:getParameters().town,
		['premium'] = cityNode:getParameters().premium or false,
		['items'] = vocationNode:getParameters().items or nil
	}

	if(params['town'] ~= nil and params['vocation'] ~= nil) then
		if(getPlayerLevel(cid) < parameters.level) then
			npcHandler:say('You must first reach level {' .. parameters.level .. '}!', cid)
		elseif(getPlayerVocation(cid) > 0) then
			npcHandler:say('Sorry, you already have a vocation!', cid)
		elseif(params['premium'] and not isPremium(cid)) then
			npcHandler:say('Sorry, this town is reserved only for premium players!', cid)
		else
			doPlayerSetVocation(cid, params['vocation'])
			doPlayerSetTown(cid, params['town'])
			if(params['items'] ~= nil) then
				local parcel = doCreateItemEx(2595)
				local label = doAddContainerItem(parcel, 2599)
				local target = getCreatureName(cid)

				doItemSetAttribute(label, "text", target .. "\n" .. getTownName(params['town']))
				doItemSetAttribute(label, "date", os.time())
				doItemSetAttribute(label, "writer", "The Oracle")

				for _, item in ipairs(params['items']) do
					doAddContainerItem(parcel, item[1], item[2])
				end

				doPlayerSendMailByName(target, parcel, params['town'])
			end

			local tmp, temple = getThingPosition(cid), getTownTemplePosition(params['town'])
			npcHandler:say('SO BE IT!', cid)
			doTeleportThing(cid, temple)

			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(temple, CONST_ME_TELEPORT)
			return true
		end
	else
		error('Player: ' .. getCreatureName(cid) .. ', Params: ' .. table.serialize(params))
	end

	npcHandler:resetNpc()
	return true

end

function greetCallback(cid)
	if(getPlayerLevel(cid) < 8) then
		npcHandler:say('You are not ready to talk with me yet.')
		return false
	else
		return true
	end
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to face your destiny?')

local yesNode = KeywordNode:new({'yes'}, oracle, {level = 8})
local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to become?'})

local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in? {Rhyves}, {Varak} or {Jorvik}?'})
	local node2 = node1:addChildKeyword({'varak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 1, text = 'Varak, eh? So what vocation do you wish to become? {Sorcerer}, {druid}, {paladin} or {feudal}?'})
		local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, vocation = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		node3 = node2:addChildKeyword({'feudal'}, StdModule.say, {npcHandler = npcHandler, vocation = 12, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
	node2 = node1:addChildKeyword({'rhyves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 2, premium = true, text = 'Rhyves, eh? So what vocation do you wish to become? {Sorcerer}, {druid}, {paladin} or {feudal}?'})
		node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, vocation = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)
		node3 = node2:addChildKeyword({'feudal'}, StdModule.say, {npcHandler = npcHandler, vocation = 12, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? 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())

The script works fine, he makes me a "warrior" and send me to the chosen city but when I logout and enter again, automatically it changes my vocation to Elite Knight, furthermore on the page it changes it to Knight (not even Elite haha)

I tried to search for the error on many files, but in vain, so I'll be really pleased if someone could give me a solution :). To sum up : I'd like someone who knows about this stuff, please, gives me a solution to this problem both the page and the database. I think is more related to database, but I barely know what database means (just kidding, I mean that I'm quite new to this)

If you need any further information, I'll be glad to give it to you. I think I explain good enough, right? haha I tried to give my best since I'm Spanish, so don't criticize my English... please? :)


Well, thanks for everything!

P.S.: If you find in any place inside the script something like "Feudal" instead of "Warrior" is because I've been trying changing many vocations. None gave results.
 
Website: you must edit your temps.

The script works fine, he makes me a "warrior" and send me to the chosen city but when I logout and enter again, automatically it changes my vocation to Elite Knight, furthermore on the page it changes it to Knight (not even Elite haha)

vocations.xml -> fromvoc must be the same as your voc id
ex: knight id = 4, fromvoc = 4
ex: elite knight id = 8, fromvoc = 4 <- becouse ek "evolves" from knight with id 4
ex new profession:
warrior id = 12, fromvoc = 12
deadly warrior id = 16, fromvoc = 12

to avoid some bugs you should use:
for melee champs id should be x*4
for mages x*4+1 or x*4+2
ranged x*4+3

1 - mage
2 - mage
3 - ranged
4 - melee
5 - mage
6 - mage
7 - ranged
8 - melee
9 - mage
etc.

This will let you avoid magiclevel bug what sometimes occurs when you change mlevel via conditions and/or database
 
Last edited:
Andu, thanks. That was the stupid problem haha. Its curious how the most little things can turn to be the biggers! Thanks again! ^^ And I'll consider your advice =].

This thread can be closed.
 
Back
Top