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

Script to Change Vocation by command - item needed

Mikolaj

Banned User
Joined
Jun 11, 2010
Messages
92
Reaction score
2
Hello there!

I am looking for a script that can change vocation of player when using a command and the person must have the needed item to do that. The item of course dissapears after changing vocation.

Ok so here it goes...

the command for change vocation should be !changevoc (here for example druid, sorcerer, knight or paladin --- THERE SHOULD BE NO ROYAL PALADIN, ELITE...., ELDER..... AND MASTER....!!!!!!!!)

so, example !changevoc druid

oke, next thing:
the item that you need to have on you or in your bp must be the item with id 8982 which is norseman doll...

it would be even better if to use this command you would need minimum 100 lvl!!!!

Say for example there is 200 lvl MASTER SORCERER.... he wants to change to knight, right?

he gets the item, writes !changevoc knight....

magic level must always be reseted to 2!!! No matter to what vocation you are changing!

All the skills (sword, fishing, club, axe, fist, shielding) must be restarted to 10...

The level must be 35 lower... SO if 200 ek changes to paladin, his level will be 165... same with other vocations etc...

another example is if 135 Master sorcerer changes to druid, he will have 100 level.

VERY IMPORTANT NOTE:
command must change to a vocation without a promotion... The person will have to buy promotion again...


I would appreciate if someone could make this script for me... I really need it :(

ALSO explain me where should I put this scripts... and i heard that i willl need to add something to PHP <--- please tell me how and what to add....
 
;)

I wrote something, but I have to tell you that it is only a newbie work! Don't expect to much... I didn't get a chance to try it out, so please let me know if anything is wrong.
Lua:
-----------------------CONFIG---START-----------------------------------------
local config = {
	removelevel = 35, -- Amount of level taken away.
	itemid = 8982, -- Item ID.
	efekt = 2, -- Effect shown.
	skilafter = 10, -- What skill will the player have after change.
	minimumlevel = 100, -- What will be min level required? 
	magafter = 2 -- What magic level will he recive after change? 
}
-----------------------CONFIG---END-------------------------------------------

function onSay(cid, words, param)

if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must say what vocation you want change to.")
		return TRUE
    end
------------------------------------------------------------------------------------------------------------------------------------------	
	if(param == "sorcerer") then
		if getPlayerLevel(cid) >= config.minimumlevel then
			if getPlayerVocation(cid) > 1 then
				if getPlayerItemCount(cid, config.itemid) >= 1 then
				doPlayerRemoveItem(cid, config.itemid, 1)
				doPlayerSetVocation(cid, 1) -- Sorc
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 0)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 1)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 2)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 3)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 4)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 5)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 6)-config.skilafter))
				doPlayerAddMagLevel(cid, - ((getPlayerMagLevel(cid)) - config.magafter))
				doSendMagicEffect(getCreaturePosition(cid), config.efekt)
				doPlayerAddLevel(cid, -(config.removelevel))
				setCreatureMaxHealth(cid, (185+(5*((getPlayerLevel(cid)-8)))))
				doCreatureAddHealth(cid, -((getCreatureHealth(cid))-100))
				setCreatureMaxMana(cid, (35+(25*((getPlayerLevel(cid)-8)))))
				doCreatureAddMana(cid, -((getCreatureMana(cid))-100))
				doPlayerSetMaxCapacity(cid, (470+(10*((getPlayerLevel(cid)-8)))))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to sorcerer.")
				else doPlayerSendCancel(cid, "You don't have "..(getItemNameById(config.itemid))..".")
				end
			else doPlayerSendCancel(cid, "You are already a sorcerer.")
			end	
		else doPlayerSendCancel(cid, "Your level is to low. You need to be "..(config.minimumlevel).." level or higher.")
		end
		return TRUE
	end
