View Full Version : Request: Cast enchant party when in a party, not buffed and party member in range
HjugO
06-17-2017, 03:54 PM
Hi there,
Firstly, I've tried searching but haven't found anything. If there is an Lua script already that exists then I apologise but can you please provide the link and don't just say "try search".
I was wondering if someone was interested in helping me create an Lua script that when in a party and the player isn't buffed it will cast the party buff spell.
I want it to be a bit smarter than just casting the buff spell every 120 seconds, because if there is a cool down timer, etc. it will fail until the next timer expires. I also don't want to use the Magic Shooter because it just spams the spell when it comes off cooldown (30 seconds), but the spell lasts 2 minutes so I run out of mana pots too quick.
So in English prose it might look like:
Am I in a party? Yes.
Am I in a fight? Yes.
Are there any party members in range (I believe it's 8 spaces in each direction)? Yes.
Am I buffed? No.
Cast x spell.
Thanks
Hello, check your PM.
Hello, check your PM.
Ah, thanks for the response but if it's so complicated that someone wants to be paid to write it I won't bother.
Cheers.
HjugO
06-21-2017, 09:54 AM
Ah, thanks for the response but if it's so complicated that someone wants to be paid to write it I won't bother.
Cheers.
CONFIG = {
BUFF_SPELL = "utori mas sio",
RADIUS = 3
}
function getManaCost(count)
return ((0.9 ^ (count - 1)) * 120) * count
end
function getPlayerDistanceWithParty(RADIUS)
for n, c in Creature.iPlayers(RADIUS) do
if c:isPartyMember() then
return true
end
end
end
function getPlayerCountInParty(RADIUS)
local count = 1
for n, c in Creature.iPlayers(RADIUS) do
if c:isPartyMember() then
count = count + 1
end
end
return count
end
Module.New("BUFF:SET()", function(moduleObject)
if getPlayerDistanceWithParty(CONFIG.RADIUS) then
if Self.isInFight() and not Self.isBuffed() then
Self.Cast(CONFIG.BUFF_SPELL, getManaCost(getPlayerCountInParty(CONFIG.RADIUS)))
end
end
end)
Cheers.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.