vc quer descobrir qual a maior skill do player? incluindo magic level?
info
Grupo: Visconde
Registrado: 11/08/10
Posts: 477
Reputação: +175
Gênero: Masculino

info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

if getPlayerSkillLevel(cid, SKILL_SWORD) >= value then end
info
Grupo: Banidos
Registrado: 25/12/07
Posts: 152
Reputação: +24
Char no Tibia: Tony Scott

Não está funcionando essa função:
elseif getPlayerStorageValue(cid,99934) == -1 and getPlayerSkillLevel(cid, SKILL_SWORD) > SKILL_AXE or SKILL_CLUB and getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then doPlayerAddItem(cid, 2407, 1) doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)]) setPlayerStorageValue(cid, 99934, 1) doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Bright Sword.") elseif getPlayerStorageValue(cid,99934) == -1 and getPlayerSkillLevel(cid, SKILL_CLUB) > SKILL_AXE or SKILL_SWORD and getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then doPlayerAddItem(cid, 2436, 1) doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)]) setPlayerStorageValue(cid, 99934, 1) doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu um Skull Staff.") elseif getPlayerStorageValue(cid,99934) == -1 and getPlayerSkillLevel(cid, SKILL_AXE) > SKILL_SWORD or SKILL_CLUB and getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then doPlayerAddItem(cid, 3962, 1) doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)]) setPlayerStorageValue(cid, 99934, 1) doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Beastslayer Axe.") end
O script só está dando a bright, sendo que meu skill maior é o club.
Editado Agosto 3 por Keilost
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

