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

Action vocation changer [my first script]

good or bad?

  • good

    Votes: 16 48.5%
  • bad

    Votes: 17 51.5%

  • Total voters
    33

Zerak456

Gorlex.net NEW!
Joined
Aug 13, 2008
Messages
1,060
Reaction score
6
hello, today i made a script u use a scroll u will be sorcerer
and its 4 scrolls for sorcerer,knight,druid,paladin

so u can change ur vocation:)
pic:
2sbtj6p.jpg


hope u like it


data/action/action.xml
Code:
    <!-- voc changers -->
    <action itemid="7529" script="sorcerer.lua"/>
    <action itemid="7530" script="paladin.lua"/>
    <action itemid="7531" script="knight.lua"/>
    <action itemid="7532" script="druid.lua"/>


and now create 4 files with name sorcerer,druid,paladin,knight


sorcerer:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getPlayerVocation(cid) == 1 then
            doCreatureSay(cid, "You are already a sorcerer", TALKTYPE_ORANGE_1)
 
    else if getPlayerLevel(cid) >= 40 then
        doPlayerSetVocation(cid, 1)
        doCreatureSay(cid, "You are now a Sorcerer!", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
            doSendMagicEffect(fromPosition, 44)
            return TRUE
        else
                    doCreatureSay(cid, "You must be level 40 to change ur vocation..", TALKTYPE_ORANGE_1)
        end
end
            return TRUE
end


druid:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getPlayerVocation(cid) == 2 then
            doCreatureSay(cid, "You are already a Druid", TALKTYPE_ORANGE_1)
 
    else if getPlayerLevel(cid) >= 40 then
        doPlayerSetVocation(cid, 2)
        doCreatureSay(cid, "You are now a Druid!", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
            doSendMagicEffect(fromPosition, 39)
            return TRUE
        else
                    doCreatureSay(cid, "You must be level 40 to change ur vocation..", TALKTYPE_ORANGE_1)
        end
end
            return TRUE
end


knight:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getPlayerVocation(cid) == 4 then
            doCreatureSay(cid, "You are already a Knight", TALKTYPE_ORANGE_1)
 
    else if getPlayerLevel(cid) >= 40 then
        doPlayerSetVocation(cid, 4)
        doCreatureSay(cid, "You are now a Knight!", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
            doSendMagicEffect(fromPosition, 39)
            return TRUE
        else
                    doCreatureSay(cid, "You must be level 40 to change ur vocation..", TALKTYPE_ORANGE_1)
        end
end
            return TRUE
end


paladin:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    if getPlayerVocation(cid) == 3 then
            doCreatureSay(cid, "You are already a Paladin", TALKTYPE_ORANGE_1)
 
    else if getPlayerLevel(cid) >= 40 then
        doPlayerSetVocation(cid, 3)
        doCreatureSay(cid, "You are now a Paladin!", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid, 1)
            doSendMagicEffect(fromPosition, 39)
            return TRUE
        else
                    doCreatureSay(cid, "You must be level 40 to change ur vocation..", TALKTYPE_ORANGE_1)
        end
end
            return TRUE
end


thanks hope u like it and give me rep++ xD


tested on tfs 0.3.4
 
Last edited:
Nice! :)

Sorry that I'll do that, but I can't live without shortening scripts +D

all goes to vocation_changer.lua
Code:
local config = {
	level = 40,
	effect = 44
}

local scrolls = {
	[7529] = 1,
	[7530] = 3,
	[7531] = 4,
	[7532] = 2
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local scroll = scrolls[item.itemid]
	if(not scroll) then
		return FALSE
	end

	local vocation = getPlayerVocation(cid)
	if(scroll.vocation == vocation) then
		doCreatureSay(cid, "You are already a " .. getVocationInfo(vocation).name, TALKTYPE_ORANGE_1)
		return TRUE
	end

	if(getPlayerLevel(cid) < config.level) then
		doCreatureSay(cid, "You must be level " .. config.level .. " to change ur vocation..", TALKTYPE_ORANGE_1)
		return TRUE
	end

	doPlayerSetVocation(cid, scroll.vocation)
	doCreatureSay(cid, "You are now a " .. getVocationInfo(scroll.vocation).name .. "!", TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid, 1)
	doSendMagicEffect(fromPosition, config.effect)
	return TRUE
end

and to actions.xml
Code:
<action itemid="7529-7532" script="vocation_changer.lua"/>
 
Last edited:
@Topic,

Yea, you forgot to consider the HP/Mana.
You also slawkens. :thumbup:
 
And if I was a druid and do I change to knight that ml will have?
 
@Up,

Same, the script isn't correctly made.
 
i knowed that problem but i cant make that i dont know how :(

please fix it

slawkens ur script is not working but mine is working
 
Easy to just change to mage, then train mlvl, and then back to paladin/knight.

So you should also reset mlvl every vocation change.
Start:
Knight: ML 4
Paladin: ML 15
Mage: ML 40
 
Easy to just change to mage, then train mlvl, and then back to paladin/knight.

So you should also reset mlvl every vocation change.
Start:
Knight: ML 4
Paladin: ML 15
Mage: ML 40


thnks but.. how to do that?
 
Easy to just change to mage, then train mlvl, and then back to paladin/knight.

So you should also reset mlvl every vocation change.
Start:
Knight: ML 4
Paladin: ML 15
Mage: ML 40


how?!?!?!?


please tell me fast!! :(
 
Back
Top