Ir para conteúdo
  • 0

ajuda com magia multi shot


Pergunta

alguem saberia fazer essa magia para players 

Spoiler

 

function onCastSpell(cid, var)

local configs = {
    ["Shredderthrower"] = {
        mindmg = -300, -- Minimum damage (don't forget that this number has to be negative)
        maxdmg = -575, -- Maximum damage (don't forget that this number has to be negative)
        dmgtype = COMBAT_PHYSICALDAMAGE, -- Damage type (for available types, check your Constants library)
        shooteff = 27, -- Number of distance effect that will be shot (can also be a constant)
        splasheff = 187, -- Number of magic effect that will be displayed when the target is shot (can also be a constant)
        delay = 1, -- Delay at which multiple shots will be fired. In miliseconds.
        shots = 20, -- How many shots will the monster fire per attack?
        shootrange = 7 -- Range at which the monster scans for targets and shoots the shots.
    }
}

    ---- Don't touch anything below unless you know what you're doing ----

    local victimtable, pass = {}, false
    local self = configs[getCreatureName(cid)]
    if self then
        if getCreatureTarget(cid) ~= 0 then
            local target, tpos, victims, shotsfired = getCreatureTarget(cid), getThingPos(getCreatureTarget(cid)), getSpectators(getThingPos(cid), self.shootrange, self.shootrange), 0
          
                for i = 1, self.shots do
                    if shotsfired < self.shots then
                        if shotsfired == 0 then -- First shot will always be fired at the primary target, which is a mandatory target in order to use the spell
                            table.insert(victimtable, target)
                        else
                      
                            for i=1,#victims do
                                pass = false
                              
                                if not(isInArray(victimtable,victims)) then
                                    if isPlayer(victims) then
                                        if getPlayerGroupId(victims) < 3 then
                                            pass = true
                                        end
                                    else
                                        if isPlayer(getCreatureMaster(victims)) then
                                            pass = true
                                        end
                                    end
                                end
                          
                                if pass == true then
                                        target = victims
                                        table.insert(victimtable, target)
                                        break
                                end

                            end
                        end
                        shotsfired = shotsfired + 1
                    end
                end
              
                for v = 1, #victimtable do
                    addEvent(function()
                        if isCreature(victimtable[v]) and isCreature(victimtable[v]) then
                            if getDistanceBetween(getThingPos(cid), getThingPos(victimtable[v])) <= self.shootrange and isSightClear(getThingPos(cid), getThingPos(victimtable[v]), false) then
                                doSendDistanceShoot(getThingPos(cid), getThingPos(victimtable[v]), self.shooteff)
                                doTargetCombatHealth(cid, victimtable[v], self.dmgtype, self.mindmg, self.maxdmg, self.splasheff)
                            end
                        end
                    end, (v-1)*self.delay)
                end
              
        end
    end  
return true
end

 

 

Link para o comentário
https://xtibia.com/forum/topic/240515-ajuda-com-magia-multi-shot/
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...