Forums

Post Reply
Forum Home > General Discussion > DIYCE (Do It Yourself Combat Engine) Guide

Rudy06
Member
Posts: 5

First thing to do is download here: http://rom.curse.com/downloads/rom-addons/details/diyce.aspx


It is installed like any other manual add-on, simply put it in: ROM\Interface\AddOns\


If I remember correctly there will be two files in the folder:

DIYCE.toc
DIYCE.lua


First thing to do is create a new file called myFunctions.lua.  Open up Notepad and save it as "myFunctions.lua" with the quotations. The quotes force it into the .lua format.


Seconds thing to do is open the DIYCE.toc and add on the second line myFunctions.lua.  This lets Runes of Magic know that it needs to look at this file as well.


Now the heavy stuff...This is the code I sent to Matt. It has three functions in it, which allows for THREE separate macros:


 

local AS_slot = 1;

 

function BloodArrow(arg1)

local Skill = {}

local i = 0

local focus = UnitMana("player")

local rage = UnitSkill("player")

local combat = GetPlayerCombatState()

local friendly = (not UnitCanAttack("player","target"))

local enemy = UnitHealth("target")

local self = PctH("player")

local _1, _2, _3, _4, _5, ASon = GetActionInfo(AS_slot)

 

--Blood Arrow Check

i=i+1; Skill[i] = { name = "Blood Arrow", use = ((not ChkBuff("player","Blood Arrow") and (self >= .7) and (combat))

or ((ChkBuff("player","Blood Arrow")) and ((self <= .4) or (not combat)))) }

 

--Basic Attacks

 

i=i+1; Skill[i] = { name = "Frost Arrow", use = (not ChkBuff("player","Frost Arrow")) }

i=i+1; Skill[i] = { name = "Battle Instinct", use = ((not ChkBuff("player","Battle Instinct")) and (rage >=30)) }

i=i+1; Skill[i] = { name = "Mental Focus", use = ((not ChkBuff("player","Mental Focus")) and (rage >=30)) }

i=i+1; Skill[i] = { name = "Target Lock", use = (not friendly)}

i=i+1; Skill[i] = { name = "Autoshot", use = ((not ASon) and (not friendly)) }

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 = "Reflected Shot", use = (not friendly) }

i=i+1; Skill[i] = { name = "Piercing Arrow", use = (not friendly) }

i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly) and (focus >= 20) and (enemy >= 100000)) }

i=i+1; Skill[i] = { name = "Wind Arrows", use = ((not friendly) and (focus >= 15)) }

 

MyCombat(Skill,arg1)

end

 

 

 

 

 

function ScoutRogue(arg1)

local Skill = {}

local i = 0

local focus = UnitMana("player")

local combat = GetPlayerCombatState()

local friendly = (not UnitCanAttack("player","target"))

local enemy = UnitHealth("target")

local self = PctH("player")

local tbuffs = BuffList("target")

local _1, _2, _3, _4, _5, ASon = GetActionInfo(AS_slot)

 

--Basic Attacks

 

i=i+1; Skill[i] = { name = "Frost Arrow", use = (not ChkBuff("player","Frost Arrow")) }

i=i+1; Skill[i] = { name = "Battle Instinct", use = ((not ChkBuff("player","Battle Instinct")) and (rage >=30)) }

i=i+1; Skill[i] = { name = "Mental Focus", use = ((not ChkBuff("player","Mental Focus")) and (rage >=30)) }

i=i+1; Skill[i] = { name = "Target Lock", use = (not friendly)}

i=i+1; Skill[i] = { name = "Autoshot", use = ((not ASon) and (not friendly)) }

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 = "Reflected Shot", use = (not friendly) }

i=i+1; Skill[i] = { name = "Piercing Arrow", use = (not friendly) }

i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly) and (focus >= 20) and (enemy >= 100000)) }

i=i+1; Skill[i] = { name = "Wind Arrows", use = ((not friendly) and (focus >= 15)) }

 

MyCombat(Skill,arg1)

end

 

 

 

 

function ScoutSpam(arg1)

local Skill = {}

local i = 0

local focus = UnitMana("player")

local combat = GetPlayerCombatState()

local friendly = (not UnitCanAttack("player","target"))

local enemy = UnitHealth("target")

local self = PctH("player")

local tbuffs = BuffList("target")

local _1, _2, _3, _4, _5, ASon = GetActionInfo(AS_slot)

 

--Basic Attacks

 

i=i+1; Skill[i] = { name = "Frost Arrow", use = (not ChkBuff("player","Frost Arrow")) }

i=i+1; Skill[i] = { name = "Autoshot", use = ((not ASon) and (not friendly)) }

i=i+1; Skill[i] = { name = "Shot", use = (not friendly) }