------------------------------------------------------------------------------------------------------------------------------------------	
	if(param == "druid") then
		if getPlayerLevel(cid) >= config.minimumlevel then
			if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) > 2 then
				if getPlayerItemCount(cid, config.itemid) >= 1 then
				doPlayerRemoveItem(cid, config.itemid, 1)
				doPlayerSetVocation(cid, 2) -- Druid
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 0)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 1)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 2)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 3)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 4)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 5)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 6)-config.skilafter))
				doPlayerAddMagLevel(cid, - ((getPlayerMagLevel(cid)) - config.magafter))
				doSendMagicEffect(getCreaturePosition(cid), config.efekt)
				doPlayerAddLevel(cid, -(config.removelevel))
				setCreatureMaxHealth(cid, (185+(5*((getPlayerLevel(cid)-8)))))
				doCreatureAddHealth(cid, -((getCreatureHealth(cid))-100))
				setCreatureMaxMana(cid, (35+(25*((getPlayerLevel(cid)-8)))))
				doPlayerSetMaxCapacity(cid, (470+(10*((getPlayerLevel(cid)-8)))))				
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to druid.")	
				else doPlayerSendCancel(cid, "You don't have "..(getItemNameById(config.itemid))..".")
				end
			else doPlayerSendCancel(cid, "You are already a druid.")
			end	
		else doPlayerSendCancel(cid, "Your level is to low. You need to be "..(config.minimumlevel).." level or higher.")
		end
		return TRUE
		end
------------------------------------------------------------------------------------------------------------------------------------------	
	if(param == "paladin") then
		if getPlayerLevel(cid) >= config.minimumlevel then
			if getPlayerVocation(cid) < 3 or getPlayerVocation(cid) > 3 then
				if getPlayerItemCount(cid, config.itemid) >= 1 then
				doPlayerRemoveItem(cid, config.itemid, 1)
				doPlayerSetVocation(cid, 3) -- paladin
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 0)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 1)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 2)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 3)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 4)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 5)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 6)-config.skilafter))
				doPlayerAddMagLevel(cid, - ((getPlayerMagLevel(cid)) - config.magafter))
				doSendMagicEffect(getCreaturePosition(cid), config.efekt)
				doPlayerAddLevel(cid, -(config.removelevel))
				setCreatureMaxHealth(cid, (185+(10*((getPlayerLevel(cid)-8)))))
				doCreatureAddHealth(cid, -((getCreatureHealth(cid))-100))
				setCreatureMaxMana(cid, (35+(15*((getPlayerLevel(cid)-8)))))
				doPlayerSetMaxCapacity(cid, (470+(20*((getPlayerLevel(cid)-8)))))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to paladin.")				
				else doPlayerSendCancel(cid, "You don't have "..(getItemNameById(config.itemid))..".")
				end
			else doPlayerSendCancel(cid, "You are already a paladin.")
			end	
		else doPlayerSendCancel(cid, "Your level is to low. You need to be "..(config.minimumlevel).." level or higher.")
		end
		return TRUE
		end
------------------------------------------------------------------------------------------------------------------------------------------					
	if(param == "knight") then
		if getPlayerLevel(cid) >= config.minimumlevel then
			if getPlayerVocation(cid) < 4 then
				if getPlayerItemCount(cid, config.itemid) >= 1 then
				doPlayerRemoveItem(cid, config.itemid,1)
				doPlayerSetVocation(cid, 4) -- knight
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 0)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 1)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 2)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 3)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 4)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 5)-config.skilafter))
				doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, 6)-config.skilafter))
				doPlayerAddMagLevel(cid, - ((getPlayerMagLevel(cid)) - config.magafter))
				doSendMagicEffect(getCreaturePosition(cid), config.efekt)
				doPlayerAddLevel(cid, -(config.removelevel))
				setCreatureMaxHealth(cid, (185+(15*((getPlayerLevel(cid)-8)))))
				doCreatureAddHealth(cid, -((getCreatureHealth(cid))-100))
				setCreatureMaxMana(cid, (35+(25*((getPlayerLevel(cid)-8)))))	
				doPlayerSetMaxCapacity(cid, (470+(25*((getPlayerLevel(cid)-8)))))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to knight.")			
				else doPlayerSendCancel(cid, "You don't have "..(getItemNameById(config.itemid))..".")
				end
			else doPlayerSendCancel(cid, "You are already a knight.")
			end	
		else doPlayerSendCancel(cid, "Your level is to low. You need to be "..(config.minimumlevel).." level or higher.")
		end	
		return TRUE
end		
end

Sorry for the length of it :D
I will make it shorter if I have time, and if it actually work :D


@edit
OK, the script works. Let me know if there is any bugs. If anyone can make shorter, please do, because I want to see how. :D
 
Last edited:
SORRY I AM ANSWERING ONLY NOW...

Answer for your question about hp/mana = Script should change the mana and hp to the amount that the new vocation should have on the certain level...

