Ir para conteúdo
  • Cadastre-se

(Resolvido)Modificar Script


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Olá galera, editei essa spell pra criar um item embaixo do player, só que eu queria colocar pra esse item sumir apos 10seg

Spoiler

--- Edited by: MARK ----
local function doPushCreature(target, cid)
    if target > 0 then
   if not isNpc(target) then
   local position = getThingPosition(cid)
   local fromPosition = getThingPosition(target)
   local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
   local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
   local toPosition = {x = fromPosition.x - x, y = fromPosition.y - y, z = fromPosition.z}
   if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
   doTeleportThing(target, toPosition, true)
   end
   end
    end
end
local spell = {}
spell.config = {
    [1] = {
   damageType = 1,
   areaEffect = 2,
   area = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
   }   
    },
    [2] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 1, 0, 2, 0, 1, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    },
    [3] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 1, 2, 1, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    }
}
  
spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4, 0)
    function onTargetCreature(cid, target)
   doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
    for n = 1, #spell.combats do
   addEvent(doCombat, (n * 120), cid, spell.combats[n], var)
    end
    return true
end
function onCastSpell(cid, var)
    local post = getPlayerPosition(cid)
    local item = 11497
    remove_time = 5
    doCreateItem(11497, 1, post)
    return true
end

 

Link para o post
Compartilhar em outros sites
  • Solução
--- Edited by: MARK ----
local function doPushCreature(target, cid)
    if target > 0 then
   if not isNpc(target) then
   local position = getThingPosition(cid)
   local fromPosition = getThingPosition(target)
   local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
   local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
   local toPosition = {x = fromPosition.x - x, y = fromPosition.y - y, z = fromPosition.z}
   if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
   doTeleportThing(target, toPosition, true)
   end
   end
    end
end
local spell = {}
spell.config = {
    [1] = {
   damageType = 1,
   areaEffect = 2,
   area = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
   }   
    },
    [2] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 1, 0, 2, 0, 1, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    },
    [3] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 1, 2, 1, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    }
}
  
spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4, 0)
    function onTargetCreature(cid, target)
   doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function doremoveItemInPos(pos, itemid)
	local t = getTileItemById(pos, itemid).uid
	return t > 0 and doRemoveItem(t) and doSendMagicEffect(pos, CONST_ME_POFF)
end
function onCastSpell(cid, var)
    for n = 1, #spell.combats do
   addEvent(doCombat, (n * 120), cid, spell.combats[n], var)
    end
    return true
end
function onCastSpell(cid, var)
    local post = getPlayerPosition(cid)
    local item = 11497
    local remove_time = 10
    doCreateItem(item, 1, post)
    addEvent(doremoveItemInPos,remove_time*1000, post, item)
    return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo