). My mana pool hardly decreases and Disarmament is last skill used in the combo
. |
|
Source code |
1 |
i=i+1; Skill[i] = { name = "Wound Attack", use = ((not friendly) and (energy >= 35) and not string.find(tbuffs, "Bleed") and string.find(tbuffs, "Grievous Wound")) }
|
|
|
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 |
function RogueScout(arg1)
local Skill = {}
local i = 0
local combat = GetPlayerCombatState()
local enemy = UnitCanAttack("player","target")
local energy = UnitMana("player")
local focus = UnitSkill("player")
local tbuffs = BuffList("target")
local pbuffs = BuffList("player")
local front = UnitIsUnit("player", "targettarget")
local tDead = UnitIsDeadOrGhost("target")
local melee = GetActionUsable(3)
local phealth = PctH("player")
local thealth = PctH("target")
local LockedOn = UnitExists("target")
local ammo = (GetEquipSlotInfo(10) ~= nil)
i=i+1; Skill[i] = { name = "Premeditation", use = (not combat) and (not string.find(pbuffs,"Premeditation"))}
i=i+1; Skill[i] = { name = "Vampire Arrows", use = (enemy) and (focus >=20) }
i=i+1; Skill[i] = { name = "Shadow Step", use = (not front) and (enemy) and (not melee) }
i=i+1; Skill[i] = { name = "Wound Attack", use = (enemy) and (energy >=35) and string.find(tbuffs,"Bleed") and string.find(tbuffs,"Grievous Wound")}
i=i+1; Skill[i] = { name = "Low Blow", use = (enemy) and (energy >=30) and string.find(tbuffs,"Bleed") }
i=i+1; Skill[i] = { name = "Shadowstab", use = (enemy) and (energy >=20) and (not string.find(tbuffs,"Bleed")) }
i=i+1; Skill[i] = { name = "Shot" use = enemy }
MyCombat(Skill,arg1)
end
|
|
|
Source code |
1 |
" before the segment and " |
|
|
Source code |
1 |
" tag at the beginning of the selection, and will also automatically create the " |
Quoted from "MidgetSlap;438083"
Is there a way to check for distance from the target? Such as using Surprise Attack on my warrior is there a way for me to check the distance and if the mob is too close then skip that skill and go to the next one?
Quoted from "Drake1132;438213"
Sort of... There used to be a function, UnitDistance(), but it has been removed and cannot be used anymore, at least not by us (although the game client and server can both still make range checks internally). Right now, the closest thing we can do to making distance checks is to rely on GetActionUsable(), which has it's limitations. The reason we can do this is that even though we are no longer allowed to envoke direct range checks, skills still make range checks internally, and if a skill is out of range, it is made unavailable for use.
For example, if you want to know if you are within melee range, then you can place a spammable melee range skill, such as Joint Blow, or Shadowstab, or Power of the Wood Spirit, etc. onto an actionbar slot, say slot 31 for example. You can then set a local variable: "local inMeleeRange = GetActionUsable(31)". After that point, you can make checks against that variable... using inMeleeRange would indicate that your target is within the 50 unit range of such a skill, while (not inMeleeRange) would indicate that your target is farther away than that. If you have other skills with different ranges, you could check against such skills to make more complex checks as well, such as "closer than skill1, but further out than skill2". In that particular example you would have, say two variables, inSkill1Range and inSkill2Range, and the check would be: (inSkill1Range and (not inSkill2Range)).
The problem with doing it in this way is that GetActionUsable() will return false for reasons other than the target being out of range, such as if the skill is on cooldown (which is why you want to try and rely on spammable skills when possible), or because you do not have enough mana/rage/energy/focus to use the skill, or if you are under the effects of GCD. Under most circumstances, if you use a spammable skill, the other possibilities will be infrequent enough to not be a major issue, but the limitations are important to keep in mind. One other potentially significant limitation is that you must use skills that your character already knows, and this can sometimes cause its own limitations if you do not know a skill with the particular range you are interested in checking. For example, a Mage/Priest does not get any melee range skills, and therefore can never make a melee range check in this manner.
Now I've never played as a Warrior, so I'm not sure, but I believe that Surprise Attack will be unavailable for use when you are more than 150 in-game distance units away from your target, but that it is also made unavailable if your target is closer than the 60 unit minimum distance. If that is, in fact, the way the skill works, then all you would need to do is place Surprise Attack on an actionbar slot for which you know the slot number, then in your use conditions for the "Surprise Attack" skill line, include GetAtctionUsable(slot#) as one of the conditions. That way DIYCE will only ever attempt to use Surprise Attack if its associated actionbar slot indicates that it is usable.
Drake
|
|
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 |
function WarriorRogue(arg1)
local Skill = {}
local i = 0
local friendly = (not UnitCanAttack("player", "target"))
local rage = UnitMana("player")
local energy = UnitSkill("player")
local combat = GetPlayerCombatState()
local tbuffs = BuffList("target")
i=i+1; Skill[i] = { ['name'] = "Survival Instinct", ['use'] = (PctH("player") < .25) }
i=i+1; Skill[i] = { ['name'] = "Enraged", ['use'] = (rage < 50) }
i=i+1; Skill[i] = { ['name'] = "Surprise Attack", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Probing Attack", ['use'] = ((not friendly) and (rage >= 20)) }
i=i+1; Skill[i] = { ['name'] = "Blood Dance", ['use'] = ((not friendly) and (PctH("player") >= 0.8)) }
i=i+1; Skill[i] = { ['name'] = "Splitting Chop", ['use'] = ((not friendly) and (rage >= 15) and (string.find(tbuffs,"Weakened"))) }
i=i+1; Skill[i] = { ['name'] = "Open Flank", ['use'] = ((not friendly) and (rage >= 10) and (string.find(tbuffs,"Vulnerable")) and CD("Splitting Chop")) }
i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = (not friendly) }
i=i+1; Skill[i] = { ['name'] = "Keen Attack", ['use'] = ((not friendly) and (energy >= 20) and (string.find(tbuffs,"Vulnerable"))) }
i=i+1; Skill[i] = { ['name'] = "Thunder", ['use'] = ((not friendly) and (rage >= 15)) }
i=i+1; Skill[i] = { ['name'] = "Slash", ['use'] = ((not friendly) and (rage >= 40)) }
MyCombat(Skill,arg1)
end
|
|
|
Source code |
1 |
local withinSurpriseAttackMinRange = GetActionUsable(shadowStepSlot) and (not GetActionUsable(surpriseAttackSlot)) |
|
|
Source code |
1 |
i=i+1; Skill[i] = { ['name'] = "Surprise Attack", ['use'] = (not friendly) and (not withinSurpriseAttackMinRange) }
|
|
|
Source code |
1 |
i=i+1; Skill[i] = { ['name'] = "Aggressiveness", ['use'] = combat and isBoss }
|
|
|
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 |
function WarriorRogue(arg1)
local Skill = {}
local i = 0
local friendly = (not UnitCanAttack("player", "target"))
local rage = UnitMana("player")
local energy = UnitSkill("player")
local combat = GetPlayerCombatState()
local tbuffs = BuffList("target")
local pbuffs = BuffList("player")
local isBoss = ((UnitSex("target") >= 2 or UnitSex("target")) == 2
local withinSurpriseAttackMinRange = GetActionUsable(0) and (not GetActionUsable(9))
i=i+1; Skill[i] = { ['name'] = "Frenzied Attack", ['use'] = combat and isBoss and (string.find(pbuffs, "Frenzied Attack"))) }
i=i+1; Skill[i] = { ['name'] = "Berserk", ['use'] = combat and isBoss and (string.find(pbuffs, "Berserk"))) }
i=i+1; Skill[i] = { ['name'] = "Aggressiveness", ['use'] = combat and isBoss and (string.find(pbuffs, "Aggressiveness"))) }
i=i+1; Skill[i] = { ['name'] = "Frenzy", ['use'] = combat and isBoss and (string.find(pbuffs, "Frenzy"))) }
i=i+1; Skill[i] = { ['name'] = "Survival Instinct", ['use'] = (PctH("player") < .25) }
i=i+1; Skill[i] = { ['name'] = "Enraged", ['use'] = (rage < 50) }
i=i+1; Skill[i] = { ['name'] = "Surprise Attack", ['use'] = (not friendly) and (not withinSurpriseAttackMinRange) }
i=i+1; Skill[i] = { ['name'] = "Blood Dance", ['use'] = ((not friendly) and (PctH("player") >= 0.8)) }
i=i+1; Skill[i] = { ['name'] = "Slash", ['use'] = ((not friendly) and (rage >= 25)) }
i=i+1; Skill[i] = { ['name'] = "Probing Attack", ['use'] = ((not friendly) and (rage >= 20)) }
i=i+1; Skill[i] = { ['name'] = "Splitting Chop", ['use'] = ((not friendly) and (rage >= 15) and (string.find(tbuffs,"Weakened"))) }
i=i+1; Skill[i] = { ['name'] = "Thunder", ['use'] = ((not friendly) and (rage >= 15)) }
i=i+1; Skill[i] = { ['name'] = "Open Flank", ['use'] = ((not friendly) and (rage >= 10) and (string.find(tbuffs,"Vulnerable")) and CD("Splitting Chop")) }
i=i+1; Skill[i] = { ['name'] = "Keen Attack", ['use'] = ((not friendly) and (energy >= 20) and (string.find(tbuffs,"Vulnerable"))) }
i=i+1; Skill[i] = { ['name'] = "Shadowstab", ['use'] = ((not friendly) and (energy >= 20)) }
MyCombat(Skill,arg1)
end
|
Quoted from "MidgetSlap;438511"
This is what I came up with but the elite and boss part is not working it doesn't buff me up when I start using the engine on an elite and a boss. Any suggestions on what I'm doing wrong?
|
|
Source code |
1 |
local isBoss = (UnitSex("target") >= 2) or (UnitSex("target") == 2)
|
|
|
Source code |
1 |
local isBoss = (UnitSex("target") >= 2)
|
Quoted from "Drake1132;438566"
Yeah, question... why are you trying to check if UnitSex() is greater than or equal to 2, and then also checking if it is equal to 2? The second check is superfluous and should be removed, because if it is equal to 2, then it must also therefore be (greater than or equal to) 2. In other words, as long as UnitSex("target") returns a value of 2 or larger, including 2, then isBoss will equal true with a simple ">= 2" check. Since UnitSex() always returns a value of 2 or larger for elite and boss targets, then the check needs no more distinctions. Secondly, your parentheses for the isBoss checks are way off. You need to enclose mathematical operations within parentheses entirely, so you would need (UnitSex("target") >= 2). The way you have it set up in your code is like you are trying to say, make isBoss true if UnitSex("target") is greater than or equal to either 2 or the value returned by UnitSex("target"), which would always be true, and then the extra "== 2" and the missing closing parentheses break the code.
If you really want to check against either >= 2 or == 2 (which you shouldn't bother doing because it is superfluous), then you would do it with the following...
But as I said, the second check is totally unnecessary, so you only need to be using:
![]()
Source code
1local isBoss = (UnitSex("target") >= 2) or (UnitSex("target") == 2)
Now if you want to be able to tell the difference between an elite target and a boss target, that *might* be possible, if all elite targets report a certain range of values for UnitSex, and all boss targets report a different range of values. Since I've never tested for this myself, I can't help you with that.
![]()
Source code
1local isBoss = (UnitSex("target") >= 2)
Also, for your buffs, your string.find checks should be checking for "(not string.find(pbuffs,"buffname"))". The way you currently have them set up, they will never trigger, because they are currently set to only be cast if your character already has the buff active. What you want is to check and make sure that the buff is *not* active so that you do not cast them unless you are not already affected by them. But as I said in my last post, this is just practice, as the durations and cooldowns for those skills are such that if they are not on cooldown, then there is no possible way that you are already affected. In other words, if they are available to be cast, then you will not already have them active on your character.
Also, start getting in the habit of checking your parentheses *all the time*, because right now your first 4 skill lines, "Frenzied Attack" through "Frenzy", all have incorrect parentheses. In all of them, you have only 2 opening parentheses, but you have 3 closing parentheses. This will always break your function. You have to make sure that for each line of code your parentheses match up perfectly... if you have 2 opening, then you *must* have 2 closing afterward, no more, no less, and if you have 4 opening, then you must have 4 closing, no more, no less. If your parentheses don't match up in this way, then your function *will* be broken. Lua is very picky (in fact virtually all programming and scripting languages are), and a single wrong, misplaced, missing, or extra character can break your function. You *must* pay very close attention to every detail until it becomes habitual second nature.
Drake
|
|
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 |
function RogueKnight(arg1,arg2)
local Skill = {}
local i = 0
local energy = UnitMana("player")
local mana = UnitSkill("player")
local friendly = (not UnitCanAttack("player", "target")
local combat = GetPlayerCombatState()
local tspell,ttime,telapsed = UnitCastingTime("target")
local pbuffs = BuffList("player")
local tbuffs = BuffList("target")
local tDead = UnitIsDeadOrGhost ()
local lockedOn = UnitExists("target")
i=i+1; Skill[i] = { name = "Blind Spot", use = ((not friendly) and (energy >= 25) and (arg2 == "behind") and (not string.find(tbuffs, "Bleed"))) }
i=i+1; Skill[i] = { name = "Shadowstab", use = ((not friendly) and (energy >= 35) and (not string.find(tbuffs, "Bleed"))) }
i=i+1; Skill[i] = { name = "Wound Attack", use = ((not friendly) and (energy >= 35) and not string.find(tbuffs, "Bleed") and string.find(tbuffs, "Grievous Wound")) }
i=i+1; Skill[i] = { name = "Low Blow", use = ((not friendly) and (energy >= 35) and string.find(tbuffs, "Bleed") and (not string.find(tbuffs, "Grievous Wound"))) }
i=i+1; Skill[i] = { name = "Disarmament", use = ((not friendly) and (mana >= 200) and (not string.find(tbuffs, "Disarmament I"))) }
i=i+1; Skill[i] = { name = "Shadowstab", use = ((not friendly) and (energy >= 35) and (not string.find(tbuffs, "Bleed"))) }
i=i+1; Skill[i] = { name = "Attack", use = (not friendly) }
 
MyCombat(Skill,arg1,arg2)
if (tDead) or (not lockedOn) or (not enemy) then
TargetNearestEnemy()
end
end
end
|
Quoted from "GunnyDuke;438703"
This is what i am trying to use but get the ingame error "string "RogueKnight ()" ]1: Attempt To Call Global 'RogueKnight' (a nil value)
|
|
Source code |
1 |
local friendly = (not UnitCanAttack("player", "target")
|
|
|
Source code |
1 |
(not enemy) |
|
|
Source code |
1 |
local enemy = not friendly |
|
|
Source code |
1 |
(not enemy) |
|
|
Source code |
1 |
friendly |
|
|
Source code |
1 2 3 4 5 6 |
function FunctionName(parameters)
stuff to do
if (conditions) then
stuff to do if conditions are true
end -- closes the if statement
end -- denotes the end of the function code
|
Quoted from "hmajik;439962"
Is there a way for this to be a bit more selective? Wasting DOT's on lvl 1 bunnies is frustrating.
Thanks
![]()
Source code
1 2 3 4-- Next enemy if tDead or (not LockedOn) or (not enemy) then TargetNearestEnemy() end
|
|
Source code |
1 2 3 4 5 6 7 |
-- Next enemy
if tDead or (not LockedOn) or (not enemy) then
TargetNearestEnemy()
while (UnitLevel("target") < (UnitLevel("player") * 0.9)) do
TargetNearestEnemy()
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 |
-- Next enemy
if tDead or (not LockedOn) or (not enemy) then
TargetNearestEnemy()
while (UnitLevel("target") < (UnitLevel("player") - 5)) do
TargetNearestEnemy()
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 |
-- Next enemy
if tDead or (not LockedOn) or (not enemy) then
TargetNearestEnemy()
while (UnitLevel("target") < 10) do
TargetNearestEnemy()
end
end
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
-- Next enemy
if tDead or (not LockedOn) or (not enemy) then
TargetNearestEnemy()
if ((UnitLevel("player") >= 10) and (UnitLevel("player") <= 20)) then
while (UnitLevel("target") < 3) do
TargetNearestEnemy()
end
elseif (UnitLevel("player") >= 21) then
while (UnitLevel("target") < 10) do
TargetNearestEnemy()
end
end
end
|