Jump to content

(Resolvido)Feitiço caindo do céu


Go to solution Solved by So volto tarde,

Recommended Posts

Ei, eu uso o baixo PokeAimar e tenho um problema com o feitiço, ou seja, eu adicionei o feitiço Shadow Storm e ele cai tudo de uma vez e eu quero que este feitiço caia do céu aleatoriamente, é claro com os mesmos efeitos se eu pudesse peça ajuda e uma resposta rápida, ficaria muito grato

Quote

local SKILL_NAME = "Shadow Storm"
local SKILL_AREAS = {
    createCombatArea(ShadowStorm),
    createCombatArea(ShadowStorm),
    createCombatArea(ShadowStorm)
}
local rand = 60 / #SKILL_AREAS

local combats = {}
for i, skillArea in ipairs(SKILL_AREAS) do
    combats[i] = createCombatObject()
    onTargetCreature_ShadowStorm = function(cid, target)
        doSkillDamage(cid, target, SKILL_NAME)
        if (not isCreature(target)) then return end -- Defeated
        if (not doPokemonSpecialAbilityCheck(target, POKEMON_SPECIAL_ABILITY_IDS.SHIELD_DUST, nil) and getRandom(0, 100) <=
                (doPokemonSpecialAbilityCheck(cid, POKEMON_SPECIAL_ABILITY_IDS.SERENA_GRACE, nil) and (rand * 2) or rand)) then
            doCreatureAddStatus(target, CREATURE_STATUS_FLINCH, nil, cid)
        end
    end
    onTargetTile_ShadowStorm = function(cid, position)
        position.x = position.x + math.random(0, 2)
        position.y = position.y + math.random(0, 2)
        doSendDistanceShoot(getSkyPosition(position), position, PROJECTILE_NIGHT_SHADE)
        addEvent(doSendMagicEffect, 150, randomposition, EFFECT_SHADOW_STORM)
    end
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature_ShadowStorm")
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "onTargetTile_ShadowStorm")
    setCombatArea(combats[i], skillArea)
end

local function doSpell(cid, combat, var)
    if (isCreature(cid)) then
        doCombat(cid, combat, var)
    end
end

function onCastSpell(cid, var)
    for i, combat in ipairs(combats) do
        addEvent(doSpell, 8000 * (i - 1) + 1, cid, combat, var)
    end
    return true
end

 

 

Quote

MOVES["Shadow Storm"] = {
    description = "Rock Slide deals damage and has a 30% chance of causing the target to flinch.",
    category = MOVE_CATEGORY.PHYSICAL,
    clientIconId = 11788,
    iconId = 0,
    dType = DAMAGE_TYPE_GHOST,
    functionName = "ShadowStorm",
    type = SKILLS_TYPES.AREA,
    requiredEnergy = 0,
    requiredLevel = 25,
    damage = 38,
    damageType = ELEMENT_GHOST,
    effect = EFFECT_SHADOW_STORM,
    areaName = "bigArea",
    area = bigArea,
    cooldownTime = 15,
    cooldownStorage = 15241
}

 

Link to post
Share on other sites
  • Assistente

se eu entendi bem, você quer que, tenha um delay entre os distance shoots caindo do céu e o efeito que é enviado no tile

sendo assim, segue:

na linha "addEvent(doSendMagicEffect, 150, randomposition, EFFECT_SHADOW_STORM)", altere o valor em amarelo para o tempo desejado em milissegundos (1000 = 1 segundo)

 

image.thumb.png.6b7c77d962061b50437532e80c3efb70.png

Link to post
Share on other sites
  • Assistente
6 horas atrás, Step Records disse:

@So volto tarde

Meu ponto é que agora ele supera esse feitiço aleatoriamente, mas todos os efeitos são de uma vez e eu gostaria de ver gerações do céu e não todas de uma vez

poderia enviar um gif/vídeo de como está a spell no momento?

Link to post
Share on other sites
  • Assistente

