Ok, I've never written a macro before but wanted to give it a shot. I may have set my sights a little high, but I'm working on a pally macro that can pull and kill only undead mobs in the area.
EDIT: Recent changes should now check the pull mobs health before running and trying agro something already engaged. This is still best used in a safe spot and away from other players, but I'm adding basic checks to make this a little more useful. Next will be GM checks and other player checks, as I'm more concerned with doing this as safely as possible rather than grind as fast as possible.
Changed the code for setting off the epic click, but its not yet tested. I'll continue to update here in case anyone else wants to use this little project of mine.
Rich (BB code):
|pallyslay.mac
|Author: Fenix with modified code inspired heavily by Crystane and help editing by Alatyami
|(9-27-08) First attempt at making a simple macro
|(9-29-08) Reworked parts of the code that were not functioning with help. Tweaked movements a bit, cleaned up some of the stick commands.
|(9-30-08) Multiple pulls and add handling working, cleaned up code to remove unneeded parts. Added better handling of combat condition and mana regen durations.
|(10-1-08) Added support for stacking issues with spells, and improved the definition of spells needing to be cast. Also added checks of targets health while pulling as to not attempt to pull an engaged mob. Added ability to detect if a camp is being taken by others and ends the macro at the home location.
|This should set up a base camp where the macro was started, locate the nearest undead, pull to this home spot, and kill it while watching
| my health and healing where needed and medding where needed. It should also keep a set of self buffs as well as ward up at all times.
#turbo
#Event EXP "You gain experience#*#"
#Event BuffFade "#1# fades."
#Event MyDeath "You have been slain by#*#"
#Event CantSee "You cannot see your target."
#Event CantSee "You can't hit them from here."
#Include Spell_Routines.inc
#Include Itemcast.inc
Sub Main
|DistanceToStick used to determine how close the pulled mob is before using /stick command
/declare DistanceToStick int outer 50
|SelfHealPoint is the percentage of health to trigger self healing.
/declare SelfHealPoint int outer 50
/declare UseHoTPotion int outer 35
|Spells setup
/declare PullSpell string outer Challenge for Honor Rk. III
/declare QuickHeal string outer Burst of Morrow Rk. II
/declare HoT string outer Solemn Cleansing Rk. II
/declare Nuke string outer Benediction Rk. II
/declare Ward string outer Sustenance of Tunare
|Buff definition
/declare SpellBuffs[6] string outer
/varset SpellBuffs[1] Brell's Earthen Aegis Rk. II
/varset SpellBuffs[2] Oathbound Protector Rk. II
/varset SpellBuffs[3] Armor of Inexorable Faith Rk. II
/varset SpellBuffs[4] Righteous Fury Rk. II
/varset SpellBuffs[5] Blessed Aura
/varset SpellBuffs[6] Remorse for the Fallen Rk. II
|Item/Potion definition
/declare HoTPot string outer Distillate of Celestial Healing XIII
/declare ClickHeal string outer Mantle of the Wyrmguard
/declare EpicClick string outer Flames of the Valiant
/declare ItemBuffs[5] string outer
/varset ItemBuffs[1] Wristplates of the Fallen Saint
/varset ItemBuffs[2] Mask of Lament
/varset ItemBuffs[3] Distillate of Alacrity X
/varset ItemBuffs[4] Distillate of Clarity XIII
/varset ItemBuffs[5] Distillate of Spirituality XIII
|Setup base camp
/declare HomeX int outer ${Me.X.Int}
/declare HomeY int outer ${Me.Y.Int}
|Mob Counter
/declare TotalMobs int outer 0
/declare BadPulls int outer 0
/declare BadPullsTotal int outer 10
/declare TarID int outer NULL
|Target info
/declare TargetLocX int outer
/declare TargetLocY int outer
/declare PctToMed int outer 40
/declare MaxPullDistance int outer 800
/declare Rebuffstate bool outer FALSE
/declare StillInCombat bool outer FALSE
/declare NeedManaRegen bool outer FALSE
/call SpellSetup
:Start
/if (${Me.Type.Equal[Corpse]}) {
/echo I was killed
/delay 5s
/doevents MyDeath
/goto :Start
}
/if (${GameState.Equal[CHARSELECT]}) /endmacro
/call WardUpKeep
/call CheckMana
:FindLoop
/call FindTarget
/if (!${Target.ID}) {
/delay 10s
/if (${BadPulls} > ${BadPullsTotal}) {
/echo Another person taking camp, closing macro.
/endmacro
}
/goto :FindLoop
}
/call Pulling
:miniloop
/if (${Target.Distance} > ${DistanceToStick}) {
/delay 2s
/goto :miniloop
}
/call Combat
/call CheckSpellBuffs
/call CheckItemBuffs
/doevents
/goto :Start
/return
Sub SpellSetup
/if (${Me.Gem[${QuickHeal}]}!=1) {
/memspell 1 "${QuickHeal}"
/delay 6s ${Me.Gem[${QuickHeal}]}==1
}
/if (${Me.Gem[${HoT}]}!=2) {
/memspell 2 "${HoT}
/delay 6s ${Me.Gem[${HoT}]}==2
}
/if (${Me.Gem[${Ward}]}!=3) {
/memspell 3 "${Ward}"
/delay 6s ${Me.Gem[${Ward}]}==3
}
/if (${Me.Gem[${Nuke}]}!=6) {
/memspell 6 "${Nuke}"
/delay 6s ${Me.Gem[${Nuke}]}==6
}
/if (${Me.Gem[${PullSpell}]}!=7) {
/memspell 6 "${PullSpell}"
/delay 6s ${Me.Gem[${PullSpell}]}==7
}
/return
|Casts ward until successful
Sub WardUpKeep
/if (${Me.Buff[${Ward}].Duration}>5) /return
/call Cast "${Ward}"
/return
|If my mana is below the set point and no mob is close to me, then sit. Check every 10 seconds.
Sub CheckMana
/if (${SpawnCount[npc radius 50]} > 0) /return
/if (${NeedManaRegen}) {
/sit
/goto :Manaloop
}
/if (${Me.PctMana} > ${PctToMed}) /return
/varset NeedManaRegen TRUE
/sit
:Manaloop
/echo Medding, only at ${Me.PctMana} mana.
/delay 10s
/if ((${Me.PctMana}<80)&&(${SpawnCount[NPC radius 50]}<1)) /goto :Manaloop
/stand
/echo Done medding, resuming pulls.
/return
Sub CheckSpellBuffs
/if (!${Rebuffstate}) /return
/Echo Checking Buffs
/declare i int local 1
/for i 1 to ${SpellBuffs.Size}
/if (!${Me.Buff[${SpellBuffs[${i}]}].ID} && !${Me.Song[${SpellBuffs[${i}]} Effect].ID && ${Spell[${Spellbuffs[${i}]}].Stacks}) {
/target ${Me.Name}
/echo Rebuffing ${SpellBuffs[${i}]}
/call Cast "${SpellBuffs[${i}]}" gem5
}
/next i
/return
Sub CheckItemBuffs
/if (!${Rebuffstate}) /return
/declare i int local 1
/for i 1 to ${ItemBuffs.Size}
/if (!${Me.Buff[${FindItem[${ItemBuffs[${i}]}].Spell}].ID}) {
/call ItemCaster "${ItemBuffs[${i}]}"
/delay 2
}
/next i
/varset Rebuffstate FALSE
/return
Sub FindTarget
/Echo Finding nearest undead target
/call Cast "Sense the Dead" gem5
/if (${Target.Distance}>${MaxPullDistance} || ${Target.PctHPs} < 98) {
/target clear
/varcalc BadPulls (${BadPulls} + 1)
}
/return
Sub Pulling
/if (!${Target.ID}) /return
/face fast
/if (${Target.Distance}<200) /goto :Castpull
:moveloop
/declare i int local 1
/for i 1 to 400
/keypress forward hold
/delay 1s (${Target.Distance} > 200 && ${Target.PctHPs} > 98)
/keypress forward
/face fast
/if (${Target.Distance} < 200 && ${Target.PctHPs} > 98) /goto :Castpull
/next i
:Castpull
/delay 1s
/call Cast "${PullSpell}" gem7
/call ReturnHome
/return
Sub ReturnHome
/face fast nolook loc ${HomeY},${HomeX}
/declare j int local 1
/for j 1 to 400
/keypress forward hold
/delay 0.5s
/keypress forward
/face fast nolook loc ${HomeY},${HomeX}
/if (${Math.Distance[${HomeY},${HomeX}]}<15) /goto :Athome
/next j
:Athome
/if (${Target.ID}) {
/face fast
/varset StillInCombat TRUE
}
/return
Sub Combat
/if (!${StillInCombat}) /return
/stick 12
/attack on
:CombatLoop
/if (${SpawnCount[PC ${Me.Name}]}<1) {
/doevents ImDead
/return
}
/call WardUpKeep
/doevents
/if (${StillInCombat}) {
/if (${Me.SpellReady[${Nuke}]} && ${Select[${Target.Body},Undead]}==1 && ${Me.PctMana}>20) /call Cast "${Nuke}"
/if (${Me.AbilityReady[Bash]}) /doability Bash
/call Cast "Nightbane, Sword of the Valiant"
/if (${Me.Song[${EpicClick}].ID}) /call Cast "${ClickHeal}" item 2s
/if (${Me.PctHPs}<${SelfHealPoint}) {
/varset TarID ${Target.ID}
/target ${Me.Name}
/delay 1s
/call Cast "${QuickHeal}" ${Me.Gem[${QuickHeal}]} 5s
/target id ${TarID}
}
/if (${Me.PctHPs}<${UseHoTPotion}) /call ItemCaster "${HoTPot}"
/goto :CombatLoop
}
/call Combat
/return
Sub Event_EXP
/varcalc TotalMobs (${TotalMobs}+1)
/stick off
/varset StillInCombat FALSE
/delay 3s
/target npc
/delay 1s
/echo Checking nearest mob distance
/if (${Target.Distance}<${DistanceToStick}) {
/varset StillInCombat TRUE
/stick 12
/attack on
}
/delay 1s
/return
Sub Event_MyDeath
/echo Death takes us all eventually
/echo Ending Macro
/endmacro
/return
Sub Event_BuffFade
/varset Rebuffstate TRUE
/return
Sub Event_CantSee
/stick off
/keypress back hold
/delay .5s
/keypress back
/face fast
/stick 12
/return
EDIT: Recent changes should now check the pull mobs health before running and trying agro something already engaged. This is still best used in a safe spot and away from other players, but I'm adding basic checks to make this a little more useful. Next will be GM checks and other player checks, as I'm more concerned with doing this as safely as possible rather than grind as fast as possible.
Changed the code for setting off the epic click, but its not yet tested. I'll continue to update here in case anyone else wants to use this little project of mine.
Last edited:


