Ir para conteúdo
  • Cadastre-se

(Resolvido)Dano equivalente ao seu life atual


Ir para solução Resolvido por Danves,

Posts Recomendados

É o seguinte eu fiz essa script mas não to conseguindo coloca o dano do jeito que eu quero,

eu quero que atinga o oponente com um dano equivalente a 10% do seu life atual.

 

Por exemplo eu to com 700 de life ai uso a magia e do um atk de 70,

outro exemplo eu to com 300 de life ai uso a magia e do um atk de 30

 

Eu já tenho a script feita só basta adicionar o dano.

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
 
local storage = 10002
local tempo = 2
local mana = 12
local ClearMind = 10000
 
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, storage) < os.time() then
if getPlayerStorageValue(cid, ClearMind) == -1 then
if getCreatureMana(cid) >= mana then
doCombat(cid, combat, var)
setPlayerStorageValue(cid, storage, os.time() + tempo)
doCreatureAddMana(cid, -mana)
else
doPlayerSendCancel(cid, "É preciso de "..mana.." para usar a magia.")
return false
end
elseif getCreatureMana(cid) >= (mana/2) then
doCombat(cid, combat, var)
doCreatureAddMana(cid, -mana/2)
setPlayerStorageValue(cid, storage, os.time() + tempo)
else 
doPlayerSendCancel(cid, "É preciso de "..mana.." para usar a magia.")
return false
end
else
doPlayerSendCancel(cid,  "Você tem que esperar "..getPlayerStorageValue(cid, storage) - os.time().." segundos para usar a magia novamente.")
return false
end
return true
end
Editado por RigBy (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
 
local storage = 10002
local tempo = 2
local mana = 12
local ClearMind = 10000
 
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, storage) < os.time() then
if getPlayerStorageValue(cid, ClearMind) == -1 then
if getCreatureMana(cid) >= mana then
doCombat(cid, combat, var)
setPlayerStorageValue(cid, storage, os.time() + tempo)
doCreatureAddMana(cid, -mana)
else
doPlayerSendCancel(cid, "É preciso de "..mana.." para usar a magia.")
return false
end
elseif getCreatureMana(cid) >= (mana/2) then
health = getCreatureHealth(cid)/10
health = math.ceil(health)
doTargetCombatHealth(cid, variantToNumber(var), COMBAT_FIREDAMAGE, -health, -health, -1)
doCombat(cid, combat, var)
doCreatureAddMana(cid, -mana/2)
setPlayerStorageValue(cid, storage, os.time() + tempo)
else 
doPlayerSendCancel(cid, "É preciso de "..mana.." para usar a magia.")
return false
end
else
doPlayerSendCancel(cid,  "Você tem que esperar "..getPlayerStorageValue(cid, storage) - os.time().." segundos para usar a magia novamente.")
return false
end
return true
end
Editado por Danves (veja o histórico de edições)



 tumblr_mwfeg45FIV1qk4cb3o4_500.gif

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo