Salvus
Well-Known Member
- Joined
- Feb 7, 2019
- Messages
- 102
- Solutions
- 1
- Reaction score
- 69
Is it possible to fix this script so you can get mounts depending on the vocation
In level 100 knight will get winow Queen and sorcerer will get a Racing Bird in level 100.
Something like that.
Code:
function onAdvance(player, skill, oldLevel, newLevel)
local config = {
-- [level] {mountId and mountName}
[100] = {mountId = 1, mountName = "Widow Queen"},
[2000] = {mountId = 2, mountName = "Racing Bird"},
}
if skill ~= SKILL_LEVEL or newLevel <= oldLevel then
return true
end
local storage = 2100
for level, i in pairs(config) do
if newLevel >= level and player:getStorageValue(storage) < level then
player:addMount(i.mountId)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you reached level "..newLevel.." and won the "..i.mountName.." mount.")
player:setStorageValue(storage, level)
end
end
return true
end
In level 100 knight will get winow Queen and sorcerer will get a Racing Bird in level 100.
Something like that.