kubax36
11-26-2012, 09:07 PM
Hello!
I have problem with this script
local config = {
attacks = {
['exori ico'] = {
min = 2, -- minimum targets in to use this spell
spellRadius = 1, -- range to count targets to attack
checkRadius = 1, -- safe range to check for players (should always be larger or at least equal to spellRadius)
countPlayers = false, -- include players in the target count (incase you are intending on attacking players)
attackMode = 'none' -- none, enemies, strangers, friends, everyone
},
['exori hur'] = {
min = 2, -- minimum targets in to use this spell
spellRadius = 1, -- range to count targets to attack
checkRadius = 1, -- safe range to check for players (should always be larger or at least equal to spellRadius)
countPlayers = false, -- include players in the target count (incase you are intending on attacking players)
attackMode = 'none' -- none, enemies, strangers, friends, everyone
},
['exori'] = {
min = 3,
spellRadius = 1,
checkRadius = 4,
countPlayers = false,
attackMode = 'none'
},
['exori gran'] = {
min = 4, -- minimum targets in to use this spell
spellRadius = 1, -- range to count targets to attack
checkRadius = 4, -- safe range to check for players (should always be larger or at least equal to spellRadius)
countPlayers = false, -- include players in the target count (incase you are intending on attacking players)
attackMode = 'none' -- none, enemies, strangers, friends, everyone
}
}
}
function xrayPlayersAround(radius, ...)
local radius = 4
local t = {...}
local players = {}
if (radius == 0) then
radius = 8
end
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if (creature:isValid()) and creature:ID() ~= Self.ID() then
if creature:isVisible() and creature:isAlive() then
if creature:isPlayer() then
local name = creature:Name()
local selfpos = Self.Position()
local creaturepos = creature:Position()
local distance = math.max(math.abs(selfpos.x - creaturepos.x), math.abs(selfpos.y - creaturepos.y))
if (distance <= radius) then
if not table.contains(t, name) then
table.insert(players, creature)
end
end
end
end
end
end
return players
end
function rayPlayersAround(radius, ...) -- Count players around. Names are excluded from the count.
if xrayPlayersAround(radius, ...) then
return #xrayPlayersAround(radius, ...)
else
return 0
end
end
function getTargetCount(pos, atkRadius, chkRadius, incPlayers, atkMode)
local n = 0
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if(creature:isValid() and creature:ID() ~= Self.ID())then
if(creature:isOnScreen() and creature:isVisible() and creature:isAlive())then
local name = creature:Name()
if(getDistanceBetween(creature:Position(), pos) <= chkRadius)then
if(atkMode == 'none' and (creature:isPlayer()))then
return false
elseif(atkMode == 'enemies' and (creature:isFriendly() or creature:isInnocent()))then
return false
elseif(atkMode == 'strangers' and creature:isFriendly())then
return false
elseif(atkMode == 'friends' and creature:isInnocent())then
return false
end
if(getDistanceBetween(creature:Position(), pos) <= atkRadius)then
if(not creature:isPlayer() or incPlayers)then
n = n + 1
end
end
end
end
end
end
return n
end
function think()
for spell, dat in pairs(config.attacks)do
local amnt = getTargetCount(Self.Position(), dat.spellRadius, dat.checkRadius, dat.countPlayers, dat.attackMode)
if(amnt)then
local _max = (dat.max==nil) and amnt or dat.max
if(amnt >= dat.min) and (amnt <= _max) and rayPlayersAround(radius) == 0 then
if(type(spell) == 'number')then
Self.UseItemWithMe(spell)
wait(900, 1200)
elseif(Self.CanCastSpell(spell))then
if(dat.needTarget)then
local target = Creature.GetByID(Self.TargetID())
if(target:isOnScreen() and target:isVisible() and target:isAlive())then
if(target:DistanceFromSelf() <= dat.spellRadius)then
Self.Say(spell)
wait(600, 1000)
end
end
end
Self.Say(spell)
wait(600, 1000)
end
end
end
end
end
while (true) do
local creature = Creature.GetByID(Self.ID())
think()
if Self.ItemCount(236) >= 1 and (creature:HealthPercent() <= 1) then
Self.UseItemWithMe(236)
sleep(math.random(200, 600))
break
end
wait(200)
end
Its sometimes working good, but sometimes its not shooting exori and exori gran even if it have mana, no colldowns, no1 is above and below me, its just shooting exori ico and exori hur if around me is 4 or more monsters. Can someone Help me to fix it, please? ;p
I have problem with this script
local config = {
attacks = {
['exori ico'] = {
min = 2, -- minimum targets in to use this spell
spellRadius = 1, -- range to count targets to attack
checkRadius = 1, -- safe range to check for players (should always be larger or at least equal to spellRadius)
countPlayers = false, -- include players in the target count (incase you are intending on attacking players)
attackMode = 'none' -- none, enemies, strangers, friends, everyone
},
['exori hur'] = {
min = 2, -- minimum targets in to use this spell
spellRadius = 1, -- range to count targets to attack
checkRadius = 1, -- safe range to check for players (should always be larger or at least equal to spellRadius)
countPlayers = false, -- include players in the target count (incase you are intending on attacking players)
attackMode = 'none' -- none, enemies, strangers, friends, everyone
},
['exori'] = {
min = 3,
spellRadius = 1,
checkRadius = 4,
countPlayers = false,
attackMode = 'none'
},
['exori gran'] = {
min = 4, -- minimum targets in to use this spell
spellRadius = 1, -- range to count targets to attack
checkRadius = 4, -- safe range to check for players (should always be larger or at least equal to spellRadius)
countPlayers = false, -- include players in the target count (incase you are intending on attacking players)
attackMode = 'none' -- none, enemies, strangers, friends, everyone
}
}
}
function xrayPlayersAround(radius, ...)
local radius = 4
local t = {...}
local players = {}
if (radius == 0) then
radius = 8
end
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if (creature:isValid()) and creature:ID() ~= Self.ID() then
if creature:isVisible() and creature:isAlive() then
if creature:isPlayer() then
local name = creature:Name()
local selfpos = Self.Position()
local creaturepos = creature:Position()
local distance = math.max(math.abs(selfpos.x - creaturepos.x), math.abs(selfpos.y - creaturepos.y))
if (distance <= radius) then
if not table.contains(t, name) then
table.insert(players, creature)
end
end
end
end
end
end
return players
end
function rayPlayersAround(radius, ...) -- Count players around. Names are excluded from the count.
if xrayPlayersAround(radius, ...) then
return #xrayPlayersAround(radius, ...)
else
return 0
end
end
function getTargetCount(pos, atkRadius, chkRadius, incPlayers, atkMode)
local n = 0
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if(creature:isValid() and creature:ID() ~= Self.ID())then
if(creature:isOnScreen() and creature:isVisible() and creature:isAlive())then
local name = creature:Name()
if(getDistanceBetween(creature:Position(), pos) <= chkRadius)then
if(atkMode == 'none' and (creature:isPlayer()))then
return false
elseif(atkMode == 'enemies' and (creature:isFriendly() or creature:isInnocent()))then
return false
elseif(atkMode == 'strangers' and creature:isFriendly())then
return false
elseif(atkMode == 'friends' and creature:isInnocent())then
return false
end
if(getDistanceBetween(creature:Position(), pos) <= atkRadius)then
if(not creature:isPlayer() or incPlayers)then
n = n + 1
end
end
end
end
end
end
return n
end
function think()
for spell, dat in pairs(config.attacks)do
local amnt = getTargetCount(Self.Position(), dat.spellRadius, dat.checkRadius, dat.countPlayers, dat.attackMode)
if(amnt)then
local _max = (dat.max==nil) and amnt or dat.max
if(amnt >= dat.min) and (amnt <= _max) and rayPlayersAround(radius) == 0 then
if(type(spell) == 'number')then
Self.UseItemWithMe(spell)
wait(900, 1200)
elseif(Self.CanCastSpell(spell))then
if(dat.needTarget)then
local target = Creature.GetByID(Self.TargetID())
if(target:isOnScreen() and target:isVisible() and target:isAlive())then
if(target:DistanceFromSelf() <= dat.spellRadius)then
Self.Say(spell)
wait(600, 1000)
end
end
end
Self.Say(spell)
wait(600, 1000)
end
end
end
end
end
while (true) do
local creature = Creature.GetByID(Self.ID())
think()
if Self.ItemCount(236) >= 1 and (creature:HealthPercent() <= 1) then
Self.UseItemWithMe(236)
sleep(math.random(200, 600))
break
end
wait(200)
end
Its sometimes working good, but sometimes its not shooting exori and exori gran even if it have mana, no colldowns, no1 is above and below me, its just shooting exori ico and exori hur if around me is 4 or more monsters. Can someone Help me to fix it, please? ;p