You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

321

Tuesday, April 27th 2010, 4:44pm

I see, maybe I should try doing it the same way instead of making 2 seperate functions. It was still going nuts after correcting the errors though, maybe my system is on its last legs lol.

322

Tuesday, April 27th 2010, 5:14pm

Quoted from "FoUZeroEnna;264740"

Ok I have lost all patience with trying to make my function work. I basically used to the MP function that was on I believe page 3 and just added a line to cast regenerate when HP was at 90 and urgent heal if health was at or = to 60 and nothing worked.

Can someone please make a function for MP? I do not even care if its two seperate functions. My WS function works fine but ohhh no not this one. RaR!

Conditions: I would like it to cast regenerate if health is <=90 and urgent heal if health is <=65 and then cycle thru my spells until target is close to death.

And Thank you sixxy for making this combat engine, works brilliantly for my WS.


Give this one a try...

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
function MagePriest(arg1)
    local Skill = {}
    local i = 0
    local mana = UnitMana("player")
    local friendly = (not UnitCanAttack("player","target"))
    local pbuffs = BuffList("player")
    local tbuffs = BuffList("target")
    local phealth = PctH("player")
    local thealth = PctH("target")
    local health, buffs
    
    if friendly then
        health = thealth
        buffs = tbuffs
    else
        health = phealth
        buffs = pbuffs
    end
    
    i=i+1; Skill[i] = { name = "Holy Aura",           use = (phealth <= .30) }
    i=i+1; Skill[i] = { name = "Regenerate",          use = ((health <= .90) and (not string.find(buffs, "Regenerate"))) }
    i=i+1; Skill[i] = { name = "Urgent heal",         use = (health <= .65) }
    i=i+1; Skill[i] = { name = "Elemental Weakness",  use = ((not friendly) and (not string.find(tbuffs, "Elemental Weakness"))) }
    i=i+1; Skill[i] = { name = "Magic Drain",         use = ((not friendly) and (not string.find(tbuffs, "Drain"))) }
    i=i+1; Skill[i] = { name = "Electric Bolt",       use = ((not friendly) and (not string.find(tbuffs, "Electric Flux"))) }
    i=i+1; Skill[i] = { name = "Fireball",            use = (not friendly) }
    i=i+1; Skill[i] = { name = "Rising Tide",         use = (not friendly) }
    i=i+1; Skill[i] = { name = "Flame",               use = (not friendly) }
 
    MyCombat(Skill,arg1)
end
I just took the code you referenced (on page 3) and added the logic for Regenerate and Urgent Heal. Be aware that if you have a friendly targeted it will Regen/UH them, not you. If you have an enemy targeted it will do you (assuming you have self-cast enabled in the options).

I left all the other attacks as is so if you don't like any of them, just comment them out or remove those lines.

323

Tuesday, April 27th 2010, 5:26pm

Quoted from "Tigsman;264950"

strangely odd, but i normally run 2h axe when doing trash and sword and board most of the time tanking. here is what my code looks like for my KW at the moment, always tweaking it though lol


Just a minor suggestion for you KWcombat... you don't need both of these lines:

Source code

1
2
3
   local tspell,ttime,telapsed = UnitCastingTime("target")

   local tgtcast = UnitCastingTime("target")
tspell and tgtcast are the same value. So you can just use the first line and replace tspell with tgtcast:

Source code

1
   local tgtcast,ttime,telapsed = UnitCastingTime("target")

324

Tuesday, April 27th 2010, 5:54pm

Quoted from "ReverantSpark;264933"

Your almost there with blind stab bud, you have to be in front of the target to use it, which Im pretty sure I was. I will retest it after I have corrected the errors.


AFAIK there's no way to programmatically tell it that you're in front of or behind the target, so in order to have your function execute positional attacks you'll have to signal it that you're in the proper position.

There's a couple of ways to do that, but my preferred method is to pass a 2nd value to the function, much like Tigs is with his threaten and disarm logic.

Tigsman

Trainee

Posts: 126

Location: ATL

