target players only
Posted: Wed Jan 29, 2014 5:44 pm
This is primarily a DIYCE problem but can be helpful as a general macro. The script I have should target a player (not pet or npc) and lock on until that player is dead. The problem is it is not locking on. It spastically tabs between everything in range. If my code is correct, I think the problem is with the placement of the end statements.
Code: Select all
function WarriorRogue(arg1, potslot)
local Skill = {}
local i = 0
local combat = GetPlayerCombatState()
local friendly = (not UnitCanAttack("player", "target"))
local enemy = (UnitCanAttack("player","target"))
local rage = UnitMana("player")
local energy = UnitSkill("player")
local tbuffs = BuffList("target")
local pbuffs = BuffList("player")
local front = UnitIsUnit("player", "targettarget")
local tDead = UnitIsDeadOrGhost("target")
local melee = GetActionUsable(32)
local LockedOn = UnitExists("target")
local _1,potcd
if potslot ~= nil then
_1,potcd=GetActionCooldown(potslot)
end
if (PctH("player")<.70) and (potcd == 0) then
UseAction(potslot)
return
end
i=i+1; Skill[i] = { name = "Survival Instinct", use = (PctH("player") < .5) }
i=i+1; Skill[i] = { name = "Probing Attack", use = (enemy and (rage >= 20)) }
i=i+1; Skill[i] = { name = "Open Flank", use = (enemy and (rage >= 10) and (string.find(tbuffs,"Vulnerable"))) }
i=i+1; Skill[i] = { name = "Keen Attack", use = (enemy and (energy >= 20) and (string.find(tbuffs,"Vulnerable"))) }
i=i+1; Skill[i] = { name = "Splitting Chop", use = (enemy and (rage >= 15) and (string.find(tbuffs,"Weakened"))) }
i=i+1; Skill[i] = { name = "Thunder", use = (enemy and (rage >= 15) and (string.find(tbuffs,"Weakened"))) }
i=i+1; Skill[i] = { name = "Shadowstab", use = (enemy and (energy >= 20) and (not string.find(tbuffs,"Excessive Bleeding"))) }
i=i+1; Skill[i] = { name = "Attack", use = (enemy and (PctH("target") == 1)) }
i=i+1; Skill[i] = { name = "Attack", use = (tDead or (not combat and not enemy)) }
MyCombat(Skill,arg1)
if tDead then
TargetNearestEnemy()
end
if (not LockedOn) then
TargetNearestEnemy()
end
if LockedOn and (not enemy) then
TargetNearestEnemy()
end
end