I just have 1 question,
Is that a talkaction script? or just action??

and could you tell me what to write in action.xml OR talkaction.xml???

I would appreciate it :)))

AlcikOTS, thank you for what you did so far... :))


EDIT: Well, I guess it's a talkaction script... But still what should I write in talkaction.xml? :p

P.S 2 -- It's not working properly for me :S It doesn't reset the skills and doesnt take any level :/ doesnt reset mana and hp to proper amount :/
 
Last edited:
XML:
<talkaction words="!changevoc" event="script" value="vocations.lua"/>

Just add this to talkactions.xml.I think the script is working fine. Let me know about any bugs.

@edit

Use commands:
!changevoc druid
!changevoc knight
!changevoc paladin
!changevoc sorcerer
 
Last edited:
Shorter but not tested.

Hey. I have shorten the script.
It is tested and it works fine!
Lua:
-----------------------CONFIG---START-----------------------------------------
local config = {
	removelevel = 35, -- Amount of level taken away.
	itemid = 8982, -- Item ID.
	efekt = 2, -- Effect shown.
	skilafter = 10, -- What skill will the player have after change.
	minimumlevel = 100, -- What will be min level required? 
	magafter = 2 -- What magic level will he recive after change? 
}
-----------------------CONFIG---END-------------------------------------------
 
function onSay(cid, words, param)
 
if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must say what vocation you want change to.")
		return TRUE
    end
 if(param == "sorcerer") or (param == "druid") or (param == "knight") or (param == "paladin") or (param == "Paladin") or (param == "Druid") or (param == "Sorcerer") or (param == "Knight") or (param == "sorc") or (param == "Sorc") then
		if getPlayerLevel(cid) >= config.minimumlevel then
			if getPlayerItemCount(cid, config.itemid) >= 1 then
			doPlayerAddLevel(cid, -(config.removelevel))
				if(param == "sorcerer") or (param == "Sorcerer") or (param == "sorc") or (param == "Sorc") then	
					if getPlayerVocation(cid) > 1 then
						doPlayerSetVocation(cid, 1) -- Sorc
						setCreatureMaxHealth(cid, (185+(5*((getPlayerLevel(cid)-8)))))
						setCreatureMaxMana(cid, (35+(30*((getPlayerLevel(cid)-8)))))
						doPlayerSetMaxCapacity(cid, (470+(10*((getPlayerLevel(cid)-8)))))
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to sorcerer.")
					else doPlayerSendCancel(cid, "You are already a sorcerer.")
					doSendMagicEffect(getCreaturePosition(cid), 2)
					return TRUE
					end		
				end
 
				if(param == "druid") or (param == "Druid") then
					if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) > 2 then
						doPlayerSetVocation(cid, 2) -- Druid
						setCreatureMaxHealth(cid, (185+(5*((getPlayerLevel(cid)-8)))))
						setCreatureMaxMana(cid, (35+(30*((getPlayerLevel(cid)-8)))))
						doPlayerSetMaxCapacity(cid, (470+(10*((getPlayerLevel(cid)-8)))))				
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to druid.")	
					else doPlayerSendCancel(cid, "You are already a druid.")
					doSendMagicEffect(getCreaturePosition(cid), 2)
					return TRUE
					end	
				end
 
				if(param == "paladin") or (param == "Paladin") then
					if getPlayerVocation(cid) < 3 or getPlayerVocation(cid) > 3 then
					doPlayerSetVocation(cid, 3) -- Sorc
						setCreatureMaxHealth(cid, (185+(10*((getPlayerLevel(cid)-8)))))
						setCreatureMaxMana(cid, (35+(15*((getPlayerLevel(cid)-8)))))
						doPlayerSetMaxCapacity(cid, (470+(20*((getPlayerLevel(cid)-8)))))
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to paladin.")
					else doPlayerSendCancel(cid, "You are already a paladin.")
					doSendMagicEffect(getCreaturePosition(cid), 2)
					return TRUE
					end
				end	
 
				if(param == "knight") or (param == "Knight") then
					if getPlayerVocation(cid) < 4 then
					doPlayerSetVocation(cid, 4) -- Sorc
						setCreatureMaxHealth(cid, (185+(15*((getPlayerLevel(cid)-8)))))
						setCreatureMaxMana(cid, (35+(5*((getPlayerLevel(cid)-8)))))	
						doPlayerSetMaxCapacity(cid, (470+(25*((getPlayerLevel(cid)-8)))))
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to knight.")		
					else doPlayerSendCancel(cid, "You are already a knight.")
					doSendMagicEffect(getCreaturePosition(cid), 2)
					return TRUE
					end
				end
				
				doPlayerRemoveItem(cid, config.itemid, 1)
				doPlayerAddMagLevel(cid, - ((getPlayerMagLevel(cid)) - config.magafter))
				doSendMagicEffect(getCreaturePosition(cid), config.efekt)
				doCreatureAddMana(cid, -((getCreatureMana(cid))-(getCreatureMaxMana(cid))))
				doCreatureAddHealth(cid, -((getCreatureHealth(cid))-(getCreatureMaxHealth(cid))))
							for a = 0,6 do
								doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, a)-config.skilafter))
							end	
				
			else doPlayerSendCancel(cid, "You need "..getItemNameById(config.itemid).." to change your vocation.")
			doSendMagicEffect(getCreaturePosition(cid), 2)
			end
		else doPlayerSendCancel(cid, "You don't have enough level. Your level must be "..(config.minimumlevel).." or higher.")
		doSendMagicEffect(getCreaturePosition(cid), 2)
		end
