grave18
12-22-2015, 01:19 PM
Hello.
Could someone explain to me how works this script?
It comes from the library - Official XenoBot Scripts
I need to get this effect, but I do not know why it is always true...
elseif (labelName == "AntiLure") then
local test = targetingGetCreatureThreshold(({'spider', 'poison spider'}), 7, 4, 11, 1) -- floor with spiders = 11
if test[1] then
print('true')
else
print ('false')
end
function targetingGetCreatureThreshold(list, range, amount, multifloor, floor)
local targets = {}
local count = 0
local pos = getSelfPosition()
for i = CREATURES_LOW, CREATURES_HIGH do
local name = getCreatureName(i)
-- Is this creature invited to die?
if list[string.lower(name)] then
-- Position & Distance
local cpos = getCreaturePosition(i)
local distance = getDistanceBetween(pos, cpos)
if ((pos.z + (floor or 0)) == cpos.z or multifloor) and distance <= range then
-- Normal creature checks
if getCreatureVisible(i) and getCreatureHealthPercent(i) > 0 and isCreatureMonster(i) then
targets[#targets+1] = getCreatureIDFromIndex(i)
count = count + 1
end
end
end
end
return {count >= amount, targets}
end
13109--floor 10 13111--floor 11
Please help me with that. Thx
Could someone explain to me how works this script?
It comes from the library - Official XenoBot Scripts
I need to get this effect, but I do not know why it is always true...
elseif (labelName == "AntiLure") then
local test = targetingGetCreatureThreshold(({'spider', 'poison spider'}), 7, 4, 11, 1) -- floor with spiders = 11
if test[1] then
print('true')
else
print ('false')
end
function targetingGetCreatureThreshold(list, range, amount, multifloor, floor)
local targets = {}
local count = 0
local pos = getSelfPosition()
for i = CREATURES_LOW, CREATURES_HIGH do
local name = getCreatureName(i)
-- Is this creature invited to die?
if list[string.lower(name)] then
-- Position & Distance
local cpos = getCreaturePosition(i)
local distance = getDistanceBetween(pos, cpos)
if ((pos.z + (floor or 0)) == cpos.z or multifloor) and distance <= range then
-- Normal creature checks
if getCreatureVisible(i) and getCreatureHealthPercent(i) > 0 and isCreatureMonster(i) then
targets[#targets+1] = getCreatureIDFromIndex(i)
count = count + 1
end
end
end
end
return {count >= amount, targets}
end
13109--floor 10 13111--floor 11
Please help me with that. Thx