Ir para conteúdo

Featured Replies

Postado

Queria ajuda para fazer essa spell aplicar Miss quando quando atingir algum pokémon

Essa é a spell

  Citar

elseif spell == "Shock-Counter" then

local function sendStickEff(cid, dir)
    if not isCreature(cid) then return true end
       doAreaCombatHealth(cid, ELECTRICDAMAGE, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, 40)
    end
    
local function sendStickEff2(cid, dir)
    if not isCreature(cid) then return true end
       doAreaCombatHealth(cid, ELECTRICDAMAGE, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, 201)
    end
        local effect = 201
    local pos = getThingPosWithDebug(cid)
    pos.x = pos.x + 2
    pos.y = pos.y + 1
    if getCreatureName(cid) == "Shiny Electabuzz" then
local function endMove(cid)
if isCreature(cid) then
   doRemoveCondition(cid, CONDITION_OUTFIT)
end
end

doSetCreatureOutfit(cid, {lookType = 1460}, -1)
addEvent(endMove, 900, cid)
end
    doSendMagicEffect(pos, effect)
    local function doStick(cid)
    if not isCreature(cid) then return true end
    local t = {
          [1] = SOUTHWEST,
          [2] = SOUTH,
          [3] = SOUTHEAST,
          [4] = EAST,
          [5] = NORTHEAST,
          [6] = NORTH,
          [7] = NORTHWEST,
          [8] = WEST,
          [9] = SOUTHWEST,
        }
        for a = 1, 9 do
            addEvent(sendStickEff, a * 0, cid, t[a])
        end
        
    end

    doStick(cid, false, cid)
    setPlayerStorageValue(cid, 98654, 1)

 

 

Editado por Thundera
Acho que tinha marcado o prefixo errado (veja o histórico de edições)

  • Respostas 7
  • Visualizações 414
  • Created
  • Última resposta

Top Posters In This Topic

Postado
elseif spell == "Shock-Counter" then
local chance = math.random(1, 40) -- seriam gerados de forma aleatória do 1 ao 40, ou seja pode dar miss ou não!

local function sendStickEff(cid, dir)
    if not isCreature(cid) then return true end
       doAreaCombatHealth(cid, ELECTRICDAMAGE, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, chance)
    end
local function sendStickEff2(cid, dir)
    if not isCreature(cid) then return true end
       doAreaCombatHealth(cid, ELECTRICDAMAGE, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, chance)
    end
        local effect = 201
    local pos = getThingPosWithDebug(cid)
    pos.x = pos.x + 2
    pos.y = pos.y + 1
    if getCreatureName(cid) == "Shiny Electabuzz" then
local function endMove(cid)
if isCreature(cid) then
   doRemoveCondition(cid, CONDITION_OUTFIT)
end
end

doSetCreatureOutfit(cid, {lookType = 1460}, -1)
addEvent(endMove, 900, cid)
end
    doSendMagicEffect(pos, effect)
    local function doStick(cid)
    if not isCreature(cid) then return true end
    local t = {
          [1] = SOUTHWEST,
          [2] = SOUTH,
          [3] = SOUTHEAST,
          [4] = EAST,
          [5] = NORTHEAST,
          [6] = NORTH,
          [7] = NORTHWEST,
          [8] = WEST,
          [9] = SOUTHWEST,
        }
        for a = 1, 9 do
            addEvent(sendStickEff, a * 0, cid, t[a])
        end
        
    end

    doStick(cid, false, cid)
    setPlayerStorageValue(cid, 98654, 1)

 

esta ai @Thundera

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

Postado
  • Autor
  Em 31/08/2019 em 22:53, ZoR disse:
elseif spell == "Shock-Counter" then
local chance = 20 -- tanto de chance tem de acertar isso

local function sendStickEff(cid, dir)
    if not isCreature(cid) then return true end
       math.random(doAreaCombatHealth(cid, ELECTRICDAMAGE, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, 40), chance)
    end

if math.random() == chance then
	doSendAnimatedText(getCreaturePosition(getCreatureSummons(cid)[1]), "Miss!", 10)
end
    
local function sendStickEff2(cid, dir)
    if not isCreature(cid) then return true end
       math.random(doAreaCombatHealth(cid, ELECTRICDAMAGE, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, 40), chance)
    end
        local effect = 201
    local pos = getThingPosWithDebug(cid)
    pos.x = pos.x + 2
    pos.y = pos.y + 1
    if getCreatureName(cid) == "Shiny Electabuzz" then
local function endMove(cid)
if isCreature(cid) then
   doRemoveCondition(cid, CONDITION_OUTFIT)
end
end

doSetCreatureOutfit(cid, {lookType = 1460}, -1)
addEvent(endMove, 900, cid)
end
    doSendMagicEffect(pos, effect)
    local function doStick(cid)
    if not isCreature(cid) then return true end
    local t = {
          [1] = SOUTHWEST,
          [2] = SOUTH,
          [3] = SOUTHEAST,
          [4] = EAST,
          [5] = NORTHEAST,
          [6] = NORTH,
          [7] = NORTHWEST,
          [8] = WEST,
          [9] = SOUTHWEST,
        }
        for a = 1, 9 do
            addEvent(sendStickEff, a * 0, cid, t[a])
        end
        
    end

    doStick(cid, false, cid)
    setPlayerStorageValue(cid, 98654, 1)

 

esta ai @Thundera

 

Spell está causando dano mas não está causando miss @ZoR

 

Segue aí o erro
[31/08/2019 21:30:59] [Error - CreatureScript Interface] 
[31/08/2019 21:30:59] In a timer event called from: 
[31/08/2019 21:30:59] data/creaturescripts/scripts/exp2.0.lua:onStatsChange
[31/08/2019 21:30:59] Description: 
[31/08/2019 21:30:59] data/lib/pokemon moves.lua:7401: bad argument #1 to 'random' (number expected, got boolean)
[31/08/2019 21:30:59] stack traceback:
[31/08/2019 21:30:59]     [C]: in function 'random'
[31/08/2019 21:30:59]     data/lib/pokemon moves.lua:7401: in function <data/lib/pokemon moves.lua:7399>

 

https://imgur.com/GnwmLHb aqui está um gif da spell p ter uma noção melhor

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

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo