Log in

View Full Version : Spy down & Anti lure



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

grave18
12-29-2015, 01:28 PM
Refresh.

grave18
12-30-2015, 12:36 PM
Refresh.

Syntax
12-30-2015, 08:44 PM
grave18


targetingGetCreatureThreshold({
["spider"] = true,
["poison spider"] = true
}, 7, 4, false, 1) -- floor with spiders = 11

grave18
12-30-2015, 11:25 PM
Syntax
Thank for help ;D It work!