i=i+1; Skill[i] = { name = "Reflected Shot", use = (not friendly) }

i=i+1; Skill[i] = { name = "Piercing Arrow", use = (not friendly) }

i=i+1; Skill[i] = { name = "Wind Arrows", use = ((not friendly) and (focus >= 15)) }

 

MyCombat(Skill,arg1)

end


December 2, 2010 at 11:30 PM Flag Quote & Reply

Rudy06
Member
Posts: 5

Deciphering the previous code(or at least the important lines):


function BloodArrow(arg1)

This is what is used to name the function and call it in game. You can name it whatever you want. Since this is a macro using Blood Arrow that's why I call it that.

local focus = UnitMana("player")

local rage = UnitSkill("player")

The words focus and rage are just to help the coder understand what he is concerned about.  UnitMana refers to the PRIMARY class's mana/focus/rage. UnitSkill("player") refers to the SECONDARY class's mana/focus/rage. So if Matt made a macro for a Warrior/Scout, UnitMana would be rage and UnitSkill would be focus. It is ENTIRELY DEPENDENT ON YOUR PRIMARY AND SECONDARY CLASS AT THE TIME.  These two lines simply keep track of how much mana/rage/focus a person has. If both classes use Mana, then you only need to use UnitMana.

local combat = GetPlayerCombatState()

Simply returns if the player is in combat or not.

local friendly = (not UnitCanAttack("player","target"))

Simply returns if the player can attack the target.

local enemy = UnitHealth("target")

Simply returns how much health the enemy has.

local self = PctH("player")

Simply returns the current percentage of the player's health. If you are at 100%, 70%, or only 10%.

local _1, _2, _3, _4, _5, ASon = GetActionInfo(AS_slot)

Is only for Autoshot on Scouts.


The next part has three different sections which will be the part that needs edited the most.  The three, most likely, things that need coding are buffs, debuffs, and attacks.


 

i=i+1; Skill[i] = { name = "Blood Arrow", use = ((not ChkBuff("player","Blood Arrow") and (self >= .7) and (combat))

or ((ChkBuff("player","Blood Arrow")) and ((self <= .4) or (not combat)))) }

 

This first off calls the skill by NAME, not action bar slot. This code says I want to use Blood Arrow when I do not have the buff Blood Arrow, when I am above 70% health, and when I am in combat. It will deactivate when I am below 40% health or out of combat.

NOTE: Item-Set Skills are handled differently. I am not sure how they can be referenced.

i=i+1; Skill[i] = { name = "Frost Arrow", use = (not ChkBuff("player","Frost Arrow")) }

This is a simpler buff than the first. It will check if I do not have the buff on, if I don't then it will cast. Simple, effective, and does it before you even attack.

i=i+1; Skill[i] = { name = "Target Lock", use = (not friendly)}

This is a debuff.  Most debuffs can be treated as attacks due to most having longer cooldowns than the effective time of the debuff. This is the base code needed for attack skills. It checks to make sure your target is an enemy and uses the move on them.

i=i+1; Skill[i] = { name = "Vampire Arrows", use = ((not friendly) and (focus >= 20) and (enemy >= 100000)) }

This is a more advanced attack.  Along with checking to make sure my target is an enemy, it also makes sure I have more than 20 focus. If I have less than 20 focus, this move will be ignored. Also, this move will only be used if the enemy has more than 100,000 health. NOTE: For moves that require rage/focus/mana it is important to put a minimum amount.  Without the minimum amount it will repeatedly try to use the move, unless it is on cooldown, and will not move on to any additional skills.


Using a mixture of those, it should be possible to code any attack. There are more advanced maneuvers, such as detecting if the Shift key is being held to activate specific attacks only when shift is held (good for rogues when they want to use this macro and tell it that they are BEHIND the enemy.)

December 2, 2010 at 11:57 PM Flag Quote & Reply

Rudy06
Member
Posts: 5

To use the functions in game:

For my skill named BloodArrow I type the following into a macro.

/run BloodArrow()


Simple!


Now the most important final note possible:

The order of skills is important!!! I have Wind Arrows at the bottom as it is my last resort skill. When I have nothing left to cast, I cast Wind Arrows. The skills at the top are FIRST PRIORITY and as they approach the end they are lower priority. If you put a skill that has no cooldown on top, you will never be able to use any other skills. Make sure to know which skills result in a global cooldown, such as Wind Arrows.



There are premade setups on the RoM forums that you can grab and edit if you want. Some get pretty heavy and include, heals, items, etc. If you need any help setting one up, PM me here on the site. If you have a setup you think is golden, post it here. =D
December 3, 2010 at 12:03 AM Flag Quote & Reply

You must login to post.