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

Sub-Class System Npc

luigilc

Lua Learner
Joined
Mar 24, 2010
Messages
863
Reaction score
36
Location
A music box
A few days ago in the support board Darkhaos came up with this script for a sub-class system npc, but I have no clue how to edit to make it work properly, what it should do is: When I have X vocation I can choose which 'sub-class' I want.
Here is the script he posted(with my edited vocations):
Lua:
local vocations = 
{
	--[Apprentice] = {Mage, Ranger, Warrior}
	[0] = {1, 2, 3}
	
	-----[Mage Sub-Classes]-----
	
	--[Mage] = {Elementalist, Wizard}
	[1] = {4, 5},
	--[Elementalist] = {Pyromancer, Stormcaller}
	[4] = {10, 11},
	--[Wizard] = {warlock, necromancer}
	[5] = {12, 13},
	--[Pyromancer] = {Fiery lord, pyro maniac}
	[10] = {22, 23},
	--[Stormcaller] = {Arcano, Cold Conjurer}
	[11] = {24, 25}
	--[Warlock] = {Archwizard, Overlord}
	[10] = {26, 27},
	--[Necromancer] = {Cultist, Lich}
	[11] = {248, 29}
 
    -----[Ranger Sub-Classes]-----
	
	--[Ranger] = {Archer, Outlaw}
	[2] = {6, 7},
	--[Archer] = {Shooter, Lancer}
	[6] = {14, 15},
	--[Outlaw] = {rogue, bard}
	[7] = {16, 17},
	--[Shooter] = {Sharpshooter, Tactician}
	[14] = {30, 31},
	--[Lancer] = {Hunter, Saboteur}
	[15] = {32, 33}
	--[Rogue] = {Assassin, Nightblader}
	[16] = {34, 35},
	--[Bard] = {Composer, Orchestral Maestro}
	[17] = {36, 37}
	
    -----[Warrior Sub-Classes]-----
	
	--[Warrior] = {Sentinel, Warlord}
	[3] = {8, 9},
	--[Sentinel] = {Champion, Inquisitor}
	[8] = {18, 19},
	--[Warlord] = {blader, barbarian}
	[9] = {20, 21},
	--[Champion] = {Paragon, Guardian}
	[18] = {38, 39},
	--[Inquisitor] = {Templar, Justicar}
	[19] = {40, 41}
	--[Blader] = {Blade Dancer, Blade Conjurer}
	[20] = {42, 43},
	--[Barbarian] = {Void Knight, Avenger}
	[21] = {44, 45}
}
 
if msg:lower() == "promotion" then
	if not vocations[getPlayerVocation(cid)] and getPlayerVocation(cid) > 0 then
		return npcHandler:say("You already have the highest promotion.", cid)
	end
 
	local vocs = vocations[getPlayerVocation(cid)]
	local sep = ", "
	local i = 0
	local text = ""
	for _, id in pairs(vocs) do
		i = i + 1
		if i == #vocs - 1 then
			sep = " and "
		elseif i == #vocs then
			sep = "."
		end
		text = text .. "{" .. getVocationInfo(id).name .. "}" .. sep
	end
	npcHandler:say("You can choose " .. (#vocs > 1 and "one between" or "") .. " the following promotion" .. (#vocs > 1 and "s" or "") .. ": " .. text .. ". Wich will you select?", cid)
	talkState[talkUser] = 1
elseif --blablabla
If anyone can make the full script I'll appreciatte it big time, thanks!
 
I use something like this;

Code:
    -- Hellgate Key
    keywordHandler:addKeyword({"key"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, Count = 1, Price = 5000, Type = 2089, ActionId = 3012, Amount = 1, npcHandler = npcHandler, text = "If you are that curious, do you want to buy a key for |P| gold? Don't blame me if you get sucked in.", setTopic = 1})
    keywordHandler:addKeyword({"key"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, Count = 2, setTopic = 1, Price = 5000, Type = 2089, ActionId = 3012, text = "If you are that curious, do you want to buy |A| keys for |P| gold? Don't blame me if you get sucked in."})
    
    keywordHandler:addKeyword({"yes"}, StdModule.say, {npcHandler = npcHandler, getTopic = 1, onlyFocus = true, CountMoney = 1, DeleteMoney = 1, text = "Here you are.", Create = 1})
    keywordHandler:addKeyword({"yes"}, StdModule.say, {npcHandler = npcHandler, getTopic = 1, onlyFocus = true, text = "Come back when you have enough money."})
    keywordHandler:addKeyword({""}, StdModule.say, {npcHandler = npcHandler, getTopic = 1, onlyFocus = true, text = "Believe me, it's better for you that way."})
    
    -- Spell Offer
    keywordHandler:addKeyword({"light magic missile"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, OnlyDruid = true, setTopic = 2, text = "Do you want to buy the spell 'Light Magic Missile' for |P| gold?", Type = "light magic missile", Price = 500, Level = 10})
 
Back
Top Bottom