Ir para conteúdo

Featured Replies

Postado

Então galera ,

 

Estou com um problema , tenho uma spell no meu server que ele adicionar uma porcentagem de vida, porem quando a pessoa desativa esse buff ou acaba o tempo dela , o personagem as vezes acaba morrendo.

 

O que eu queria era colocar coldown nela. E que n fizesse o personagem morrer.

 

OBS: é um servidor de naruto

 

a Skill é essa.

local giantStamina = {50, 45, 40, 35, 30}  
local giantGain = {100, 125, 150, 175, 200}   
local conditions = {}

for i = 1,5 do
conditions[i] = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditions[i], CONDITION_PARAM_TICKS, 9999999999)
setConditionParam(conditions[i], CONDITION_PARAM_SKILL_FIST, 5)
setConditionParam(conditions[i],CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 100 + (giantGain[i]))
end


local function finishJutsu(cid)   
if not isCreature(cid) then return true end
   local giant = getStorage(cid, 10721)
   if giant > 0 then
      setStorage(cid, 10721, 0)
      local jutsuLv = getJutsuLevel(cid, "chou_baika")
      local healthGainPercent = giantGain[jutsuLv]*0.01
      local maxHealth = getPlayerHealthMax(cid)
      local healthChange = - math.ceil(maxHealth * healthGainPercent)
      doCreatureAddHealth(cid, healthChange)
      doRemoveCondition(cid, CONDITION_ATTRIBUTES)
      doSendMagicEffect(getCreaturePosition(cid), 10)
      normalizeOutfit(cid)
   end
   
end


local function checkHorengan(cid, stamina)
if not isCreature(cid) then return true end

    if(getStorage(cid, 10721) == 1) and canDoJutsu(cid) and getPlayerState(cid) ~= 'rest' and getPlayerStamina(cid) > 0 then
       changeStamina(cid, stamina)
       changeLookType(cid, 430, 0)
       if isCreature(cid) then
          addEvent(valid(checkHorengan), 1000, cid, stamina)
       end
    else
       return finishJutsu(cid)
    end
    
end

local function preHorengan(cid, stamina)
if not isCreature(cid) then return true end
   doSendMagicEffect(getCreaturePosition(cid), 10)
   changeLookType(cid, 430, 0)
   doCreatureSay(cid, "BAIKA NO JUTSU!!!", TALKTYPE_ORANGE_1)
   checkHorengan(cid, stamina)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, 10721) > 0 then
return finishJutsu(cid)
end

   local pill = getStorage(cid, 10238)
   if pill > 0 then
      return doPlayerSendCancel(cid, "You cannot use chou baika while on effect of pills.")
   end

if getPlayerStorageValue(cid, 9000) == 'doing jutsu' then
return doPlayerSendCancel(cid, "You are already doing a jutsu.")
end

   if doJutsu(cid, 'chou_baika') then
      doCreatureSay(cid, "Chou!!", TALKTYPE_ORANGE_1)
      setStorage(cid, 10721, 1)
      local jutsuLv = getJutsuLevel(cid, 'chou_baika')
      local preHealth = getCreatureHealth(cid)
      local preMaxHealth = getCreatureMaxHealth(cid)
      local percent = getPercent(preHealth, preMaxHealth)
      -- add condition
      doAddCondition(cid, conditions[jutsuLv])
      ---
      local buffedMaxHealth = getCreatureMaxHealth(cid)
      local healthChange = math.floor(buffedMaxHealth * ((100 - percent)/100))
      doCreatureAddHealth(cid, buffedMaxHealth)
      doCreatureAddHealth(cid,  - healthChange)
      local stamina = giantStamina[jutsuLv]
      changeLookType(cid, 428, 0.5)
      addEvent(changeLookType, 500, cid, 429, 2.5)
      addEvent(preHorengan, 1000, cid, stamina)
   end   
      
end

Editado por Romario Vieira (veja o histórico de edições)

Postado
Para o cooldown basta adicionar isso em baixo de doCreatureAddHealth(cid, healthChange):   
  addEvent(function () setStorage(cid, 9000, 1) end, os.clock()+60)
PS: modifiquei conforme seu script em um Tibia normal seria "setPlayerStorageValue"...
     Porém não entendi como ele  morre uma hora e outra não ...  :huh:

Editado por Vinicius Xxgamexx (veja o histórico de edições)

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

Postado
  • Autor

 

Para o cooldown basta adicionar isso em baixo de doCreatureAddHealth(cid, healthChange):   
  addEvent(function () setStorage(cid, 9000, 1) end, os.clock()+60)
PS: modifiquei conforme seu script em um Tibia normal seria "setPlayerStorageValue"...
     Porém não entendi como ele  morre uma hora e outra não ...  :huh:

 

tipo no healthChange vc tem 100 de vidas e usa o buff de 200% a vida vai pra 300 só que quando desativa o buff tu perde 200 de vida ai se tu tiver com menos desse valor tu morre

Postado

Caso o valor da redução seja igual a 0 ele vai ganhar 5% do life máximo dele para não morrer...

E logo em seguida diminuir a porcentagem de life que ele ganhou... (Com a spell)

Mude:

local function finishJutsu(cid) 
if not isCreature(cid) then return true end
local giant = getStorage(cid, 10721)
if giant > 0 then
setStorage(cid, 10721, 0)
local jutsuLv = getJutsuLevel(cid, "chou_baika")
local healthGainPercent = giantGain[jutsuLv]*0.01
local maxHealth = getPlayerHealthMax(cid)
local healthChange = - math.ceil(maxHealth * healthGainPercent)
doCreatureAddHealth(cid, healthChange)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doSendMagicEffect(getCreaturePosition(cid), 10)
normalizeOutfit(cid)
end

end

por:

local function finishJutsu(cid)   
if not isCreature(cid) then return true end
   local giant = getStorage(cid, 10721)
   if giant > 0 then
      setStorage(cid, 10721, 0)
      local jutsuLv = getJutsuLevel(cid, "chou_baika")
      local healthGainPercent = giantGain[jutsuLv]*0.01
      local maxHealth = getPlayerHealthMax(cid)
      local healthChange = - math.ceil(maxHealth * healthGainPercent)
      if getCreatureHealth(cid) - math.ceil(maxHealth * healthGainPercent) == 0 then
      doCreatureAddHealth(cid, 5*getCreatureMaxHealth(cid)/100)
      end
      doCreatureAddHealth(cid, healthChange)
      doRemoveCondition(cid, CONDITION_ATTRIBUTES)
      doSendMagicEffect(getCreaturePosition(cid), 10)
      normalizeOutfit(cid)
   end
   
end

Editado por Vinicius Xxgamexx (veja o histórico de edições)

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.2k

Informação Importante

Confirmação de Termo