PDA

View Full Version : Multiple strike script



kubax36
03-27-2013, 11:29 PM
Hello, i have problem with this script



function combatHelper(pos, radius, creatureName, amountofCreature)

local n = 0

local noPlayer = true

local pos = Self.Position()

for i = CREATURES_LOW, CREATURES_HIGH do

local creature = Creature.GetFromIndex(i)

local name = creature:Name()

if (checkPlayer and creature:isPlayer() and (getDistanceBetween(creature:Position(), pos) <= radius)) then

noPlayer = false

break

elseif (creature:isValid()) and creature:ID() ~= Self.ID() then

for j = 1, table.getn(creatureName) do

if (name == creatureName[j]) then

if (creature:isOnScreen() and creature:isVisible() and creature:isAlive()) then

if(getDistanceBetween(creature:Position(), pos) <= radius)then

n = n + 1

end

end

end

end

end

end

if (n >= 1) and (pos.y >= 31258) then

setTargetingEnabled(true)

elseif (n == 0) then

setTargetingEnabled(false)

elseif (n >= 1) and (pos.y <= 31258) then

setTargetingEnabled(false)

end

end


function SpellCast1(spell)
needsTarget=true

local Monster1 = "Quara Hydromancer"

local Monster2 = "Quara Predator"

local TargetID = Self.TargetID()

local Target = Creature.GetByID(TargetID)

local pos = Self.Position()

if (Self.CanCastSpell(spell)) and (Target:Name() == Monster1) and (Target:HealthPercent() >= 60) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster2) and (Target:HealthPercent() >= 30) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (not Self.MeetsSpellRequirements(spell)) then

print("%s can not be cast. You either lack the mana or required level!", spell)

end

end

function SpellCast2(spell)

needsTarget=true
local Monster1 = "Quara Hydromancer"

local Monster2 = "Quara Predator"

local Monster3 = "Quara Pincher"

local Monster4 = "Quara Mantassin"

local Monster5 = "Quara Constrictor"

local TargetID = Self.TargetID()

local Target = Creature.GetByID(TargetID)

local pos = Self.Position()

if (Self.CanCastSpell(spell)) and (Target:Name() == Monster1) and (Target:HealthPercent() >= 20) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster2) and (Target:HealthPercent() >= 20) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster3) and (Target:HealthPercent() >= 20) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster4) and (Target:HealthPercent() >= 40) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster5) and (Target:HealthPercent() >= 70) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (not Self.MeetsSpellRequirements(spell)) then

print("%s can not be cast. You either lack the mana or required level!", spell)

end

end

function SpellCast3(spell)
needsTarget=true
local Monster1 = "Quara Hydromancer"

local Monster2 = "Quara Predator"

local Monster3 = "Quara Pincher"

local Monster4 = "Quara Mantassin"

local Monster5 = "Quara Constrictor"

local TargetID = Self.TargetID()

local Target = Creature.GetByID(TargetID)

local pos = Self.Position()

if (Self.CanCastSpell(spell)) and (Target:Name() == Monster1) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster2) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster3) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster4) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (Self.CanCastSpell(spell)) and (Target:Name() == Monster5) and (getDistanceBetween(Target:Position(), pos) <= 3) then

Self.Say(spell)

elseif (not Self.MeetsSpellRequirements(spell)) then

print("%s can not be cast. You either lack the mana or required level!", spell)

end

end




while (true) do

SpellCast1("exori max vis")

SpellCast2("exori gran vis")

SpellCast3("exori vis")


wait(1200)

end

it is sometimes shooting spells randomly, even without target infront of me. Did anyone can help me to fix it? It can be dangerous if it will start to shoot spells when i will make refil :D