é apenas um chute, tenho familiaridade 0 com spells de poketibia, mas tentei mesclar com um outro script da comunidade, também não testei

desabilitei os magic effects para melhor depuração

local SKILL_NAME = "Shadow Storm"
local SKILL_AREAS = {
    createCombatArea(ShadowStorm),
    createCombatArea(ShadowStorm),
    createCombatArea(ShadowStorm)
}
local rand = 60 / #SKILL_AREAS

local combats = {}
for i, skillArea in ipairs(SKILL_AREAS) do
    combats[i] = createCombatObject()
    onTargetCreature_ShadowStorm = function(cid, target)
        doSkillDamage(cid, target, SKILL_NAME)
        if (not isCreature(target)) then return end -- Defeated
        if (not doPokemonSpecialAbilityCheck(target, POKEMON_SPECIAL_ABILITY_IDS.SHIELD_DUST, nil) and getRandom(0, 100) <=
                (doPokemonSpecialAbilityCheck(cid, POKEMON_SPECIAL_ABILITY_IDS.SERENA_GRACE, nil) and (rand * 2) or rand)) then
            doCreatureAddStatus(target, CREATURE_STATUS_FLINCH, nil, cid)
        end
    end
    onTargetTile_ShadowStorm = function(cid, position)
	local t = {}
	local posic = getThingPos(cid)
	for x = =7. 7 do
		for y = -7, 7 do
			local posi = {x = posic.x + x, y = posic.y + y, z = posic.z, stackpos = 0}
			table.insert(t, posi)
		end
	end
	
	local function doFallShadow(cid, pos)
		if not isCreature(cid) then return true end
		local apos = pos
		local frompos = {x=apos.x-7,y=apos.y-6,z=apos.z}
		doSendDistanceShoot(frompos, pos, PROJECTILE_NIGHT_SHADE)
	end
        
	for v = 1, #t do
		if #t >= 1 then
			local random = math.random(1, #t)
			addEvent(doFallShadow, v * 24, cid, t[random])
			t = doRemoveElementFromTable(t, t[random])
		end
	end
        -- addEvent(doSendMagicEffect, 150, randomposition, EFFECT_SHADOW_STORM) dstv efeito
    end
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature_ShadowStorm")
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "onTargetTile_ShadowStorm")
    setCombatArea(combats[i], skillArea)
end

local function doSpell(cid, combat, var)
    if (isCreature(cid)) then
        doCombat(cid, combat, var)
    end
end

function onCastSpell(cid, var)
    for i, combat in ipairs(combats) do
        addEvent(doSpell, 8000 * (i - 1) + 1, cid, combat, var)
    end
    return true
end

 

Link to post
Share on other sites
Quote

[Error - LuaScriptInterface::loadFile] data/spells/scripts/../../lib/ps/events/spells/scripts/Shadow Storm.lua:23: unexpected symbol near '='
[Warning - Event::loadScript] Cannot load script (data/spells/scripts/../../lib/ps/events/spells/scripts/Shadow Storm.lua)
data/spells/scripts/../../lib/ps/events/spells/scripts/Shadow Storm.lua:23: unexpected symbol near '='

 

Link to post
Share on other sites
  • Assistente
9 horas atrás, Step Records disse:

 

perdão, substitua as linhas 23 e 24 por

    for x = -7. 7 do
        for y = -7, 7 do

 

//edit

https://gyazo.com/654569b32d693794d021ea5db971cf5f

 

se for este o resultado esperado, creio que basta adaptar para o poketibia, segue o código:

