Ir para conteúdo

Featured Replies

Postado

Alguém poderia me ajudar nesse script, é um Item bomba acionada por uma Spell. Ela da dano em quem passar por cima, só que está dando dano em quem a conjura tbm, queria que não desse.

 

function onStepIn(cid, item, position, fromPosition)

local pid = getCreaturePosition(cid)

local monster_damage = -100 -- Quanto de HP o monster irá perder se pisar 
local monster_effect = 10 -- Efeito quando o monstro pisar no tile

local level_max = 200 -- Level que irá começar a levar dano ao pisar no tile ;
local player_damage = -100 -- Quanto de HP o player irá perder se pisar 
local player_effect = 10 -- Efeito quando o Player pisar no tile
local player_mana = -100 -- Quanto de MANA o player irá perder se pisar   

    if isMonster(cid) then 
    
          doCreatureAddHealth(cid, monster_damage)
          doSendMagicEffect(pid, monster_effect)
   
    return true
    end
    
    if isPlayer(cid) then
     if getPlayerLevel(cid) >= level_max then 
    
          doCreatureAddHealth(cid, player_damage)
          doCreatureAddMana(cid, player_mana)
          doSendMagicEffect(pid, player_effect)
    
     return true
     end
    return true
    end
return true
end
Postado
  • Autor

local cfg = {
    random_items = {2218}, -- adicione mais se quiser mais items aleatorios
    remove_time = 10 -- tempo em segundos para remover
}

end

local combat = createCombatObject()
setCombatArea(combat, createCombatArea({
    {0,0,0,0,0,0,0},
    {0,0,1,1,1,0,0},
    {0,1,1,1,1,1,0},
    {0,1,1,3,1,1,0},
    {0,1,1,1,1,1,0},
    {0,0,1,1,1,0,0},
    {0,0,0,0,0,0,0}
}))

local function onCastSpell2(parameters)
    if isPlayer(parameters.cid) then
    doCombat(parameters.cid, combat, parameters.var)
end
end

function onTargetTile(cid, position)
    local itemid = cfg.random_items[math.random(#cfg.random_items)]
        local item = doCreateItem(itemid, 1, position)

        doItemSetAttribute(item, 'ref', getCreatureName(cid))

    addEvent(function()
        local thing = getTileItemById(position, itemid).uid
        if(thing ~= 0) then
            doRemoveItem(thing)
        end
    end, cfg.remove_time * 1000)
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)
local parameters = { cid = cid, var = var, combat = combat}
addEvent(onCastSpell2, 250, parameters)
return true
end
 

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