Jump to content

Attack marked Target


saleh

Recommended Posts

local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
	local UnitIdString = "party" .. i .. "target"
    if UnitExists(UnitIdString) then
		if GetRaidTargetIndex(UnitIdString) == 8 then
			CastSpellByName(SpellName, UnitIdString)
			return
		end
	end
end

hi

how can i use this code in fight class or party command plug in

 

Thanks

Link to comment
Share on other sites

Hello,

put this code instead of spell name, and use option spell option 'Not spell, is lua...':

local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
	local UnitIdString = "party" .. i .. "target"
    if UnitExists(UnitIdString) then
		if GetRaidTargetIndex(UnitIdString) == 8 and IsSpellInRange(SpellName,UnitIdString) then
			CastSpellByName(SpellName, UnitIdString)
			return
		end
	end
end

(I have added IsSpellInRange)

And add "lua script" condition:

Lua script:

needToCast=false;
local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
	local UnitIdString = "party" .. i .. "target"
    if UnitExists(UnitIdString) then
		if GetRaidTargetIndex(UnitIdString) == 8 and IsSpellInRange(SpellName,UnitIdString) then
			needToCast=true;
			return
		end
	end
end

Return value research:

true

Return value var:

needToCast

 

 

To use this code in party chat command just use "Action command type" > "Lua" with the first code of this post.

 

of course, replace 109259 by your spell in in all codes.

Link to comment
Share on other sites

  • 3 months later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...