Postado Setembro 10, 2018 6 anos Bom galera queria que alguem min ajuda-se fazer uma modificaçoes nesses script. CRITICAL: Mostrar conteúdo oculto --[[Critical System ------------------------- By Night Wolf]] local lvlcrit = 48913 local multiplier = 1.5 function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then dano = math.ceil(value*(multiplier)) doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255) doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144) return false end end return true end DODGE: Mostrar conteúdo oculto local SKILL_ID = 5 -- id do skill... local skills = { {min = 21, max = 40, chance = 5}, -- chance em % de dar miss... {min = 41, max = 60, chance = 10}, {min = 61, max = 80, chance = 15}, {min = 81, max = 100, chance = 20}, {min = 101, max = 120, chance = 25}, {min = 121, max = math.huge, chance = 30} } function onStatsChange(cid, attacker, type, combat, value) local COLOR_ID = 200 -- cor do texto local MAGIC_EFFECT = 1 -- id do magic effect if not isCreature(cid) then return false end for _, tudo in pairs(skills) do if getPlayerSkillLevel(cid, SKILL_ID) >= tudo.min and getPlayerSkillLevel(cid, SKILL_ID) <= tudo.max then local chancex = math.random(1, 100) if chancex <= tudo.chance then if combat ~= COMBAT_HEALING then doSendMagicEffect(getCreaturePosition(cid), MAGIC_EFFECT) doSendAnimatedText(getCreaturePosition(cid), "MISS!", COLOR_ID) return false end end end end return true end Bom o que eu quero fazer é bem simples. quero que quanto maior for meu skill axe, maior será a chance de eu acerta um critical. Eo o dodge quase msm, só mudar que a skill escolhida é o shield. quanto maior for o shiled, maior sera a chance de desviar o dano. TIPO cada 1 level da skill escolhida é = 0.3% de chance. 3 skill = 0,9% de chance assim por diante. TFS 0.4 CREDITOS: @xWhiteWolf pelo script do critical e outro encontrei pela a net Editado Setembro 10, 2018 6 anos por BangxD (veja o histórico de edições)
Postado Setembro 10, 2018 6 anos Solução Mostrar conteúdo oculto local SKILL_ID = 5 -- id do skill... local percentual = 0.3 function onStatsChange(cid, attacker, type, combat, value) local COLOR_ID = 200 -- cor do texto local MAGIC_EFFECT = 1 -- id do magic effect if not isCreature(cid) then return false end for _, tudo in pairs(skills) do local chance = (getPlayerSkillLevel(cid, SKILL_ID) * percentual) * 10 if math.random(1, 1000) <= chance then if combat ~= COMBAT_HEALING then doSendMagicEffect(getCreaturePosition(cid), MAGIC_EFFECT) doSendAnimatedText(getCreaturePosition(cid), "MISS!", COLOR_ID) return false end end end return true end Mostrar conteúdo oculto local SKILL_ID = 3 -- id do skill... local multiplier = 1.5 local percentual = 0.3 function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then local chance = (getPlayerSkillLevel(cid, SKILL_ID) * percentual) * 10 if math.random(1, 1000) <= chance then dano = math.ceil(value*(multiplier)) doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255) doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144) return false end end return true end
Postado Setembro 10, 2018 6 anos Autor Obg, erro meu esqueci de add a tag no xml. Editado Setembro 10, 2018 6 anos por BangxD (veja o histórico de edições)
Postado Agosto 20, 2020 4 anos Estou com esse erro. [Error - CreatureScript Interface] data/creaturescripts/scripts/critical.lua:onStatsChange Description: (luaGetPlayerSkillLevel) Player not found [Error - CreatureScript Interface] data/creaturescripts/scripts/critical.lua:onStatsChange Description: data/creaturescripts/scripts/critical.lua:9: attempt to perform arithmetic on a boolean value stack traceback: data/creaturescripts/scripts/critical.lua:9: in function <data/creaturescripts/scripts/critical.lua:7>
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.