View Full Version : Quick scripting question
dekodertronic
03-17-2015, 08:27 PM
Hey fellas, I'm trying to set up a script to equip a energy ring once a certain amount of creatures are on the screen.
I noticed the following code given by another user on a thread:
RingCreature-Equip = 3 ; How many creatures at which you will equip the ring? (0 to disable)
My question is, where do i write this is? Thank you for the help in advance!
Hey fellas, I'm trying to set up a script to equip a energy ring once a certain amount of creatures are on the screen.
I noticed the following code given by another user on a thread:
RingCreature-Equip = 3 ; How many creatures at which you will equip the ring? (0 to disable)
My question is, where do i write this is? Thank you for the help in advance!
This is only setting up a variable, so on top would be most logical.
Infernal Bolt
03-17-2015, 08:40 PM
Hey fellas, I'm trying to set up a script to equip a energy ring once a certain amount of creatures are on the screen.
I noticed the following code given by another user on a thread:
RingCreature-Equip = 3 ; How many creatures at which you will equip the ring? (0 to disable)
My question is, where do i write this is? Thank you for the help in advance!
You'd also need the rest of the script and not just the variable.
slaweksor
03-17-2015, 09:02 PM
local RingID = 3051 --3051 energy ring
local amount = 3 -- monster amount to put ring on
local range = 6 -- range to consider when looking for monster on screen (NO MORE THAN 7!)
local monsterList = -- separate monsters with comma
{
'Crystal Spider'
}
--Dont edit below unless u know what ure doing
function getMonsterCount()
local count = 0
for k, v in ipairs(Self.GetTargets(range)) do
if table.find(monsterList, v:Name()) then
count = count + 1
end
end
return count
end
function ring()
if getMonsterCount() >= amount and Self.Ring().id ~= getActiveRingID(RingID) and Self.ItemCount(RingID) >= 1 then
Self.Equip(RingID, "ring")
wait(200,400)
if Self.Ring().id == getActiveRingID(RingID) then
wait(2000,3000) -- just so it doesnt remove it imidiately ( more human like? )
end
elseif getMonsterCount() < amount and Self.Ring().id == getActiveRingID(RingID) then
Self.Dequip("ring")
end
end
Module('energyRing', function(ManaShield)
ring()
ManaShield:Delay(200 * math.random(1,3))
end)
dekodertronic
03-17-2015, 10:01 PM
local RingID = 3051 --3051 energy ring
local amount = 3 -- monster amount to put ring on
local range = 6 -- range to consider when looking for monster on screen (NO MORE THAN 7!)
local monsterList = -- separate monsters with comma
{
'Crystal Spider'
}
--Dont edit below unless u know what ure doing
function getMonsterCount()
local count = 0
for k, v in ipairs(Self.GetTargets(range)) do
if table.find(monsterList, v:Name()) then
count = count + 1
end
end
return count
end
function ring()
if getMonsterCount() >= amount and Self.Ring().id ~= getActiveRingID(RingID) and Self.ItemCount(RingID) >= 1 then
Self.Equip(RingID, "ring")
wait(200,400)
if Self.Ring().id == getActiveRingID(RingID) then
wait(2000,3000) -- just so it doesnt remove it imidiately ( more human like? )
end
elseif getMonsterCount() < amount and Self.Ring().id == getActiveRingID(RingID) then
Self.Dequip("ring")
end
end
Module('energyRing', function(ManaShield)
ring()
ManaShield:Delay(200 * math.random(1,3))
end)
thank you sooooooooooooo much :)))
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.