Occupation: Fixing Things

  • Send private message

325

Tuesday, April 27th 2010, 6:10pm

Quoted from "Sixpax;264982"

Just a minor suggestion for you KWcombat... you don't need both of these lines:

Source code

1
2
3
   local tspell,ttime,telapsed = UnitCastingTime("target")

   local tgtcast = UnitCastingTime("target")
tspell and tgtcast are the same value. So you can just use the first line and replace tspell with tgtcast:

Source code

1
   local tgtcast,ttime,telapsed = UnitCastingTime("target")

thx for the cleanup!


T

326

Tuesday, April 27th 2010, 6:13pm

Quoted from "Sixpax;265006"

AFAIK there's no way to programmatically tell it that you're in front of or behind the target, so in order to have your function execute positional attacks you'll have to signal it that you're in the proper position.

There's a couple of ways to do that, but my preferred method is to pass a 2nd value to the function, much like Tigs is with his threaten and disarm logic.


Yeah, its no big deal though, once I start wailing on a mob it soon turns to face me =P

And thanks guys, I got it working now, I will post it on here for others to use and play with... Once I get it tweaked to perfection that is ;) lol

327

Tuesday, April 27th 2010, 7:26pm

Quoted from "sinsource;263008"

Hi All,

I am trying to come up with something for a M/R that i have in the works.
I am wondering does this seem structurally sound to you guys ? I haven't had a chance to test it because the M/R isnt high enough level for most of the skills so i will just comment them out until then. The question still remains will with work ?

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 MageRogue(arg1)
   local Skill = {}
   local i = 0
   local mana = UnitMana("player")
   local friendly = (not UnitCanAttack("player","target"))
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")
   local health = PctH("player")
   
   i=i+1; Skill[i] = { ['name'] = "Electrostatic Charge", ['use'] = (PctH("player") <= .25) }
   i=i+1; Skill[i] = { ['name'] = "Kiss of the Vampire",  ['use'] = ((not friendly) and (PctH("player") <= .50)) }
   i=i+1; Skill[i] = { ['name'] = "Fang Ritual",          ['use'] = ((not combat) and (not string.find(pbuffs,"Fang Ritual"))) }
   i=i+1; Skill[i] = { ['name'] = "Energy Influx",        ['use'] = ((not combat) and (not string.find(pbuffs,"Energy Influx"))) }
   i=i+1; Skill[i] = { ['name'] = "Elemental Weakness",   ['use'] = ((not friendly) and (not string.find(tbuffs,"Elemental Weakness"))) }
   i=i+1; Skill[i] = { ['name'] = "Discharge",            ['use'] = (PctH("player") <= .50) }
   i=i+1; Skill[i] = { ['name'] = "Lightning",          ['use'] = (not friendly) }
   i=i+1; Skill[i] = { ['name'] = "Electric Explosion",   ['use'] = ((not friendly) and (string.find(pbuffs,"Charged"))) }
   i=i+1; Skill[i] = { ['name'] = "Electric Bolt",        ['use'] = ((not friendly) and (not string.find(tbuffs,"Electric Flow"))) }
   i=i+1; Skill[i] = { ['name'] = "Cursed Fangs",         ['use'] = ((not friendly) and (not string.find(tbuffs,"Cursed Fangs"))) }
   i=i+1; Skill[i] = { ['name'] = "Plasma Arrow",         ['use'] = (not friendly) }
 
   MyCombat(Skill,arg1)
end


Hey, I also have a mage/rogue, and after proofreading your code, I have been using it, I fixed it up for you, adding a bit of my own coding. I added the shield and Kiss of Vamp for those "Oh ****" moments. Also Elemental weakness is an amazing debuff. Your only mistakes were priority order and a few spelling errors. Yours definitely helped mine get started, so thanks.

328

Wednesday, April 28th 2010, 3:09am

Quoted from "RoyRogers;264845"

Exactly




Pretty much. You could delete the lines altogether if you want.




