local setup = {vocation = 4, level1 = 20, level2 = 40, item1 = 2400, item2 = 2390}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerVocation(cid) ~= setup.vocation then
doPlayerSendCancel(cid, 'You need to be a knight in order to use this item.')
return true
end
if getPlayerPromotionLevel(cid) >= 2 then
doPlayerSendCancel(cid, 'You can\'t get more promotions.')
return true
end
local level = getPlayerPromotionLevel(cid) == 0 and setup.level1 or setup.level2
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, 'You need to be at least level '..level..' to be promoted.')
return true
end
if getPlayerPromotionLevel(cid) == 0 then
doPlayerAddItem(cid, setup.item1, 1, true)
elseif getPlayerPromotionLevel(cid) == 1 and getPlayerItemCount(cid, setup.item1) == 1 then
doTransformItem(getPlayerItemById(cid, true, setup.item1).uid, setup.item2)
else
doPlayerSendCancel(cid, 'You need only 1 Magic Sword to be promoted.')
return true
end
doRemoveItem(item.uid, 1)
doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) == 0 and 1 or 2)
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_YELLOW)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have just been promoted to '..getPlayerVocationName(cid)..'!!')
doPlayerSave(cid)
return true
end
player must click on scroll, not on sword/wandits no error but i want it like this: knight's begin with fire sword when they click on the promotion scroll they become to elite knight and the scroll will be removed! the fire sword will be removed and a magic sword will come instead. then if you want to become to a ultimate knight when you click your magic sword will be removed and the scroll, then instead for the magic sword its will come a magic long sword.
Can you fix the sorcerer and knight on this scroll, the sorcerer will get instead sword wands! from sorcerer, master sorcerer and ultimate sorcerer.
local setup = {
[1] = { --sorc
level1 = 20, --req level for 1st promo
level2 = 40, --req level for 2nd promo
weapon1 = 2392, --1st req wep(no promo)
weapon2 = 2400, --2nd req wep(1st promo)
weapon3 = 2390 --3rd wep(2nd promo)
},
[4] = { --knight
level1 = 20,
level2 = 40,
weapon1 = 2392, --firesword
weapon2 = 2400, --magicsword
weapon3 = 2390 --magiclongsword
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local scroll = setup[getPlayerVocation(cid)]
if not scroll then
doPlayerSendCancel(cid, 'You need to be either a sorcerer or a knight in order to use this item.')
return true
end
if getPlayerPromotionLevel(cid) >= 2 then
doPlayerSendCancel(cid, 'You can\'t get more promotions.')
return true
end
local level = getPlayerPromotionLevel(cid) == 0 and scroll.level1 or scroll.level2
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, 'You need to be at least level '..level..' to be promoted.')
return true
end
local weapon = getPlayerPromotionLevel(cid) == 0 and scroll.weapon1 or scroll.weapon2
if getPlayerItemCount(cid, weapon) == 1 then
doTransformItem(getPlayerItemById(cid, true, weapon).uid, getPlayerPromotionLevel(cid) == 0 and scroll.weapon2 or scroll.weapon3)
else
doPlayerSendCancel(cid, 'You need only 1 '.. getItemNameById(weapon)..' to be promoted.')
return true
end
doRemoveItem(item.uid, 1)
doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) == 0 and 1 or 2)
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_YELLOW)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have just been promoted to '..getPlayerVocationName(cid)..'!!')
doPlayerSave(cid)
return true
end
[1] = { --sorc
level1 = 20, --req level for 1st promo
level2 = 40, --req level for 2nd promo
[COLOR="red"] weapon1 = 2392, --1st req wep(no promo)
weapon2 = 2400, --2nd req wep(1st promo)
weapon3 = 2390 --3rd wep(2nd promo)
[/COLOR] },
@ tfs 0.3/4 promoted vocations don't change their vocation ID but the promotion levelhow can i change example: voc: 4 knight then voc 8 elite knight
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
<vocation id="0" name="None" description="none" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="1000" soulmax="100" gainsoulticks="120" fromvoc="0">
<formula meleeDamage="1.0" distDamage="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="1" name="Ninja" description="a Ninja" gaincap="1000" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="250" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="580" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="Super Ninja" description="a Super Ninja" gaincap="1000" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="250" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="580" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="3" name="Super Star Ninja" description="a Super Star Ninja" gaincap="1000" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="250" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="580" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="4" name="Warrior" description="a Warrior" gaincap="1000" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="250" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="580" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="5" name="Mega Warrior" description="a Mega Warrior" gaincap="1110" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="100" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="1" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="Ultra Warrior" description="a Ultra Warrior" gaincap="1110" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="100" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="1" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="7" name="Mage" description="a Mage" gaincap="1110" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="100" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="1" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="8" name="Mega Mage" description="a Mega Mage" gaincap="1110" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="100" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="1" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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="9" name="Ultra Mage" description="a Ultra Mage" gaincap="1110" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="100" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="1" fromvoc="1">
<formula meleeDamage="1.0" distDamage="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>
</vocations>
local setup = {
[1] = { --sorc
level1 = 20, --req level for 1st promo
level2 = 40, --req level for 2nd promo
outfit1 = {lookType=123,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
outfit2 = {lookType=123,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
weapon1 = 2392, --1st req wep(no promo)
weapon2 = 2400, --2nd req wep(1st promo)
weapon3 = 2390 --3rd wep(2nd promo)
},
[4] = { --knight
level1 = 20,
level2 = 40,
outfit1 = {lookType=123,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
outfit2 = {lookType=123,lookHead=0,lookAddons=0,lookLegs=0,lookBody=0,lookFeet=0},
weapon1 = 2392, --firesword
weapon2 = 2400, --magicsword
weapon3 = 2390 --magiclongsword
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local scroll = setup[getPlayerVocation(cid)]
if not scroll then
doPlayerSendCancel(cid, 'You need to be either a sorcerer or a knight in order to use this item.')
return true
end
if getPlayerPromotionLevel(cid) >= 2 then
doPlayerSendCancel(cid, 'You can\'t get more promotions.')
return true
end
local level = getPlayerPromotionLevel(cid) == 0 and scroll.level1 or scroll.level2
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, 'You need to be at least level '..level..' to be promoted.')
return true
end
local weapon = getPlayerPromotionLevel(cid) == 0 and scroll.weapon1 or scroll.weapon2
if getPlayerItemCount(cid, weapon) == 1 then
doTransformItem(getPlayerItemById(cid, true, weapon).uid, getPlayerPromotionLevel(cid) == 0 and scroll.weapon2 or scroll.weapon3)
else
doPlayerSendCancel(cid, 'You need only 1 '.. getItemNameById(weapon)..' to be promoted.')
return true
end
local outfit = getPlayerPromotionLevel(cid) == 0 and scroll.outfit1 or scroll.outfit2
if outfit then
doCreatureChangeOutfit(cid, outfit)
end
doRemoveItem(item.uid, 1)
doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) == 0 and 1 or 2)
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_YELLOW)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have just been promoted to '..getPlayerVocationName(cid)..'!!')
doPlayerSave(cid)
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local scroll = setup[getPlayerVocation(cid)]
if not scroll then
doPlayerSendCancel(cid, 'You need to be either a sorcerer or a knight in order to use this item.')
return true
end
if [COLOR=red]getPlayerPromotionLevel(cid) >= 2[/COLOR] then
doPlayerSendCancel(cid, 'You can\'t get more promotions.')
return true
end
local level = [COLOR=red]getPlayerPromotionLevel(cid) == 0[/COLOR] and scroll.level1 or scroll.level2
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, 'You need to be at least level '..level..' to be promoted.')
return true
end
local weapon = [COLOR=red]getPlayerPromotionLevel(cid) == 0 [/COLOR]and scroll.weapon1 or scroll.weapon2
if getPlayerItemCount(cid, weapon) == 1 then
doTransformItem(getPlayerItemById(cid, true, weapon).uid, [COLOR=red]getPlayerPromotionLevel(cid) == 0[/COLOR] and scroll.weapon2 or scroll.weapon3)
else
doPlayerSendCancel(cid, 'You need only 1 '.. getItemNameById(weapon)..' to be promoted.')
return true
end
local outfit = [COLOR=red]getPlayerPromotionLevel(cid) == 0[/COLOR] and scroll.outfit1 or scroll.outfit2
if outfit then
doCreatureChangeOutfit(cid, outfit)
end
doRemoveItem(item.uid, 1)
[COLOR=red]doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) == 0 and 1 or 2)[/COLOR]
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_YELLOW)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have just been promoted to '..getPlayerVocationName(cid)..'!!')
doPlayerSave(cid)
return true
end