Se os skills forem iguais, ele vai sortear randomicamente a arma, você só deve completar ali na parte de adicionar, tem que colocar pra setar a storage.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sword, axe, club = getPlayerSkillLevel(cid, SKILL_SWORD), getPlayerSkillLevel(cid, SKILL_AXE), getPlayerSkillLevel(cid, SKILL_CLUB)
local weapons = {"sword", "axe", "club"}
if sword > axe or sword > club then
weapon = "sword"
elseif axe > sword or axe > club then
weapon = "axe"
elseif club > sword or club > axe then
weapon = "club"
else
weapon = weapons[math.random(#weapons)]
end
if getPlayerStorageValue(cid, 389221) == -1 then
if weapon == "sword" then
addSword
elseif weapon == "club" then
addClub
elseif weapon == "axe" then
addAxe
end
else
doPlayerSendCancel(cid, "ERROR MSG.")
end
return true
end
Editado Agosto 3 por Skymagnum
info
Grupo: Visconde
Registrado: 11/08/10
Posts: 477
Reputação: +175
Gênero: Masculino

--- poe essas linhas debaixo do function onUse(...) -- ou a função que seja a principal
local sword = getPlayerSkillLevel(cid, SKILL_SWORD)
local club = getPlayerSkillLevel(cid, SKILL_CLUB)
local axe = getPlayerSkillLevel(cid, SKILL_AXE)
elseif getPlayerStorageValue(cid,99934) == -1 and sword >= club and sword >= axe and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2407, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Bright Sword.")
elseif getPlayerStorageValue(cid,99934) == -1 and club > sword and club > axe and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2436, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu um Skull Staff.")
elseif getPlayerStorageValue(cid,99934) == -1 and axe > sword and axe > club and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 3962, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Beastslayer Axe.")
end
info
Grupo: Banidos
Registrado: 25/12/07
Posts: 152
Reputação: +24
Char no Tibia: Tony Scott

Não deu certo:
local efeito = {27,28, 29,79}
local sword = getPlayerSkillLevel(cid, SKILL_SWORD)
local club = getPlayerSkillLevel(cid, SKILL_CLUB)
local axe = getPlayerSkillLevel(cid, SKILL_AXE)
function onAdvance(cid, skill, oldLevel, newLevel, vocation)
if getPlayerStorageValue(cid,99929) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 1 then
doPlayerAddItem(cid, 2187, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99929, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 33 e recebeu uma Wand Of Inferno.")
elseif getPlayerStorageValue(cid,99930) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 2 then
doPlayerAddItem(cid, 2183, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99930, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 33 e recebeu uma Hailstorm Rod.")
elseif getPlayerStorageValue(cid,99933) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 3 then
doPlayerAddItem(cid, 7367, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99933, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 42 e recebeu um Enchanted Spear.")
elseif getPlayerStorageValue(cid,99934) == -1 and sword >= club and sword >= axe and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2407, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Bright Sword.")
elseif getPlayerStorageValue(cid,99934) == -1 and club > sword and club > axe and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2436, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu um Skull Staff.")
elseif getPlayerStorageValue(cid,99934) == -1 and axe > sword and axe > club and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 3962, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Beastslayer Axe.")
end
end
<luaGetPlayerSkill> Player not found
Isso é uma creaturescript, que dá recompensa ao player, ao ele avançar de level.
E esse é o meu script que não dá erro no distro, mas ele ignora os skills =
local efeito = {27,28, 29,79}
function onAdvance(cid, skill, oldLevel, newLevel, vocation)
if getPlayerStorageValue(cid,99929) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 1 then
doPlayerAddItem(cid, 2187, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99929, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 33 e recebeu uma Wand Of Inferno.")
elseif getPlayerStorageValue(cid,99930) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 2 then
doPlayerAddItem(cid, 2183, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99930, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 33 e recebeu uma Hailstorm Rod.")
elseif getPlayerStorageValue(cid,99933) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 3 then
doPlayerAddItem(cid, 7367, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99933, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 42 e recebeu um Enchanted Spear.")
elseif getPlayerStorageValue(cid,99934) == -1 and getPlayerSkillLevel(cid, SKILL_SWORD) > SKILL_AXE or getPlayerSkillLevel(cid, SKILL_SWORD) > SKILL_CLUB and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2407, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Bright Sword.")
elseif getPlayerStorageValue(cid,99934) == -1 and getPlayerSkillLevel(cid, SKILL_CLUB) > SKILL_AXE or getPlayerSkillLevel(cid, SKILL_CLUB) > SKILL_SWORD and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2436, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu um Skull Staff.")
elseif getPlayerStorageValue(cid,99934) == -1 and getPlayerSkillLevel(cid, SKILL_AXE) > SKILL_SWORD or getPlayerSkillLevel(cid, SKILL_AXE) > SKILL_CLUB and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 3962, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Beastslayer Axe.")
end
return true
end
Editado Agosto 3 por Keilost
info
Grupo: Visconde
Registrado: 11/08/10
Posts: 477
Reputação: +175
Gênero: Masculino

function onAdvance(cid, skill, oldLevel, newLevel, vocation)
local efeito = {27,28, 29,79}
local sword = getPlayerSkillLevel(cid, SKILL_SWORD)
local club = getPlayerSkillLevel(cid, SKILL_CLUB)
local axe = getPlayerSkillLevel(cid, SKILL_AXE)
if getPlayerStorageValue(cid,99929) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 1 then
doPlayerAddItem(cid, 2187, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99929, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 33 e recebeu uma Wand Of Inferno.")
elseif getPlayerStorageValue(cid,99930) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 2 then
doPlayerAddItem(cid, 2183, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99930, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 33 e recebeu uma Hailstorm Rod.")
elseif getPlayerStorageValue(cid,99933) == -1 and getPlayerLevel(cid) == 33 and getPlayerVocation(cid) == 3 then
doPlayerAddItem(cid, 7367, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99933, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 42 e recebeu um Enchanted Spear.")
elseif getPlayerStorageValue(cid,99934) == -1 and sword >= club and sword >= axe and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2407, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Bright Sword.")
elseif getPlayerStorageValue(cid,99934) == -1 and club > sword and club > axe and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 2436, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu um Skull Staff.")
elseif getPlayerStorageValue(cid,99934) == -1 and axe > sword and axe > club and
getPlayerVocation(cid) == 4 and getPlayerLevel(cid) == 30 then
doPlayerAddItem(cid, 3962, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
setPlayerStorageValue(cid, 99934, 1)
doPlayerSendTextMessage(cid, 22, "Você chegou ao level 30 e recebeu uma Beastslayer Axe.")
end
end
eu falei embaixo da função principal, vc colocou em cima u.u
info
Grupo: Banidos
Registrado: 25/12/07
Posts: 152
Reputação: +24
Char no Tibia: Tony Scott

Funcionou, rep ++



info
Grupo: Banidos
Registrado: 25/12/07
Posts: 152
Reputação: +24
Char no Tibia: Tony Scott
Eu gostaria que alguém me respondesse, como é a linha em lua, que faz essa checagem:
se tal skill for maior que os outros then
Grato,
Keilost