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

Windows Vocation Resets at re-log.

Alcik

ots.tibiaserver.pl
Joined
Mar 12, 2009
Messages
177
Reaction score
4
Location
Ireland/Polish
I made a new vocation. I also made a script for players to get this vocation. Script works all right and gives the vocation to the players, but when they logout their vocation is set to the vocation that they had before.

Script for getting the Vocation:

Lua:
function onStepIn(player, item, frompos, item2, topos)

		if getPlayerVocation(player) == 5 then
        doPlayerSendTextMessage(player, 19, "Now you are Epic Master Sorcerer")
                doSendMagicEffect(getPlayerPosition(player), 36)
				doPlayerSetVocation(player, 9)
		elseif getPlayerVocation(player) == 6 then
        doPlayerSendTextMessage(player, 19, "Now you are Epic Elder Druid")
                doSendMagicEffect(getPlayerPosition(player), 42)
				doPlayerSetVocation(player, 10)
		elseif getPlayerVocation(player) == 7 then
        doPlayerSendTextMessage(player, 19, "Now you are Epic Royal Paladin")
                doSendMagicEffect(getPlayerPosition(player), 39)
				doPlayerSetVocation(player, 11)	
		elseif getPlayerVocation(player) == 8 then
        doPlayerSendTextMessage(player, 19, "Now you are Epic Elite Knight")
                doSendMagicEffect(getPlayerPosition(player), 34)
				doPlayerSetVocation(player, 12)	
    end
end

Code for the Vocations.xml:

Lua:
<?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="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="1" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="10" gainmana="40" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="800" soulmax="100" gainsoulticks="120" fromvoc="1">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="2" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="10" gainmana="40" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="800" soulmax="100" gainsoulticks="120" fromvoc="2">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="3" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="15" gainmana="20" gainhpticks="4" gainhpamount="5" gainmanaticks="4" gainmanaamount="5" manamultiplier="1.4" attackspeed="800" soulmax="100" gainsoulticks="120" fromvoc="3">
		<formula meleeDamage="1.0" distDamage="2.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.2" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="4" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="20" gainmana="10" gainhpticks="3" gainhpamount="5" gainmanaticks="6" gainmanaamount="5" manamultiplier="3.0" attackspeed="800" soulmax="100" gainsoulticks="120" fromvoc="4">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<!-- First promotion -->
	<vocation id="5" name="Master Sorcerer" description="a master sorcerer" needpremium="1" gaincap="10" gainhp="15" gainmana="45" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="500" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="2.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="6" name="Elder Druid" description="an elder druid" needpremium="1" gaincap="10" gainhp="15" gainmana="45" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="500" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="2.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="7" name="Royal Paladin" description="a royal paladin" needpremium="1" gaincap="20" gainhp="25" gainmana="20" gainhpticks="3" gainhpamount="10" gainmanaticks="3" gainmanaamount="10" manamultiplier="1.4" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
		<formula meleeDamage="1.0" distDamage="3.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.0" club="1.4" sword="1.4" axe="1.4" distance="1.2" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="8" name="Elite Knight" description="an elite knight" needpremium="1" gaincap="25" gainhp="30" gainmana="10" gainhpticks="2" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="300" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
		<formula meleeDamage="7.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="2.0"/>
		<skill fist="1.1" club="1.2" sword="1.2" axe="1.2" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<!-- Vip Vocs -->
	<vocation id="9" name="Epic Master Sorcerer" description="an epic master sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="10" gainhpamount="10000" gainmanaticks="10" gainmanaamount="10000" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="5" lessloss="50">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="0.9"/>
	</vocation>
	<vocation id="10" name="Epic Elder Druid" description="an epic elder druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="10" gainhpamount="10000" gainmanaticks="10" gainmanaamount="10000" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="6" lessloss="50">
		<formula meleeDamage="1.0" distDamage="1.0" wandDamage="2.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="0.9"/>
	</vocation>
	<vocation id="11" name="Epic Royal Paladin" description="an epic royal paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="10" gainhpamount="10000" gainmanaticks="10" gainmanaamount="10000" manamultiplier="1.4" attackspeed="300" soulmax="200" gainsoulticks="15" fromvoc="7" lessloss="50">
		<formula meleeDamage="1.0" distDamage="5.0" wandDamage="1.0" magDamage="2.0" magHealingDamage="3.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.2" club="1.4" sword="1.4" axe="1.4" distance="1.2" shielding="1.1" fishing="1.1" experience="0.9"/>
	</vocation>
	<vocation id="12" name="Epic Elite Knight" description="an epic elite knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="10" gainhpamount="10000" gainmanaticks="10" gainmanaamount="10000" manamultiplier="3.0" attackspeed="150" soulmax="200" gainsoulticks="15" fromvoc="8" lessloss="50">
		<formula meleeDamage="9.0" distDamage="1.0" wandDamage="1.0" magDamage="2.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
		<skill fist="1.1" club="1.2" sword="1.2" axe="1.2" distance="1.4" shielding="1.1" fishing="1.1" experience="0.9"/>	
	</vocation>
</vocations>


I don't know what is wrong so I ask you guys. I asked on one other forum buy I didn't get the answer. I hope someone can help me! :thumbup:


P.S. I use TFS 0.3.6 (Crying Damson)
 
Here is code

King.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Of Blood" script="data/npc/scripts/prom2.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
		<look type="332" head="0" body="0" legs="0" feet="0"  addons="0"/>
</npc>

prom2.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})


npcHandler:addModule(FocusModule:new())
 
Back
Top