T
Tibia Demon
Guest
What I have wrong here? It doesn't promote to epic promotions.
Fixed it.
I think I might have had a misunderstanding on how prevoc works because I thought it should get next promotions as long as it was set correct but I couldn't get it to work so I just added a table like old times.
Lua:
local promotiontwo = Action()
local config = {
["premium"] = true,
["level"] = 20
}
function promotiontwo.onUse(player, item, fromPos, target, toPos, isHotkey)
-- Check if player need premium
if not player:isPremium() and config.premium then
player:sendCancelMessage("Sorry, you need to have a premium account.")
return false
end
-- Check if player is already promoted
local vocation = player:getVocation()
local promotiontwo = vocation:getPromotion()
if vocation == promotiontwo or player:getStorageValue(PlayerStorageKeys.promotiontwo) == 1 then
player:sendCancelMessage("You are already promoted!")
player:setStorageValue(PlayerStorageKeys.promotiontwo, 1)
return false
end
-- Check if player is high enough level
if player:getLevel() < config.level then
player:sendCancelMessage("You can only be promoted once you have reached level 8.")
return false
end
player:setVocation(promotiontwo)
player:setStorageValue(PlayerStorageKeys.promotiontwo, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You are now promoted.")
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Congratulations! You are now promoted.")
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
item:remove(1)
return true
end
promotiontwo:id(9112)
promotiontwo:register()
XML:
<vocation id="9" clientid="3" name="Epic Master Sorcerer" description="an epic master sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="5">
<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="10" clientid="4" name="Epic Elder Druid" description="an epic elder druid" gaincap="10" gainhp="5" gainmana="30" gainhpticks="4" gainhpamount="10" gainmanaticks="2" gainmanaamount="10" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="6">
<formula meleeDamage="1.0" distDamage="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" clientid="2" name="Epic Royal Paladin" description="an epic royal paladin" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="10" gainmanaticks="3" gainmanaamount="10" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="7">
<formula meleeDamage="1.0" distDamage="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" clientid="1" name="Epic Elite Knight" description="an epic elite knight" gaincap="25" gainhp="15" gainmana="5" gainhpticks="2" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="8">
<formula meleeDamage="1.0" distDamage="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>
Post automatically merged:
Fixed it.
I think I might have had a misunderstanding on how prevoc works because I thought it should get next promotions as long as it was set correct but I couldn't get it to work so I just added a table like old times.
Lua:
local vocationsforsecondpromo = {
[5] = 9,
[6] = 10,
[7] = 11,
[8] = 12,
}
Last edited by a moderator: