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

Auto Vocation Change At Level 200

donacool

Mapper Scripter Ot Owner
Joined
Jan 15, 2010
Messages
97
Reaction score
0
hey i maked this script so when you get at level 200
you vocation get changed.

but when i tested it the server tells me that ")" is expected near shadow.

how do i fix this?

PHP:
function onAdvance(cid,skill, oldLevel, newLvel)
	if isPlayer(cid) and getPlayerLevel(cid) == 200 then
		if getPlayerVocation(cid) == 1 then
			doPlayerSetVocation(cid, Elite Shadow Wizzard)
			doSendAnimatedText(getCreaturePos(cid), "Your vocation has changed!", 150)
		elseif getPlayerVocation(cid) == 2 then
			doPlayerSetVocation(cid, Elite Shadow Mare)
			doSendAnimatedText(getCreaturePos(cid), "Your vocation has changed!", 150)
		elseif getPlayerVocation(cid) == 3 then
			doPlayerSetVocation(cid, Elite Shadow Vain)
			doSendAnimatedText(getCreaturePos(cid), "Your vocation has changed!", 150)
		elseif getPlayerVocation(cid) == 4 then
			doPlayerSetVocation(cid, Elite Shadow Bersenerker)
			doSendAnimatedText(getCreaturePos(cid), "Your vocation has changed!", 150)
		end
		return true
	end
	return true
end
return true
 
Last edited:
Try this
Lua:
function onAdvance(cid, skill, oldLevel, newLvel) 
    if isPlayer(cid) and skill == SKILL_LEVEL and newLvel == 200 then 
        setPlayerPromotionLevel(cid, 2)
    end
    return true
end

doPlayerSetVocation(cid) does not work like hat, you have to set vocation id, like: doPlayerSetVocation(cid, 12)...

Btw, in tfs 0.36 and 0.4 you can use setPlayerPromotionLevel(cid, promLevel)
 
Lua:
  function onAdvance(cid, skill, oldLevel, newLvel)
    if isPlayer(cid) and skill == SKILL_LEVEL and newLvel >= 200 then
        setPlayerPromotionLevel(cid, 2)
        doPlayerSendTextMessage(cid, 22,"You are now "..getPlayerVocationName(cid)..".")
    end
    return true
end

With advance I recommend to use
Code:
>=200
because someone can advance from 199 to 201 and he won't get reward/vocation
 
Last edited:
little fix:
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
	if getPlayerPromotionLevel(cid) < 2 and skill == SKILL_LEVEL and newLevel >= 200 then
		setPlayerPromotionLevel(cid, 2)
		doPlayerSendTextMessage(cid, 22, "You are now "..getPlayerVocationName(cid)..".")
	end
	return true
end
 
When I was 11 years old I knew that I have to do samething similar in the xmls, so I just was coping the lines...

xml
Code:
<event type="advance" name="voc" event="script" value="voc.lua"/>

login.lua
Lua:
registerCreatureEvent(cid,"voc")
 
Back
Top