Stealth/Energy Ring Equipper on X creatures
This script will equip a stealth ring based on creatures on screen within a certain range.
Creatures can have varying danger levels
If the total danger is above the limit. The ring will be equipped.
lua code:
-- Stealth Ring Equipper
--Version 1.0
--[[ Made by
___ .__ __. ______ ____ ____ .__ __.
/ \ | \ | | / __ \ \ \ / / | \ | |
/ ^ \ | \| | | | | | \ \/ / | \| |
/ /_\ \ | . ` | | | | | \_ _/ | . ` |
/ _____ \ | |\ | | `--' | | | | |\ |
/__/ \__\ |__| \__| \______/ |__| |__| \__|
]]
--------------------------------------------
--[[ ------------ CONFIG -------------- ]]--
--------------------------------------------
local distanceToCheckCreatures = 2 -- Check creatures within this range
local dangerToEquip = 3 -- if danger is higher than this number, equip ring
local monsterList = {
{ name = "Cyclops Smith", danger = 3 },
{ name = "Cyclops Drone", danger = 2 },
{ name = "Cyclops", danger = 1 }
}
-- 3049, 3086 = stealth ring/steath ring equipped
local RingID = 3049 -- ID of ring in backpack to equip
local RingIDWhenEquipped = 3086 -- The ID when ring is equipped
--How often should creature checks be made in milliseconds
local minCreatureCheckDelay = 400
local maxCreatureCheckDelay = 1200
--------------------------------------------
--[[ ----- Script -- No need to edit ---- ]]
--------------------------------------------
function getDangerLevel( dist )
local currentDanger = 0
local targets = Self.GetTargets( dist )
for i = 1, #targets do
local targetName = targets[i]:Name()
for i = 1, #monsterList do
if monsterList[i]['name'] == targetName then
currentDanger = currentDanger + monsterList[i]['danger']
end
end
end
return currentDanger
end
function stealthring()
local dangerAmount = getDangerLevel( distanceToCheckCreatures )
--print("Danger level = " .. dangerAmount )
if dangerAmount >= dangerToEquip and Self.Ring().id ~= RingIDWhenEquipped and Self.ItemCount(RingID) >= 1 then
Self.Equip(RingID, "ring")
elseif dangerAmount < dangerToEquip and Self.Ring().id == RingIDWhenEquipped then
Self.Dequip("ring")
end
end
Module('stealth', function(stealth)
stealthring()
stealth:Delay(minCreatureCheckDelay,maxCreatureCheckDelay)
end)