else doPlayerSendCancel(cid, "You must say what vocation you want change to.")
doSendMagicEffect(getCreaturePosition(cid), 2)
end
end
 
Last edited:
Tested and works on TFS 0.4, its basically the same as the other here, just alot shorter

Lua:
-----------------------CONFIG---START-----------------------------------------
local config = {
	removelevel = 35, -- Amount of level taken away.
	itemid = 8982, -- Item ID.
	efekt = 2, -- Effect shown.
	skilafter = 10, -- What skill will the player have after change.
	minimumlevel = 100, -- What will be min level required? 
	magafter = 2, -- What magic level will he recive after change? 
}
-----------------------CONFIG---END-------------------------------------------
 
function onSay(cid, words, param)
	local param, oldVoc = param:lower(), 0
	local voc = {
	['sorcerer'] = {hp = 5, mana = 30, cap = 10, voc = 1},
	['druid'] = {hp = 5, mana = 30, cap = 10, voc = 2},
	['paladin'] = {hp = 10, mana = 15, cap = 20, voc = 3},
	['knight'] = {hp = 15, mana = 5, cap = 25, voc = 4},
	}
	
	if(getPlayerVocation(cid) > 4)then
		oldVoc = getPlayerVocation(cid)-4
	else
		oldVoc = getPlayerVocation(cid)
	end		
	
	if(voc[param])then
		if getPlayerLevel(cid) >= config.minimumlevel then
			if(getPlayerItemCount(cid, config.itemid) > 0)then
				if(oldVoc ~= voc[param].voc)then
					doPlayerAddLevel(cid, -(config.removelevel)) --Set new level
					doPlayerSetVocation(cid, voc[param].voc) --Change vocation
					setCreatureMaxHealth(cid, (185+((getPlayerLevel(cid)-8)*voc[param].hp))) --Set new hp
					setCreatureMaxMana(cid, (35+((getPlayerLevel(cid)-8)*voc[param].mana))) --Set new mana
					doPlayerSetMaxCapacity(cid, (470+((getPlayerLevel(cid)-8)*voc[param].cap))) --Set new cap
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to ".. param ..".")
					doSendMagicEffect(getCreaturePosition(cid), 2)
					doPlayerRemoveItem(cid, config.itemid, 1)
					doPlayerAddMagLevel(cid, - ((getPlayerMagLevel(cid)) - config.magafter))
					doSendMagicEffect(getCreaturePosition(cid), config.efekt)
					doCreatureAddMana(cid, -((getCreatureMana(cid))-(getCreatureMaxMana(cid))))
					doCreatureAddHealth(cid, -((getCreatureHealth(cid))-(getCreatureMaxHealth(cid))))
					for a = 0,6 do
						doPlayerAddSkill(cid, -(getPlayerSkillLevel(cid, a)-config.skilafter))
					end	
				else
					 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You already are a ".. param ..".")
				end
			else
				 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have a ".. getItemNameById(config.itemid) ..".")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to be atleast level ".. minimumlevel .." to use this command.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must say what vocation you want to change into, ie !changevoc sorcerer.")
	end
	return true
end
 
Back
Top