Postado Junho 3, 2018 7 anos TFS 1.3 Opa galera tudo bem?? Estou com 1 pequeno problema na parte de Creaturescripts do sistema... Bom, o problema é basicamente assim, ele esta funcionando !! Porem o critical e o dodge só funciona em HP e se o mage usar UTAMO VITA, o script não funciona, segue o script: -- CRITICAL local talk = { [1] = "Critico!", [2] = "Aii...", [3] = "Paraa", [4] = "Essa doeu :(", } function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) local msgs = talk[math.random(1,4)] if isMonster() then return false end if (creature:getCriticalLevel() * 3) >= math.random (0, 1000) then if isInArray({ORIGIN_MELEE, ORIGIN_RANGED, ORIGIN_SPELL}, origin) and primaryType ~= COMBAT_HEALING then primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT) creature:say(talk[math.random(1,4)], TALKTYPE_MONSTER_SAY) creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT) return primaryDamage, COMBAT_ENERGYDAMAGE, secondaryDamage, COMBAT_FIREDAMAGE end end return primaryDamage, primaryType, secondaryDamage, secondaryType end -- DODGE function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) if not isPlayer(creature) then return false end if (creature:getDodgeLevel() * 3) >= math.random (0, 1000) and isCreature(attacker) then if isInArray({ORIGIN_MELEE, ORIGIN_RANGED, ORIGIN_SPELL}, origin) and primaryType ~= COMBAT_HEALING then primaryDamage = primaryDamage - math.ceil(primaryDamage * DODGE.PERCENT) creature:say("DODGE!", TALKTYPE_MONSTER_SAY) creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT) end end return primaryDamage, primaryType, secondaryDamage, secondaryType end Ambos os sistemas estão funcionando, porém somente para o HP e não para a mana (do utamo vita) Lib utilizada: -- Configuração DODGE = { STORAGE = 48900, -- player storage do sistema LEVEL_MAX = 100, -- máximo de dodge level que o player pode alcançar PERCENT = 0.5 -- porcentagem que irá defender o ataque [padrão 50% = 0.5] } CRITICAL = { STORAGE = 48901, -- player storage do sistema LEVEL_MAX = 100, -- máximo de critical level que o player pode alcançar PERCENT = 0.5 -- porcentagem que irá aumentar o ataque [padrão 50% = 0.5] } function Player.getDodgeLevel(self) return self:getStorageValue(DODGE.STORAGE) end function Player.setDodgeLevel(self, value) return self:setStorageValue(DODGE.STORAGE, value) end function Player.getCriticalLevel(self) return self:getStorageValue(CRITICAL.STORAGE) end function Player.setCriticalLevel(self, value) return self:setStorageValue(CRITICAL.STORAGE, value) end Agradeço desde já Obs: Creio eu que seja porque a function que estou usando: function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) é somente para HP eu deveria usar a: function onManaChange(creature, attacker, manaChange, origin) Só que eu não sei utilizar ela Editado Junho 3, 2018 7 anos por tataboy67 (veja o histórico de edições) Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Junho 3, 2018 7 anos O sistema que vc está usando foi criado para ter essa finalidade de defender só na life, testa esse sistema diferente mas funcional, acredito que funcione na forma que deseja creaturescript crie um arquivo CombatDodge.lua local storagedodge = 98798644 -- storage do dodge local cor = 35 -- cor do texto local effect = 30 -- id do magic effect local msg = "DODGE!" -- msg local dodge = { {min = 1, max = 2, chance = 10}, -- se o dodge tiver entre 1 e 2 tem 10% de chance de da dodge. {min = 3, max = 4, chance = 20}, -- podem ser configurada portanto que não passe do limite {min = 5, max = 6, chance = 30}, -- vocês pode adicionar mas se quiserem {min = 7, max = 8, chance = 40}, {min = 9, max = 10, chance = 45}, {min = 11, max = math.huge, chance = 50} } function onStatsChange(cid, attacker, type, combat, value) if not isCreature(cid) then return false end for _, tudo in pairs(dodge) do if getPlayerStorageValue(cid, storagedodge) >= tudo.min and getPlayerStorageValue(cid, storagedodge) <= tudo.max then local chancex = math.random(1, 100) if chancex <= tudo.chance then if combat ~= COMBAT_HEALING then doSendMagicEffect(getCreaturePosition(cid), effect) doSendAnimatedText(getCreaturePosition(cid), msg, cor) return false end end end end return true end creaturescript.xml <event type="StatsChange" name="CombatDodge" event="script" value="CombatDodge.lua"/> Ainda no creaturescript, adicione no login.lua esta linha registerCreatureEvent(cid, "CombatDodge") Agora em action crie um arquivo dodgestone.lua local limite = 100 -- limite de dodge local storagedodge = 98798644 -- storage do dodge function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, storagedodge) == -1 then doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 2) doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].") elseif getPlayerStorageValue(cid, storagedodge) >= -1 and getPlayerStorageValue(cid, storagedodge) <= limite then doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 1) doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].") doRemoveItem(item.uid, 1) else doPlayerSendCancel(cid, "Voce ja chego no maximo.DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."]") end return true end action.xml <action itemid="8302" event="script" value="dodgestone.lua"/> o itemid é o ID do item que vai adicionar o nivel de dodge do personagem! “Enquanto nos derem ao menos 1% de chance, seguiremos lutando. E venceremos! Esse é o verdadeiro e único Clube da Fé! Vai São Paulo!”
Postado Junho 3, 2018 7 anos Autor 8 minutos atrás, Bagon disse: O sistema que vc está usando foi criado para ter essa finalidade de defender só na life, testa esse sistema diferente mas funcional, acredito que funcione na forma que deseja creaturescript crie um arquivo CombatDodge.lua local storagedodge = 98798644 -- storage do dodge local cor = 35 -- cor do texto local effect = 30 -- id do magic effect local msg = "DODGE!" -- msg local dodge = { {min = 1, max = 2, chance = 10}, -- se o dodge tiver entre 1 e 2 tem 10% de chance de da dodge. {min = 3, max = 4, chance = 20}, -- podem ser configurada portanto que não passe do limite {min = 5, max = 6, chance = 30}, -- vocês pode adicionar mas se quiserem {min = 7, max = 8, chance = 40}, {min = 9, max = 10, chance = 45}, {min = 11, max = math.huge, chance = 50} } function onStatsChange(cid, attacker, type, combat, value) if not isCreature(cid) then return false end for _, tudo in pairs(dodge) do if getPlayerStorageValue(cid, storagedodge) >= tudo.min and getPlayerStorageValue(cid, storagedodge) <= tudo.max then local chancex = math.random(1, 100) if chancex <= tudo.chance then if combat ~= COMBAT_HEALING then doSendMagicEffect(getCreaturePosition(cid), effect) doSendAnimatedText(getCreaturePosition(cid), msg, cor) return false end end end end return true end creaturescript.xml <event type="StatsChange" name="CombatDodge" event="script" value="CombatDodge.lua"/> Ainda no creaturescript, adicione no login.lua esta linha registerCreatureEvent(cid, "CombatDodge") Agora em action crie um arquivo dodgestone.lua local limite = 100 -- limite de dodge local storagedodge = 98798644 -- storage do dodge function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, storagedodge) == -1 then doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 2) doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].") elseif getPlayerStorageValue(cid, storagedodge) >= -1 and getPlayerStorageValue(cid, storagedodge) <= limite then doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 1) doPlayerSendCancel(cid, " DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."].") doRemoveItem(item.uid, 1) else doPlayerSendCancel(cid, "Voce ja chego no maximo.DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..limite.."]") end return true end action.xml <action itemid="8302" event="script" value="dodgestone.lua"/> o itemid é o ID do item que vai adicionar o nivel de dodge do personagem! Bom coloquei ele direitinho no servidor e dá esse erro... Ele não vai pois nas funções do TFS 1.2 não existe :function onStatsChange(cid, attacker, type, combat, value) Por isso tive que buscar outro tipo de script, a function que o TFS 1.2+ suporta são: https://otland.net/threads/tfs-1-2-all-main-interface-functions.252859/ ----------- Os sistemas que estou utilizando são esses:https://www.xtibia.com/forum/topic/234507-tfs-1x-dodge-system/ ehttps://www.xtibia.com/forum/topic/234508-tfs-1x-critical-system/ Ambos usam a função: function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) Porem só para HP... Agora o de mana teria que adicionar 1 nova function, que seria a de: function onManaChange(creature, attacker, manaChange, origin) porem n sei adicionar essa function Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Julho 26, 2018 6 anos Em 20/07/2018 em 18:27, victor4312 disse: tentem esse Não existe a função: function onStatsChange no tfs 1.3 nem no 1.2
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.