Health pots put at the top. The macro runs the function which does the first thing it is capable of doing then stops. Put the health pots at the top in "reverse" order. Reverse meaning you want the biggest pot to fire at the lowest health. If you are at 30% health and have a Spirit Pot first to fire at 85% and a Phirius B pot after that to fire at 50% it will hit the 85% first and fire then fire the 50% on the next go around. Reverse the order and the 50% will fire first (more immediate need).




Yep, 'tis all you need. I actually have RogueScout1() and RogueScout2(). One I use for normal grinding and does not involve Phirus pots, just the vendor pots. Two involves Phirius pots and I use that while in instances.

Here is what I now use...

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
function RogueScout1(arg1,arg2)
   local Skill = {}
   local i = 0
   local energy = UnitMana("player")
   local friendly = (not UnitCanAttack("player","target"))
   local combat = GetPlayerCombatState()
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")
 
   i=i+1; Skill[i] = { ['name'] = "Action: 68",    ['use'] = (PctH("player") < .30) }
   i=i+1; Skill[i] = { ['name'] = "Action: 69",    ['use'] = (PctH("player") < .32) }
   i=i+1; Skill[i] = { ['name'] = "Action: 70",    ['use'] = (PctH("player") < .34) }
   i=i+1; Skill[i] = { ['name'] = "Action: 62",    ['use'] = (PctH("player") < .40) }
   i=i+1; Skill[i] = { ['name'] = "Action: 61",    ['use'] = (PctH("player") < .85) }
   i=i+1; Skill[i] = { ['name'] = "Combat Master",  ['use'] = ((not string.find(pbuffs,"Combat Master")) and (not string.find(pbuffs,"Informer"))) }
   i=i+1; Skill[i] = { ['name'] = "Wound Attack",   ['use'] = ((not friendly) and (energy >=35) and 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")) }
   i=i+1; Skill[i] = { ['name'] = "Shadowstab",     ['use'] = ((not friendly) and (energy >=35)) }
   i=i+1; Skill[i] = { ['name'] = "Shot",           ['use'] = (not friendly) }
 
   MyCombat(Skill,arg1)
end
 
function RogueScout2(arg1,arg2)
   local Skill = {}
   local i = 0
   local energy = UnitMana("player")
   local friendly = (not UnitCanAttack("player","target"))
   local combat = GetPlayerCombatState()
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")
 
   i=i+1; Skill[i] = { ['name'] = "Action: 68",    ['use'] = (PctH("player") < .30) }
   i=i+1; Skill[i] = { ['name'] = "Action: 69",    ['use'] = (PctH("player") < .32) }
   i=i+1; Skill[i] = { ['name'] = "Action: 70",    ['use'] = (PctH("player") < .34) }
   i=i+1; Skill[i] = { ['name'] = "Action: 65",    ['use'] = (PctH("player") < .50) }
   i=i+1; Skill[i] = { ['name'] = "Action: 64",    ['use'] = (PctH("player") < .60) }
   i=i+1; Skill[i] = { ['name'] = "Action: 63",    ['use'] = (PctH("player") < .65) }
   i=i+1; Skill[i] = { ['name'] = "Action: 62",    ['use'] = (PctH("player") < .70) }
   i=i+1; Skill[i] = { ['name'] = "Action: 61",    ['use'] = (PctH("player") < .85) }
   i=i+1; Skill[i] = { ['name'] = "Combat Master",  ['use'] = ((not string.find(pbuffs,"Combat Master")) and (not string.find(pbuffs,"Informer"))) }
   i=i+1; Skill[i] = { ['name'] = "Poison",         ['use'] = ((not combat) and (not string.find(pbuffs,"Poison"))) }
   i=i+1; Skill[i] = { ['name'] = "Wound Attack",   ['use'] = ((not friendly) and (energy >=35) and 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")) }
   i=i+1; Skill[i] = { ['name'] = "Shadowstab",     ['use'] = ((not friendly) and (energy >=35)) }
   i=i+1; Skill[i] = { ['name'] = "Shot",           ['use'] = (not friendly) }
 
   MyCombat(Skill,arg1)
end
Action 68, 69 and 70 are my "Its all gone pear shaped, time to get the goony goo goo ef outa hear" skills... Substitue, Joint Blow and Sprint.

ETA: note that I do not have premed or Vamp Arrows in this. I like to control how I start combat and PM/S/VA/S is now second nature to me. I left shot in the bottom and the script does an excellent job of spamming it when I am out of energy.


Thank you very much for the help, and I didn't mention it earlier, but thanks to everyone else who is contributing to creating/editing and helping others with this combat engine.

P.S. Will it make the combat engine faster if I delete the lines I don't need?

329

Wednesday, April 28th 2010, 3:12am

Is there a way to add health and mana potions to the code below ? or will the engine get stuck on trying to drink a potion if you put in a health check ?









Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function RogueKnight(arg1,arg2)
   local Skill = {}
   local i = 0
   local energy = UnitMana("player")
   local friendly = (not UnitCanAttack("player","target"))
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")
   i=i+1; Skill[i] = { ['name'] = "Enhanced Armor",  ['use'] = ((not string.find(pbuffs,"Enhanced Armor")) and (not combat)) }
   i=i+1; Skill[i] = { ['name'] = "Poison",  ['use'] = ((not string.find(pbuffs,"Poison")) and (not combat)) }
   i=i+1; Skill[i] = { ['name'] = "Punishment",           ['use'] = (string.find(tbuffs,"Light Seal III")) }
   i=i+1; Skill[i] = { ['name'] = "Wound Attack",   ['use'] = ((not friendly) and (energy >=35) and (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"))) }
   i=i+1; Skill[i] = { ['name'] = "Shadowstab",     ['use'] = ((not friendly) and (energy >=35)) }
   i=i+1; Skill[i] = { ['name'] = "Holy Strike",          ['use'] = (not friendly) }
   
   MyCombat(Skill,arg1)
end

330

Wednesday, April 28th 2010, 3:21am

i=i+1; Skill = { ['name'] = "Action: 80", ['use'] = (PctH("player") < .85) }

I added it to your code so you can see it, its above Enhanced Armor, the number 80, you can change to whatever slot you have your health potion in, and the .85 you can change to whatever percentage health you want it to check for. Thanks to Six and others for the info.

please anyone, correct me if I'm wrong, I'm just copying it from mine:)


Quoted from "smoopid;265330"

Is there a way to add health and mana potions to the code below ? or will the engine get stuck on trying to drink a potion if you put in a health check ?









Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function RogueKnight(arg1,arg2)
   local Skill = {}
   local i = 0
   local energy = UnitMana("player")
   local friendly = (not UnitCanAttack("player","target"))
   local pbuffs = BuffList("player")
   local tbuffs = BuffList("target")
   i=i+1; Skill[i] = { ['name'] = "Action: 80",    ['use'] = (PctH("player") < .85) }
   i=i+1; Skill[i] = { ['name'] = "Enhanced Armor",  ['use'] = ((not string.find(pbuffs,"Enhanced Armor")) and (not combat)) }
   i=i+1; Skill[i] = { ['name'] = "Poison",  ['use'] = ((not string.find(pbuffs,"Poison")) and (not combat)) }
   i=i+1; Skill[i] = { ['name'] = "Punishment",           ['use'] = (string.find(tbuffs,"Light Seal III")) }
   i=i+1; Skill[i] = { ['name'] = "Wound Attack",   ['use'] = ((not friendly) and (energy >=35) and (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"))) }
   i=i+1; Skill[i] = { ['name'] = "Shadowstab",     ['use'] = ((not friendly) and (energy >=35)) }
   i=i+1; Skill[i] = { ['name'] = "Holy Strike",          ['use'] = (not friendly) }
 
   MyCombat(Skill,arg1)
end

331

Wednesday, April 28th 2010, 3:22am

Source code

1
i=i+1; Skill[i] = { ['name'] = "Combat Master",  ['use'] = ((not string.find(pbuffs,"Combat Master")) and (not string.find(pbuffs,"Informer"))) }


What does the (pbuffs,"Informer") at the end of the code do?

332

Wednesday, April 28th 2010, 3:51am

Checks to make sure Informer is not up. Combat Master and informer overwrite each other.

333

Wednesday, April 28th 2010, 9:33am

Quoted from "smoopid;265330"

Is there a way to add health and mana potions to the code below ? or will the engine get stuck on trying to drink a potion if you put in a health check ?


For mana you will need to add the following as a stand alone function...

Source code

1
2
3
function PctM(tgt)
   return (UnitMana(tgt)/UnitMaxMana(tgt))
end


I added it under the function defining PctH for tidiness. Now all you need do is add the following lines to your personalized function...

Source code

1
2
   i=i+1; Skill[i] = { ['name'] = "Action: 61",    ['use'] = (PctH("player") < .80) }
   i=i+1; Skill[i] = { ['name'] = "Action: 67",    ['use'] = ((not combat) and (PctM < .80)) }
Adjust the Action: ## and Pct? < .## to meet your own specific requirements. And the (no combat) is on my mana line, you can take it out of yours if you want to mana pot in combat.

334

Wednesday, April 28th 2010, 11:21am

Thankyou. I will try it out now :)

335

Wednesday, April 28th 2010, 11:38am

Quoted from "RoyRogers;265459"

For mana you will need to add the following as a stand alone function...

function PctM(tgt)
return (UnitMana(tgt)/UnitMaxMana(tgt))
end

I added it under the function defining PctH for tidiness. Now all you need do is add the following lines to your personalized function...

Source code

1
2
   i=i+1; Skill[i] = { ['name'] = "Action: 61",    ['use'] = (PctH("player") < .80) }
   i=i+1; Skill[i] = { ['name'] = "Action: 67",    ['use'] = ((not combat) and (PctM < .80)) }
Adjust the Action: ## and Pct? < .## to meet your own specific requirements. And the (no combat) is on my mana line, you can take it out of yours if you want to mana pot in combat.




Im getting an error :(

Maybe im putting this in the wrong place.

function PctM(tgt)
return (UnitMana(tgt)/UnitMaxMana(tgt))
end

I put this part at the end of the combat engine before my rogueknight function and added the 2 lines to my rogueknight function is this correct ? If so why would I be getting an error ?

336

Wednesday, April 28th 2010, 12:14pm

Try this

Source code

1
i=i+1; Skill[i] = { ['name'] = "Action: 67",    ['use'] = ((not combat) and (PctM("player") < .80)) }


What you quoted just has PctM with no function parameters. LUA would look for a defined variable by that name, which there presumably isn't. Alternately you could set up a variable for it, which would save you processing time if you use that value more than once.

337

Wednesday, April 28th 2010, 1:09pm

Quoted from "smoopid;265552"

Im getting an error :(

Maybe im putting this in the wrong place.

Source code

1
2
3
function PctM(tgt)
   return (UnitMana(tgt)/UnitMaxMana(tgt))
end


I put this part at the end of the combat engine before my rogueknight function and added the 2 lines to my rogueknight function is this correct ? If so why would I be getting an error ?



Did you change the Action numbers to match the slots you have your pots in? And yes, where you put it should be just fine. Need to define the function before calling on it.

338

Wednesday, April 28th 2010, 1:12pm

Quoted from "Imortalisle;265327"

P.S. Will it make the combat engine faster if I delete the lines I don't need?


No. It ignores those lines completely when the game reads them into memory.

339

Wednesday, April 28th 2010, 1:29pm

Quoted from "RoyRogers;265567"

Did you change the Action numbers to match the slots you have your pots in? And yes, where you put it should be just fine. Need to define the function before calling on it.


Actually delve is correct... you need to change (PctM < .80) to (PctM("player") < .80).

340

Wednesday, April 28th 2010, 2:43pm

Just want to say thanks for all the work, Six, Tigs, and all of you who contributed. CE is making RoM fun again (hey there's your slogan :D)