@UP
- Fórum
- xTibia - Notícias e Suporte
- Soluções
- Archived
- Critical skill system..
6
1.5k
25 de abril de 2015 às 17:49
25 de abril de 2015 às 18:55
Action:
local config = {
maxSkill = 100, --Nível máximo de critical.
pointPerItem = 1, --Quantos pontos em critical irá ganhar por item.
storage = 9571,
}
function onUse(cid, item)
if getPlayerStorageValue(cid, config.storage) >= config.maxSkill then
return doPlayerSendCancel(cid, "You already reached the maximum critical level. ["..config.maxSkill.."]")
end
setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) > -1 and getPlayerStorageValue(cid, config.storage) + 1 or 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..config.pointPerItem.." point(s) on critical skill.\nPoints: ["..getPlayerStorageValue(cid, config.storage).."/"..config.maxSkill.."]")
doRemoveItem(item.uid, 1)
return true
end
Creaturescript:
local config = {
chancePerLevel = 3, --Chance, por nível, de acerto crítico.
extraDamage = 50, --Bônus extra, em porcentagem, de dano.
storage = 9571,
}
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and getPlayerStorageValue(attacker, config.storage) > -1 and type == STATSCHANGE_HEALTHLOSS then
if math.random(config.chancePerLevel, config.chancePerLevel * 100) <= config.chancePerLevel * getPlayerStorageValue(attacker, config.storage) then
value = math.floor(value * config.extraDamage / 100)
doSendAnimatedText(getThingPos(cid), "CRITICAL!", 255)
end
end
return true
endNão se esqueça de registrar o evento em login.lua.
Editado Abril 25 por zipter98
info
Grupo: Cavaleiro
Registrado: 14/04/15
Posts: 191
Reputação: +2

26 de abril de 2015 às 09:44
Como add no action.xml? Server pra todas as armas do jogo. Pq eu só queria pra armar de físico que só ataca de perto e distance menos wand.
Editado Abril 26 por Xtudomuito
26 de abril de 2015 às 14:11
Action:
local config = { maxSkill = 100, --Nível máximo de critical. pointPerItem = 1, --Quantos pontos em critical irá ganhar por item. storage = 9571, } function onUse(cid, item) if getPlayerStorageValue(cid, config.storage) >= config.maxSkill then return doPlayerSendCancel(cid, "You already reached the maximum critical level. ["..config.maxSkill.."]") end setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) > -1 and getPlayerStorageValue(cid, config.storage) + 1 or 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received: "..config.pointPerItem.." point(s) on critical skill.\nPoints: ["..getPlayerStorageValue(cid, config.storage).."/"..config.maxSkill.."]") doRemoveItem(item.uid, 1) return true endCreaturescript:local config = { chancePerLevel = 3, --Chance, por nível, de acerto crítico. extraDamage = 50, --Bônus extra, em porcentagem, de dano. storage = 9571, } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and getPlayerStorageValue(attacker, config.storage) > -1 and type == STATSCHANGE_HEALTHLOSS then if math.random(config.chancePerLevel, config.chancePerLevel * 100) <= config.chancePerLevel * getPlayerStorageValue(attacker, config.storage) then value = math.floor(value * config.extraDamage / 100) doSendAnimatedText(getThingPos(cid), "CRITICAL!", 255) end end return true endNão se esqueça de registrar o evento em login.lua.
zipter eu testei seu script aqui ele n deu nenhum erro no meu console as função funciona tudo certinho só que ele não tá hitando 50% a mais quando uso as critical parece não surtir efeito algum...
Editado Abril 27 por Gadreel
3 meses depois...






info
Grupo: Campones
Registrado: 19/03/14
Posts: 36
Reputação: +1