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

Redo this script..

DestinationSer

@echo off
Joined
Mar 7, 2009
Messages
2,806
Solutions
1
Reaction score
676
Hey!
I got a oracle script here and i need it to be like you cant no longer choose a town because the player is already a knight for example and now chooses a vocation higher up. like this
Example Knight:

Player: Hi
NPC: Hello "Playername" would you like to upgrade your vocation? "Yes"?
Player: Yes
NPC: Ah, I see you are a "Knight"! Then you can upgrade yourself to a "Battle Warrior". Are you sure about this?
Player: Yes

Player gets kicked and stays at the same level with same hp mana but with the other vocation..

Example Sorcerer

Player: Hi
NPC: Hello "Playername" would you like to upgrade your vocation? "Yes"?
Player: Yes
NPC: Ah, I see you are a "Sorcerer"! Then you can upgrade yourself to a "Demonic Wizard" Are you sure about this?
Player: Yes

Player gets kicked and stays at the same level with same hp mana but with the other vocation..

Example Druid

Player: Hi
NPC: Hello "Playername" would you like to upgrade your vocation? "Yes"?
Player: Yes
NPC: Ah, I see you are a "Druid"! Then you can upgrade yourself to a "High Priest" Are you sure about this?
Player: Yes

Player gets kicked and stays at the same level with same hp mana but with the other vocation..

Example Paladin

Player: Hi
NPC: Hello "Playername" would you like to upgrade your vocation? "Yes"?
Player: Yes
NPC: Ah, I see you are a "Paladin"! Then you can upgrade yourself to a "Royal Archer" Are you sure about this?
Player: Yes

Player gets kicked and stays at the same level with same hp mana but with the other vocation..
 
you need to edit your vocations.xml and I'll give you an example of the a similar npc script:
LUA:
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
 
