Jump to content

Recommended Posts

Hello,

 

You have lua functions GetRaidTargetIndex and SetRaidTarget (or SetRaidTargetIcon)

 

Samples:

 

Launch the spell id 109259 on the first boss with skull icon:

local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
	local UnitIdString = "boss" .. i
    if UnitExists(UnitIdString) then
		if GetRaidTargetIndex(UnitIdString) == 8 then
			CastSpellByName(SpellName, UnitIdString)
			return
		end
	end
end
Launch the spell id 109259 on the first raid target with skull icon (this code check the target of raid members):

local SpellName = GetSpellInfo(109259)
for i = 1, 40, 1 do
	local UnitIdString = "raid" .. i .. "target"
    if UnitExists(UnitIdString) then
		if GetRaidTargetIndex(UnitIdString) == 8 then
			CastSpellByName(SpellName, UnitIdString)
			return
		end
	end
end
Launch the spell id 109259 on the first party target with skull icon (this code check the target of party members):

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

ps: Replace 109259 by your spell id and add conditions to launch the spell, to launch the spell if mob health is lower than 50%:

local SpellName = GetSpellInfo(109259)
for i = 1, 4, 1 do
	local UnitIdString = "party" .. i .. "target"
    if UnitExists(UnitIdString) then
		if GetRaidTargetIndex(UnitIdString) == 8 then
			if UnitHealth(UnitIdString)/UnitHealthMax(UnitIdString)*100 < 50 then
				CastSpellByName(SpellName, UnitIdString)
				return
			end
		end
	end
end
ps2: Code no tested, do not hesitate to tell me if this don't works
Link to comment
https://wrobot.eu/forums/topic/2100-skull-marked/#findComment-9873
Share on other sites

  • 2 years later...

Can someone help me.

I Have a Mage in Vanilla Wow that I would love to sheep my skull until i tell him to stop it

Added in Partychat Lua 

local SpellName = GetSpellInfo(12824)
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

But comes with and error in game when I ask it to sheep the target

Link to comment
https://wrobot.eu/forums/topic/2100-skull-marked/#findComment-38616
Share on other sites

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...