- 0
suporte scripts Problema com script de upgrad
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 1141 visualizações
-
- 4 respostas
- 1818 visualizações
-
- 3 respostas
- 1604 visualizações
-
- 0 respostas
- 1410 visualizações
-
- 3 respostas
- 1557 visualizações
-

Pergunta
gabriel28 60
Tenho um script que a arma vai ganhando experiência e upa de acordo com a quantidade de monstros que o player mata, deixando o item +1 até +10. Só que, ao invés da descrição do item ficar: You see a brass armor +2 (arm: 9), fica assim: You see a brass armor +1 +2 (arm: 10). Sempre que upa o level, vai acrescentando na descrição.
Segue o script do sistema:
function getItemExp(item) if item.itemid > 0 then return getItemAttribute(item.uid, "exp") or 0 end return falseendfunction getItemLevel(item) if item.itemid > 0 then return getItemAttribute(item.uid, "level") or 0 end return falseendfunction doItemAddExp(item) if item.itemid > 0 then return doItemSetAttribute(item.uid, "exp", getItemExp(item) + 1) end return falseendfunction doItemAddLevel(item, count) if item.itemid > 0 and tonumber(count) then return doItemSetAttribute(item.uid, "level", getItemLevel(item) + count) end return falseendlocal table_of_slots = {"head", "body", "legs", "feet", "hands"} --Slots. Ex.: {"head", "body"}local min_exp = 500 -- Exp mínima para o monstro valer (exp que fica no monster.xml)local exp_levels = {2, 4, 6, 180, 280, 400, 550, 700, 900, 1500} -- Exp pra upar. A cada vez que um item atigingir um desses valores de exp, ele upa 1 lvl. (Tem 10, ou seja, nível máximo do item = 10) Pode por mais leveis se quiser.local slots = { ["head"] = 1, ["body"] = 4, ["legs"] = 7, ["feet"] = 8, ["hands"] = {5, 6},}function onKill(cid, target, lastHit) local tab = {} if isPlayer(cid) and isMonster(target) then if getMonsterInfo(getCreatureName(target)).experience >= min_exp then if #table_of_slots > 0 then for a, b in pairs(table_of_slots) do if slots[b] then if type(slots[b]) == "table" then for i = 1, #slots[b] do local tb = slots[b] table.insert(tab, tb[i]) end else table.insert(tab, slots[b]) end end end end if #tab > 0 then for i = 1, #tab do local item = getPlayerSlotItem(cid, tab[i]) if item.uid > 0 then doItemAddExp(item) if getItemLevel(item) then if isInArray(exp_levels, getItemExp(item)) then if getItemInfo(item.itemid).attack > 0 or getItemInfo(item.itemid).defense > 0 or getItemInfo(item.itemid).armor > 0 then if getItemLevel(item) ~= #exp_levels then doItemAddLevel(item, 1) doItemSetAttribute(item.uid, "name", getItemName(item.uid).." +"..getItemLevel(item)) doSendMagicEffect(getThingPos(cid), 28) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Seu "..getItemNameById(item.itemid).." atingiu "..getItemExp(item).."exp e ganhou 1 level! Agora ele esta level "..getItemLevel(item)) local atk = getItemAttribute(item.uid, "attack") or getItemInfo(item.itemid).attack local def = getItemAttribute(item.uid, "defense") or getItemInfo(item.itemid).defense local arm = getItemAttribute(item.uid, "armor") or getItemInfo(item.itemid).armor if getItemInfo(item.itemid).armor > 0 then doItemSetAttribute(item.uid, "armor",arm + 1) elseif getItemInfo(item.itemid).attack > 0 then doItemSetAttribute(item.uid, "attack",atk + 1) elseif getItemInfo(item.itemid).defense > 0 and getItemInfo(item.itemid).attack <= 0 then doItemSetAttribute(item.uid, "defense",def + 1) end end end end end end end end end end return trueendfunction onLogin(cid) registerCreatureEvent(cid, "Item level") return trueend
Editado por PoccnnGostaria que não conflitasse com outro script que tenho, que muda a descrição também. É um script que adiciona reflet ao equipamento, ficando: You see a brass armor ref 2% (arm: 8).
Dai com esse script, ficaria: You see a brass armor +1 ref 2% (arm: 9).
Agradeço desde já.
Link para o comentário
https://xtibia.com/forum/topic/243608-problema-com-script-de-upgrad/Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados