Quoted from "Galav;457288"
@Zaodon
I wouldn't say my code logic is WAY off, I just don't know a few functions that would be optimal and very helpful.
Does that sound plausible?
But TY for the help
Location: Dominating in 3vs3, 6vs6 and siege.
Occupation: Network Administrator for a local NBC T.V. station.
Quoted from "Peryl;452508"
I don't know of a way to detect if the target is a pet specifically, but you might consider checking if the target is a player. Though this brings up the potential problem of not being able to target mobs so either have a specific DIYCE script for Siege, or have a parameter passed-in to the function to allow/disallow non-player targets.
Anyway, the idea is to target a unit and check if this target is a player. If not, it selects the next target. This is done in a loop, but only 10 times or there is the possibility of locking the game into an infinite loop.
![]()
Source code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17--Select Next Enemy if tDead then TargetUnit("") return end if (not LockedOn) or (not enemy) then for i=1,10 do TargetNearestEnemy() if UnitIsPlayer("target") then break end end if not UnitIsPlayer("target") then TargetUnit("") end return end
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function ScoutDruid(arg1)
local Skill = {}
local i = 0
local focus = UnitMana("player")
local mana = UnitSkill("player")
local friendly = (not UnitCanAttack("player","target"))
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
local dbuffs = DebuffList("player")
i=i+1; Skill[i] = { ['name'] = "Savage Blessing", ['use'] = (not string.find(pbuffs,"Savage Blessing")) }
i=i+1; Skill[i] = { ['name'] = "Frost Arrow", ['use'] = (not string.find(pbuffs,"Frost Arrow")) }
i=i+1; Skill[i] = { ['name'] = "Focus", ['use'] = (not string.find(pbuffs,"Focus")) }
i=i+1; Skill[i] = { ['name'] = "Antidote", ['use'] = (string.find(dbuffs,"Poisoned")) }
i=i+1; Skill[i] = { ['name'] = "Recover", ['use'] = ((friendly) and (health <= .50) and (not string.find(tbuffs,"Recover"))) }
-- i=i+1; Skill[i] = { ['name'] = "Combo Shot", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Snake Poison Arrow", ['use'] = ((not friendly) and (mana >= 500)) }
i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((not friendly) and (focus >= 20)) }
i=i+1; Skill[i] = { ['name'] = "Wind Arrows", ['use'] = ((not friendly) and (focus >= 15)) }
i=i+1; Skill[i] = { ['name'] = "Target Area", ['use'] = (not string.find(pbuffs,"Target Area") and (focus >= 85)) }
-- i=i+1; Skill[i] = { ['name'] = "Piercing Arrow", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Snipe", ['use'] = (not friendly) }
MyCombat(Skill,arg1)
end
|
Quoted from "Stagg3r;460254"
I'm having some issues with my d/s function.
Quoted from "Stagg3r;460254"
Well, really just one issue... I'm getting a "skill not available" every run through for Combo Shot. My function isn't really any different from the base d/s posted in this thread. All I did was to move focus down in the priorety because I'm low level and it isn't active.
I understand that the cast timer would prevent skills from popping but I have tried to keep Combo Shot ahead of the other combat skills. Any ideas?
![]()
Source code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24function ScoutDruid(arg1) local Skill = {} local i = 0 local focus = UnitMana("player") local mana = UnitSkill("player") local friendly = (not UnitCanAttack("player","target")) local pbuffs = BuffList("player") local tbuffs = BuffList("target") local dbuffs = DebuffList("player") i=i+1; Skill[i] = { ['name'] = "Savage Blessing", ['use'] = (not string.find(pbuffs,"Savage Blessing")) } i=i+1; Skill[i] = { ['name'] = "Frost Arrow", ['use'] = (not string.find(pbuffs,"Frost Arrow")) } i=i+1; Skill[i] = { ['name'] = "Focus", ['use'] = (not string.find(pbuffs,"Focus")) } i=i+1; Skill[i] = { ['name'] = "Antidote", ['use'] = (string.find(dbuffs,"Poisoned")) } i=i+1; Skill[i] = { ['name'] = "Recover", ['use'] = ((friendly) and (health <= .50) and (not string.find(tbuffs,"Recover"))) } -- i=i+1; Skill[i] = { ['name'] = "Combo Shot", ['use'] = (not friendly) } i=i+1; Skill[i] = { ['name'] = "Shot", ['use'] = (not friendly) } i=i+1; Skill[i] = { ['name'] = "Snake Poison Arrow", ['use'] = ((not friendly) and (mana >= 500)) } i=i+1; Skill[i] = { ['name'] = "Vampire Arrows", ['use'] = ((not friendly) and (focus >= 20)) } i=i+1; Skill[i] = { ['name'] = "Wind Arrows", ['use'] = ((not friendly) and (focus >= 15)) } i=i+1; Skill[i] = { ['name'] = "Target Area", ['use'] = (not string.find(pbuffs,"Target Area") and (focus >= 85)) } -- i=i+1; Skill[i] = { ['name'] = "Piercing Arrow", ['use'] = (not friendly) } i=i+1; Skill[i] = { ['name'] = "Snipe", ['use'] = (not friendly) } MyCombat(Skill,arg1) end
Quoted from "Galav;460580"
Completely unrelated but I think runewaker just changed the Scout Wardens Shot to Shoot just to screw with our heads...
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
function Wcomb(arg1)
local Skill = {}
local i = 0
--vital signs
local plife = PctH("player")
local pBuffs = BuffList("player")
local power = UnitMana("player")
local pMana = PctS("player")
--mob status
local friendly = (not UnitCanAttack("player","target"))
local boss = (UnitSex("target")>2)
local tbuffs = BuffListID("target")
local tbleed = (string.find(tbuffs,500081))
local tBuffsb = BuffList("target")
--Health monitor
i=i+1; Skill[i] = { name = "Survival Instinct", use = ((plife <= .40) and (boss)) }
--Rage monitor
--Buffs
i=i+1; Skill[i] = { name = "Battle Creed", use = (not string.find(pBuffs,"Battle Creed")) }
i=i+1; Skill[i] = { name = "Briar Shield", use = (not string.find(pBuffs,"Briar Shield")) }
--combat
i=i+1; Skill[i] = { name = "Savage Whirlwind", use = (not friendly) }
i=i+1; Skill[i] = { name = "Tactical Attack", use = ((tbleed) and (power >= 16)) }
i=i+1; Skill[i] = { name = "Attack Weakener", use = ((not friendly) and (string.find(tBuffsb,"Vulnerable"))) }
i=i+1; Skill[i] = { name = "Open Flank", use = ((not friendly) and (string.find(tBuffsb,"Vulnerable")) and (power >=11)) }
i=i+1; Skill[i] = { name = "Probing Attack", use = ((not friendly) and (power >= 21) and (tbleed)) } --and (not CD("Tactical Attack"))
i=i+1; Skill[i] = { name = "Slash", use = ((not friendly) and (power >= 27)) }
i=i+1; Skill[i] = { name = "Enraged", use = ((power < 25) and (boss)) }
i=i+1; Skill[i] = { name = "Power of the Wood Spirit", use = (not friendly) }
i=i+1; Skill[i] = { name = "Attack", use = (not friendly) }
MyCombat(Skill,arg1)
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
-- DIY Combat Engine version 1.4
g_skill = {}
function Msg(outstr,a1,a2,a3)
DEFAULT_CHAT_FRAME:AddMessage(tostring(outstr),a1,a2,a3)
--SendChatMessage(tostring(outstr), "CHANNEL", 0, 3)
end
function ReadSkills()
g_skill = {}
local skillname,slot
Msg("- Reading Class Skills")
for page = 1,4 do
slot = 1
skillname = GetSkillDetail(page,slot)
repeat
local a1,a2,a3,a4,a5,a6,a7,a8,skillusable = GetSkillDetail(page,slot)
if skillusable then
g_skill[skillname] = { ['page'] = page, ['slot'] = slot }
end
slot = slot + 1
skillname = GetSkillDetail(page,slot)
until skillname == nil
end
end
ReadSkills() -- Read skills into g_skill table at login
function PctH(tgt)
return (UnitHealth(tgt)/UnitMaxHealth(tgt))
end
function PctM(tgt)
return (UnitMana(tgt)/UnitMaxMana(tgt))
end
function PctS(tgt)
return (UnitSkill(tgt)/UnitMaxSkill(tgt))
end
function CancelBuff(buffname)
local i = 1
local buff = UnitBuff("player",i)
while buff ~= nil do
if buff == buffname then
CancelPlayerBuff(i)
return true
end
i = i + 1
buff = UnitBuff("player",i)
end
return false
end
function BuffTimeLeft(tgt, buffname)
local cnt = 1
local buffcmd, bufftimecmd, buff
if UnitCanAttack("player", tgt) then
buffcmd = UnitDebuff
bufftimecmd = UnitDebuffLeftTime
else
buffcmd = UnitBuff
bufftimecmd = UnitBuffLeftTime
end
buff = buffcmd(tgt, cnt)
while buff ~= nil do
if string.find(buff, buffname) then
return bufftimecmd(tgt, cnt)
end
cnt = cnt + 1
buff = buffcmd(tgt, cnt)
end
return 0
end
function ChkBuff(tgt,buffname)
local cnt = 1
local buffcmd = UnitBuff
if UnitCanAttack("player",tgt) then
buffcmd = UnitDebuff
end
local buff = buffcmd(tgt,cnt)
while buff ~= nil do
if string.gsub(buff, "(%()(.)(%))", "%2") == buffname then
return true
end
cnt = cnt + 1
buff = buffcmd(tgt,cnt)
end
return false
end
function BuffList(tgt)
local cnt = 1
local buffcmd = UnitBuff
local buffstr = "/"
if UnitCanAttack("player",tgt) then
buffcmd = UnitDebuff
end
local buff = buffcmd(tgt,cnt)
while buff ~= nil do
buffstr = buffstr..buff.."/"
cnt = cnt + 1
buff = buffcmd(tgt,cnt)
end
return string.gsub(buffstr, "(%()(.)(%))", "%2")
end
function CD(skillname)
local firstskill = GetSkillDetail(2,1)
if (g_skill[firstskill] == nil) or (g_skill[firstskill].page ~= 2) then
ReadSkills()
end
if g_skill[skillname] ~= nil then
local tt,cd = GetSkillCooldown(g_skill[skillname].page,g_skill[skillname].slot)
return cd<0.5
elseif skillname == nil then
return false
else
Msg("Skill not available: "..skillname)
return false
end
end
function MyCombat(Skill, arg1)
local spell_name = UnitCastingTime("player")
local talktome = ((arg1 == "v1") or (arg1 == "v2"))
local action,actioncd,actiondef,actioncnt
if spell_name ~= nil then
if (arg1 == "v2") then Msg("- ['..spell_name..']", 0, 1, 1) end
return true
end
for x,tbl in ipairs(Skill) do
if Skill[x].use then
if string.find(Skill[x].name, "Action:") then
action = tonumber((string.gsub(Skill[x].name, "(Action:)( *)(%d+)(.*)", "%3")))
_1,actioncd = GetActionCooldown(action)
actiondef,_1,actioncnt = GetActionInfo(action)
if GetActionUsable(action) and (actioncd == 0) and (actiondef ~= nil) and (actioncnt > 0) then
if talktome then Msg("- "..Skill[x].name) end
UseAction(action)
return true
end
elseif string.find(Skill[x].name, "Custom:") then
action = string.gsub(Skill[x].name, "(Custom:)( *)(.*)", "%3")
if CustomAction(action) then
return true
end
elseif string.find(Skill[x].name, "Item:") then
action = string.gsub(Skill[x].name, "(Item:)( *)(.*)", "%3")
if talktome then Msg("- "..Skill[x].name) end
UseItemByName(action)
return true
elseif CD(Skill[x].name) then
if talktome then Msg("- "..Skill[x].name) end
CastSpellByName(Skill[x].name)
return true
end
end
end
if (arg1 == "v2") then Msg("- [IDLE]", 0, 1, 1) end
return false
end
[B]function BuffListID(tgt)
local cnt = 1
local buffcmd = UnitBuff
local buffstr = "/"
if UnitCanAttack("player",tgt) then
buffcmd = UnitDebuff
end
local buff, icon, count, ID = buffcmd(tgt,cnt)
while buff ~= nil do
buffstr = buffstr..buff.."/"..ID.."/"
cnt = cnt + 1
buff, icon, count, ID = buffcmd(tgt,cnt)
end
[/B]
return string.gsub(buffstr, "(%()(.)(%))", "%2")
end
function CustomAction(action)
if CD(action) then
if IsShiftKeyDown() then Msg("- "..action) end
g_lastaction = action
CastSpellByName(action)
return true
else
return false
end
end
|
|
|
Source code |
1 |
i=i+1; Skill[i] = { name = "Savage Whirlwind", use = (not friendly) }
|
|
|
Source code |
1 |
i=i+1; Skill[i] = { name = "Savage Whirlwind", use = ((not friendly) and CD("Savage Whirlwind"))
|