Spoiler
function fallProjectile(cidpos)
    if not isCreature(cidthen return true end
    local apos = pos
    local frompos = {x=apos.x-7,y=apos.y-6,z=apos.z}
    doSendDistanceShoot(frompospos7)
end
 
function sendEff(cidpos
    if not isCreature(cidthen return true end
    local apos = pos
    doSendMagicEffect(apos, CONST_ME_ICEATTACK)
end
 
function onCastSpell(cidvar)
 
    local t = {}
    local posic = getThingPos(cid)
 
    for x = -66 do
        for y = -78 do
            local posi = {x = posic.x + xy = posic.y-5 + yz = posic.z, stackpos = 0}
            table.insert(tposi)
        end
    end
 
    for v = 1#t do
        if (#t >= 1then
            local random = math.random(1#t)
            addEvent(fallProjectile, v * 12cidt[random])
            addEvent(sendEff, v * 14cidt[random])
        end
    end
 
    return true
end

 

 

Link to post
Share on other sites
Posted (edited)

@So volto tarde

e agora você pode me explicar por que quando eu colo tudo isso em spella shadow Storm e blizzard ele mostra uma animação? : / e vou acrescentar que nem um nem outro soletram nada supera 0 erros no console

Blizzard:

Spoiler

local SKILL_NAME = "Blizzard"
local SKILL_AREAS = {
    createCombatArea(Blizzard),
    createCombatArea(Blizzard)
}
local rand = 30 / #SKILL_AREAS

local combats = {}
for i, skillArea in ipairs(SKILL_AREAS) do
    combats[i] = createCombatObject()
    onTargetCreature_Blizzard = function(cid, target)
        doSkillDamage(cid, target, SKILL_NAME)
        if (not isCreature(target)) then return end -- Defeated
        if (not doPokemonSpecialAbilityCheck(target, POKEMON_SPECIAL_ABILITY_IDS.SHIELD_DUST, nil) and getRandom(0, 100) <=
                (doPokemonSpecialAbilityCheck(cid, POKEMON_SPECIAL_ABILITY_IDS.SERENA_GRACE, nil) and (rand * 2) or rand)) then
            doCreatureAddStatus(target, CREATURE_STATUS_FLINCH, nil, cid)
        end
    end
    onTargetTile_Blizzard = function(cid, position)
        position.x = position.x + math.random(0, 2)
        position.y = position.y + math.random(0, 2)
        doSendDistanceShoot(getSkyPosition(position), position, PROJECTILE_ICE)
        addEvent(doSendMagicEffect, 150, position, EFFECT_ICEBERG_TWO)
    end
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature_Blizzard")
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "onTargetTile_Blizzard")
    setCombatArea(combats[i], skillArea)
end

local function doSpell(cid, combat, var)
    if (isCreature(cid)) then
        doCombat(cid, combat, var)
    end
end

function onCastSpell(cid, var)
    for i, combat in ipairs(combats) do
        addEvent(doSpell, 500 * (i - 1) + 1, cid, combat, var)
    end
    return true
end


function fallProjectile(cid, pos)
    if not isCreature(cid) then return true end
    local apos = pos
    local frompos = {x=apos.x-7,y=apos.y-6,z=apos.z}
    doSendDistanceShoot(frompos, pos, 36)
end
 
function sendEff(cid, pos)
    if not isCreature(cid) then return true end
    local apos = pos
    doSendMagicEffect(apos, EFFECT_ICEBERG_TWO)
end
 
function onCastSpell(cid, var)
 
    local t = {}
    local posic = getThingPos(cid)
 
    for x = -6, 6 do
        for y = -7, 8 do
            local posi = {x = posic.x + x, y = posic.y-5 + y, z = posic.z, stackpos = 0}
            table.insert(t, posi)
        end
    end
 
    for v = 1, #t do
        if (#t >= 1) then
            local random = math.random(1, #t)
            addEvent(fallProjectile, v * 12, cid, t[random])
            addEvent(sendEff, v * 14, cid, t[random])
        end
    end
 
    return true
end

 

Shadow Storm:

Spoiler

local SKILL_NAME = "Shadow Storm"
local SKILL_AREAS = {
    createCombatArea(ShadowStorm),
    createCombatArea(ShadowStorm)
}
local rand = 30 / #SKILL_AREAS

local combats = {}
for i, skillArea in ipairs(SKILL_AREAS) do
    combats[i] = createCombatObject()
    onTargetCreature_ShadowStorm = function(cid, target)
        doSkillDamage(cid, target, SKILL_NAME)
        if (not isCreature(target)) then return end -- Defeated
        if (not doPokemonSpecialAbilityCheck(target, POKEMON_SPECIAL_ABILITY_IDS.SHIELD_DUST, nil) and getRandom(0, 100) <=
                (doPokemonSpecialAbilityCheck(cid, POKEMON_SPECIAL_ABILITY_IDS.SERENA_GRACE, nil) and (rand * 2) or rand)) then
            doCreatureAddStatus(target, CREATURE_STATUS_FLINCH, nil, cid)
        end
    end
    onTargetTile_ShadowStorm = function(cid, position)
        position.x = position.x + math.random(0, 2)
        position.y = position.y + math.random(0, 2)
        doSendDistanceShoot(getSkyPosition(position), position, PROJECTILE_NIGHT_SHADE)
        addEvent(doSendMagicEffect, 150, position, EFFECT_SHADOW_STORM)
    end
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature_ShadowStorm")
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "onTargetTile_ShadowStorm")
    setCombatArea(combats[i], skillArea)
end

local function doSpell(cid, combat, var)
    if (isCreature(cid)) then
        doCombat(cid, combat, var)
    end
end

function onCastSpell(cid, var)
    for i, combat in ipairs(combats) do
        addEvent(doSpell, 500 * (i - 1) + 1, cid, combat, var)
    end
    return true
end


function fallProjectile(cid, pos)
    if not isCreature(cid) then return true end
    local apos = pos
    local frompos = {x=apos.x-7,y=apos.y-6,z=apos.z}
    doSendDistanceShoot(frompos, pos, 15)
end
 
function sendEff(cid, pos)
    if not isCreature(cid) then return true end
    local apos = pos
    doSendMagicEffect(apos, EFFECT_SHADOW_STORM)
end
 
function onCastSpell(cid, var)
 
    local t = {}
    local posic = getThingPos(cid)
 
    for x = -6, 6 do
        for y = -7, 8 do
            local posi = {x = posic.x + x, y = posic.y-5 + y, z = posic.z, stackpos = 0}
            table.insert(t, posi)
        end
    end
 
    for v = 1, #t do
        if (#t >= 1) then
            local random = math.random(1, #t)
            addEvent(fallProjectile, v * 12, cid, t[random])
            addEvent(sendEff, v * 14, cid, t[random])
        end
    end
 
    return true
end

 

 

Edited by Step Records (see edit history)
Link to post
Share on other sites
  • Assistente

no caso, você teria que adaptar ao poketibia, principalmente, retirando algumas partes do script já que é realmente uma spell, você pode ver que a função "onCastSpell" está no seu código, sendo assim, essa parte não vai ser executada nunca, gerando 0 erros no console

 

Spoiler

local SKILL_NAME = "Shadow Storm"
local SKILL_AREAS = {
    createCombatArea(ShadowStorm),
    createCombatArea(ShadowStorm)
}
local rand = 30 / #SKILL_AREAS

local combats = {}

function fallProjectile(cidpos)
    if not isCreature(cidthen return true end
    local apos = pos
    local frompos = {x=apos.x-7,y=apos.y-6,z=apos.z}
    doSendDistanceShoot(frompospos7)
end

 

function sendEff(cidpos
    if not isCreature(cidthen return true end
    local apos = pos
    doSendMagicEffect(apos, CONST_ME_ICEATTACK)
end
 

for i, skillArea in ipairs(SKILL_AREAS) do
    combats[i] = createCombatObject()
    onTargetCreature_ShadowStorm = function(cid, target)
        doSkillDamage(cid, target, SKILL_NAME)
        if (not isCreature(target)) then return end -- Defeated
        if (not doPokemonSpecialAbilityCheck(target, POKEMON_SPECIAL_ABILITY_IDS.SHIELD_DUST, nil) and getRandom(0, 100) <=
                (doPokemonSpecialAbilityCheck(cid, POKEMON_SPECIAL_ABILITY_IDS.SERENA_GRACE, nil) and (rand * 2) or rand)) then
            doCreatureAddStatus(target, CREATURE_STATUS_FLINCH, nil, cid)
        end
    end
    onTargetTile_ShadowStorm = function(cid, position)
    local t = {}
    local posic = getThingPos(cid)
 
    for x = -6, 6 do
        for y = -7, 8 do
            local posi = {x = posic.x + x, y = posic.y-5 + y, z = posic.z, stackpos = 0}
            table.insert(t, posi)
        end
    end
 
    for v = 1, #t do
        if (#t >= 1) then
            local random = math.random(1, #t)
            addEvent(fallProjectile, v * 12, cid, t[random])
            addEvent(sendEff, v * 14, cid, t[random])
        end
    end
    end
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature_ShadowStorm")
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETTILE, "onTargetTile_ShadowStorm")
    setCombatArea(combats[i], skillArea)
end

local function doSpell(cid, combat, var)
    if (isCreature(cid)) then
        doCombat(cid, combat, var)
    end
end

 

em casos de erro como faltando um "end" para fechar algum escopo, leia o erro e vá até a linha pedida, verifique se tem um end e precisa de um end
(fiz pelo cel)

Link to post
Share on other sites
  • Assistente
  • Solution

//solução:
 

local SKILL_NAME = "Lava Plume"
local SKILL_AREAS = {
    createCombatArea(AREA_CROSS6X6)
}

local combats = {}
for i, skillArea in ipairs(SKILL_AREAS) do
    combats[i] = createCombatObject()
    onTargetCreature_LavaPlume = function(cid, target)
        doSkillDamage(cid, target, SKILL_NAME)
        if (not isCreature(target)) then return end -- Defeated
        if (not doPokemonSpecialAbilityCheck(target, POKEMON_SPECIAL_ABILITY_IDS.SHIELD_DUST, nil) and getRandom(0, 100) <=
                (doPokemonSpecialAbilityCheck(cid, POKEMON_SPECIAL_ABILITY_IDS.SERENA_GRACE, nil) and 60 or 30)) then
            doCreatureAddStatus(target, CREATURE_STATUS_BURN, getMonsterLevel(cid), cid)
        end
    end
    setCombatCallback(combats[i], CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature_LavaPlume")
    setCombatArea(combats[i], skillArea)
end

local function doSpell(cid, combat, var)
    if (isCreature(cid)) then
        doCombat(cid, combat, var)
    end
end

local function fallProjectile(cid, pos)
    if not isCreature(cid) then return true end
    local apos = pos
    local frompos = {x=apos.x-7,y=apos.y-6,z=apos.z}
    doSendDistanceShoot(frompos, pos, 7)
end
 
local function sendEff(cid, pos) 
    if not isCreature(cid) then return true end
    local apos = pos
    doSendMagicEffect(apos, CONST_ME_ICEATTACK)
end

function onCastSpell(cid, var)
 local t = {}
    local posic = getThingPos(cid)
 
    for x = -6, 6 do
        for y = -7, 8 do
            local posi = {x = posic.x + x, y = posic.y-5 + y, z = posic.z, stackpos = 0}
            table.insert(t, posi)
        end
    end
 
    for v = 1, #t do
        if (#t >= 1) then
            local random = math.random(1, #t)
            addEvent(fallProjectile, v * 12, cid, t[random])
            addEvent(sendEff, v * 14, cid, t[random])
        end
    end
    for i, combat in ipairs(combats) do
        addEvent(doSpell, 500 * (i - 1) + 1, cid, combat, var)
    end
    return true
end

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Confirmação de Termo