item = 'You do not have the required Level or You Already have a different vocation!.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	if msgcontains(msg, 'ok') then
		selfSay('Do you Want to become a battle warrior?', cid)
	elseif msgcontains(msg, 'yes') then
                        if(getPlayerLevel(cid) > 100) and (getPlayerVocation(cid) == 4) then     
			selfSay('Say it Proudly: Yes, I want to become a Battle Warrior!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required level or you already have a vocation!.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'battle warrior') and talk_state == 1 then
		talk_state = 0
                if getCreatureStorage(cid, 89955) == 1 == FALSE then
			selfSay('Congratulation, now you are a Battle Warrior!', cid)
			doPlayerSetVocation(cid, 999) -- edit it to your own vocation id
                        setPlayerStorageValue(cid, 89955,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
		else
			selfSay(item, cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Get out of my face then!')
		talk_state = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

#npc file
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Barbarian" script="data/npc/scripts/Sub-class/Knight - Barb.lua" walkinterval="20000" floorchange="0">
    <health now="100" max="100"/>
    <look type="144" head="115" body="115" legs="132" feet="115" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. I'll upgrade your vocation.{Ok}?."/>
	</parameters>
</npc>
if anything, post it here.
 
Last edited:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
	<vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="10" gainmanaticks="6" gainmanaamount="10" manamultiplier="4.0" attackspeed="1000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="2.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="2.0"/>
		<skill id="2" multiplier="2.0"/>
		<skill id="3" multiplier="2.0"/>
		<skill id="4" multiplier="2.0"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="1" name="Master Sorcerer" description="a master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="10" gainmanaticks="1" gainmanaamount="150" manamultiplier="1.1" attackspeed="650" soulmax="100" gainsoulticks="120" fromvoc="1">
		<formula meleeDamage="0.0" distDamage="0.0" wandDamage="1.3" magDamage="1.4" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="2.0"/>
		<skill id="2" multiplier="2.0"/>
		<skill id="3" multiplier="2.0"/>
		<skill id="4" multiplier="2.0"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="2" name="Elder Druid" description="a elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="10" gainmanaticks="1" gainmanaamount="150" manamultiplier="1.1" attackspeed="650" soulmax="100" gainsoulticks="120" fromvoc="2">
		<formula meleeDamage="0.0" distDamage="0.0" wandDamage="1.3" magDamage="1.4" magHealingDamage="1.1" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="1.8"/>
		<skill id="2" multiplier="1.8"/>
		<skill id="3" multiplier="1.8"/>
		<skill id="4" multiplier="1.8"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="3" name="Royal Paladin" description="a royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="1" gainhpamount="75" gainmanaticks="1" gainmanaamount="150" manamultiplier="1.4" attackspeed="650" soulmax="100" gainsoulticks="120" fromvoc="3">
		<formula meleeDamage="0.0" distDamage="1.5" wandDamage="1.0" magDamage="1.2" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.2"/>
		<skill id="1" multiplier="1.2"/>
		<skill id="2" multiplier="1.2"/>
		<skill id="3" multiplier="1.2"/>
		<skill id="4" multiplier="1.1"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="4" name="Elite Knight" description="a elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="100" gainmanaticks="1" gainmanaamount="150" manamultiplier="3.0" attackspeed="650" soulmax="100" gainsoulticks="120" fromvoc="4">
		<formula meleeDamage="1.4" distDamage="0.0" wandDamage="1.0" magDamage="1.3" magHealingDamage="1.2" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.1"/>
		<skill id="1" multiplier="1.1"/>
		<skill id="2" multiplier="1.1"/>
		<skill id="3" multiplier="1.1"/>
		<skill id="4" multiplier="1.4"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="5" name="Sorcerer" description="a sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="15" gainmanaticks="1" gainmanaamount="22" manamultiplier="1.1" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="2.0"/>
		<skill id="2" multiplier="2.0"/>
		<skill id="3" multiplier="2.0"/>
		<skill id="4" multiplier="2.0"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="6" name="Druid" description="an druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="15" gainmanaticks="1" gainmanaamount="22" manamultiplier="1.1" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="1.8"/>
		<skill id="2" multiplier="1.8"/>
		<skill id="3" multiplier="1.8"/>
		<skill id="4" multiplier="1.8"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="7" name="Paladin" description="a paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="1" gainhpamount="18" gainmanaticks="1" gainmanaamount="19" manamultiplier="1.4" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.2"/>
		<skill id="1" multiplier="1.2"/>
		<skill id="2" multiplier="1.2"/>
		<skill id="3" multiplier="1.2"/>
		<skill id="4" multiplier="1.1"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="8" name="Knight" description="an knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="22" gainmanaticks="1" gainmanaamount="15" manamultiplier="3.0" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
		<formula meleeDamage="1.1" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.1"/>
		<skill id="1" multiplier="1.1"/>
		<skill id="2" multiplier="1.1"/>
		<skill id="3" multiplier="1.1"/>
		<skill id="4" multiplier="1.4"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="9" name="Epic Master Sorcerer" description="an master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="40" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="1900" soulmax="299" gainsoulticks="15" fromvoc="5" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="1.2" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="2.0"/>
		<skill id="2" multiplier="2.0"/>
		<skill id="3" multiplier="2.0"/>
		<skill id="4" multiplier="2.0"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="10" name="Epic Elder Druid" description="an elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="40" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="1900" soulmax="299" gainsoulticks="15" fromvoc="6" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="1.2" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.5"/>
		<skill id="1" multiplier="1.8"/>
		<skill id="2" multiplier="1.8"/>
		<skill id="3" multiplier="1.8"/>
		<skill id="4" multiplier="1.8"/>
		<skill id="5" multiplier="1.5"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="11" name="Epic Royal Paladin" description="an royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="60" gainmanaticks="3" gainmanaamount="60" manamultiplier="1.4" attackspeed="1900" soulmax="299" gainsoulticks="15" fromvoc="7" lessloss="30">
		<formula meleeDamage="1.1" distDamage="1.1" wandDamage="1.0" magDamage="1.1" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.2"/>
		<skill id="1" multiplier="1.2"/>
		<skill id="2" multiplier="1.2"/>
		<skill id="3" multiplier="1.2"/>
		<skill id="4" multiplier="1.1"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="12" name="Epic Elite Knight" description="an elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="8" gainhpamount="70" gainmanaticks="4" gainmanaamount="50" manamultiplier="3.0" attackspeed="1900" soulmax="299" gainsoulticks="15" fromvoc="8" lessloss="30">
		<formula meleeDamage="1.2" distDamage="1.0" wandDamage="1.0" magDamage="1.1" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.1"/>
		<skill id="1" multiplier="1.1"/>
		<skill id="2" multiplier="1.1"/>
		<skill id="3" multiplier="1.1"/>
		<skill id="4" multiplier="1.4"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
	<vocation id="13" name="Battle Warrior" description="an Battle Warrior" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="22" gainmanaticks="1" gainmanaamount="15" manamultiplier="3.0" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
		<formula meleeDamage="1.1" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.1"/>
		<skill id="1" multiplier="1.1"/>
		<skill id="2" multiplier="1.1"/>
		<skill id="3" multiplier="1.1"/>
		<skill id="4" multiplier="1.4"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>
</vocations>
 
EDIT: okay delete all your script and add this:
LUA:
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
 	if msgcontains(msg, 'ok') then
		selfSay('Do you Want to become a battle warrior? {Yes} or {no}', cid)
	elseif msgcontains(msg, 'yes') then
                        if(getPlayerLevel(cid) > 100) and (getPlayerVocation(cid) == 4) then						
			selfSay('Say it Proudly: Yes, I want to become a {Battle Warrior}!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required level or you already have a diferent vocation!.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'battle warrior') and talk_state == 1 then
		talk_state = 0
                if getCreatureStorage(cid, 89857) == 1 == FALSE then
			selfSay('Congratulations now you are a {Battle Warrior}!.', cid)
				doPlayerSetPromotionLevel(cid, 1)
                        setPlayerStorageValue(cid, 89857,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
		else
			selfSay('You do not have the required level or you already have a diferent vocation!.', cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Get out of my face then!')
		talk_state = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
and you vocations.xml should look like this:
LUA:
	<vocation id="13" name="Battle Warrior" description="an Battle Warrior" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="22" gainmanaticks="1" gainmanaamount="15" manamultiplier="3.0" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
		<formula meleeDamage="1.1" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" armor="1.0"/>
		<skill id="0" multiplier="1.1"/>
		<skill id="1" multiplier="1.1"/>
		<skill id="2" multiplier="1.1"/>
		<skill id="3" multiplier="1.1"/>
		<skill id="4" multiplier="1.4"/>
		<skill id="5" multiplier="1.1"/>
		<skill id="6" multiplier="1.1"/>
	</vocation>

Alright, this should work now, didn't test it here as I don't have any ot on this pc, but if it doesn't work I'll try and fix it
 
Last edited:
Hmm I installed an ot just to test it and it works 100% on tfs 0.3.6pl1
Any errors in console?


EDIT:
Ooh I see, your vocations.xml is just way different from mine, let me explain how you should edit the script, cuz I forgot to do that
on this part:
LUA:
                if getCreatureStorage(cid, 89857) == 1 == FALSE then -- put an empty storage value
			selfSay('Congratulations now you are a {Battle Warrior}!.', cid)
				doPlayerSetPromotionLevel(cid, 1)   -- explanation down
                        setPlayerStorageValue(cid, 89857,1) ---- put the same storage value 
                        doSendMagicEffect(getCreaturePosition(cid), 14)
Ok, now for this line:
LUA:
				doPlayerSetPromotionLevel(cid, 1)
It works like this: You have Master Sorcerer as first vocation, Sorcerer as promotion from the first vocation and Epic Master Sorcerer as promotion to Sorcerer, that means:
Master Sorcerer PromotionLevel = 0
Sorcerer PromotionLevel = 1
Epic MasterSorcerer PromotionLevel = 2
Not sure if I make any sense but I tried... if any doubts just post here.
 
Last edited:
Back
Top