Might not be pretty, but it works. Added Philter of Shadows, and continues the task if you run out of potions.
[CODE lang="ini" title="Heroism"]
| No Heroism Without Fear macro by eqmule 2019
| Instructions:
| Start in feerrott the dream.
| /mac Heroism
| I tested on a sk with a apprentice II healer merc
| Pre Reqs: mq2nav mq2melee and mq2 built later than oct 02 2019
| Uses Approximatley 25 Invis Potions,
| And or Cloudy Potion, Philter of Shadows.
| If you run out of invis potions it will continue without them
#warning
#turbo 120
#define /message "/echo \at[\ayPKF\at]\aw "
Sub Main
/if (${Bool[${Plugin[MQ2AutoLoot]}]}) {
/if (${AutoLoot.Active}) {
/autoloot turn off
}
}
/target clear
/attack off
/declare invisspell string outer NULL
/declare invisspellname string outer
/declare myTargetID int outer 0
/if (${FindItem[Cloudy Potion].ID}) {
/varset invisspell Cloudy Potion
/varset invisspellname Invisibility
}
/if (${FindItem[Philter of Shadows].ID}) {
/varset invisspell Philter of Shadows
/varset invisspellname Invisibility
}
/if (${Me.Class.Name.Equal[Druid]}) {
/varset invisspell Innate Camouflage
/varset invisspellname Camouflage
}
/if (${Me.Class.Name.Equal[Bard]}) {
/varset invisspell Shauri's Sonorous Clouding
/varset invisspellname Shauri's Sonorous Clouding
}
/if (${Me.Class.Name.Equal[Shadow Knight]}) {
/varset invisspell Cloak of Shadows
/varset invisspellname Cloak of Shadows
}
/if (${Me.Class.Name.Equal[Magician]} || ${Me.Class.Name.Equal[Enchanter]}) {
/varset invisspell Perfected Invisibility
/varset invisspellname Perfected Invisibility:Permanent
}
/echo invisspell is: ${invisspell}
/if (${invisspell.Equal[NULL]}) {
/echo well, you have no invis spell set, might want to add one to the macro.
}
| See if we have the task, and request it if not:
/call CheckTask "No Heroism Without Fear" "npc Drolmer" "Help"
| ${Task[No Heroism Without Fear].Step.Index}
| No Heroism Without Fear:
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Vekman" 1
/call GoToNPC "No Heroism Without Fear" "npc a merc" 2
/call KillNPC "No Heroism Without Fear" "npc worry" 3
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Vekman" 4
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Spelner" 5
/call KillNPC "No Heroism Without Fear" "npc crazed mercena" 6
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Spelner" 7
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Elgron" 8
/call KillNPC2 "No Heroism Without Fear" "npc thoughtbleeder" "npc amygdalan" 9
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Elgron" 10
|get 3 Dreamwalker's Amygdala
|/echo ${Task[No Heroism Without Fear].Objective[11].CurrentCount}
|/echo ${Task[No Heroism Without Fear].Objective[11].RequiredCount}
/call KillAndLoot "No Heroism Without Fear" "npc dreamwalker" 90850 11
/call Collect "No Heroism Without Fear" "red mushroom" 12
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Elgron" 13
/call GoToNPC "No Heroism Without Fear" "npc merc boldron" 14
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc merc boldron" 15
/call KillNPC "No Heroism Without Fear" "npc dracolich" 16
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc merc boldron" 17
/call SpeakToNPC "No Heroism Without Fear" "Hail" "npc Drolmer" 18
/beep
/return
Sub Collect(string tname,string what,int stinde)
:collect_loop
/while (${Cursor.ID}) {
/autoinv
/delay 1s !${Cursor.ID}
/delay 1s
}
/if (${Task[${tname}].Step.Index}==${stinde}) {
/itemtarget ${what}
/delay 2s ${Ground.ID}
/if (${Ground.DisplayName.Equal[*Red Mushroom]}) {
/nav item
/delay 2s ${Navigation.Active}==TRUE
/delay 60s ${Navigation.Active}==FALSE
/click left item
}
/delay 1s
/goto :collect_loop
} else {
/echo already did step ${stinde} ${Task[${tname}].Objective[${stinde}]}
}
/return
Sub KillNPC(string tname,string kmobfilter,int kstep)
:step_loop
/makemevisible
/delay 5s
/if (${Task[${tname}].Step.Index}==${kstep}) {
/varset myTargetID 0
/echo [${Time}] time to grab a ${kmobfilter}
/call FindMob "${kmobfilter}"
/if (${myTargetID}) {
/call GoToNPC "${tname}" "id ${myTargetID}" ${kstep}
/attack on
/delay 5s ${Me.XTarget}
/while (${Me.XTarget}) {
/delay 5
/if (!${Me.Combat} && ${Target.ID}) {
/attack on
}
/if (${Target.ID} && ${Target.State.Equal[FEIGN]}) {
/attack off
/squelch /target clear
/delay 1s !${Target.ID}
}
/if (${Target.ID} && ${Target.Type.Equal[Corpse]}) {
/squelch /target clear
/delay 1s !${Target.ID}
}
/if (!${Target.ID} && ${Me.XTarget}) {
/tar id ${Me.XTarget[1].ID}
/delay 5s ${Target.ID}==${Me.XTarget[1].ID}
}
}
}
/delay 5s
/goto :step_loop
} else {
/echo already did step ${kstep} ${Task[${tname}].Objective[${kstep}]}
}
/return
Sub KillNPC2(string tname,string kmobfilter1,string kmobfilter2,int kstep)
:step_loop
/if (${Task[${tname}].Step.Index}==${kstep}) {
/varset myTargetID 0
/echo [${Time}] time to grab ${kmobfilter1} and ${kmobfilter2}
/call FindMob "${kmobfilter1}" "${kmobfilter2}"
/if (${myTargetID}) {
/call GoToNPC "${tname}" "id ${myTargetID}" ${kstep}
/attack on
/delay 5s ${Me.XTarget}
/while (${Me.XTarget}) {
/delay 1
/if (!${Me.Combat} && ${Target.ID}) {
/attack on
}
/if (${Target.ID} && ${Target.State.Equal[FEIGN]}) {
/attack off
/squelch /target clear
/delay 1s !${Target.ID}
}
/if (${Target.ID} && ${Target.Type.Equal[Corpse]}) {
/squelch /target clear
/delay 1s !${Target.ID}
}
/if (!${Target.ID} && ${Me.XTarget}) {
/tar id ${Me.XTarget[1].ID}
/delay 1s ${Target.ID}==${Me.XTarget[1].ID}
}
}
}
/delay 1s
/goto :step_loop
} else {
/echo already did step ${kstep} ${Task[${tname}].Objective[${kstep}]}
}
/return
Sub SpeakToNPC(string thetask,string msg,string speakname,int stepidx)
/if (${Task[${thetask}].Step.Index}==${stepidx}) {
/call GoToNPC "${thetask}" "${speakname}" ${stepidx}
/makemevisible
/delay 5s
/if (${msg.Equal[Hail]}) {
/keypress HAIL
} else {
/say ${msg}
}
/delay 2s ${Task[${thetask}].Step.Index}!=${stepidx}
/delay 1s
} else {
/echo already did step ${stepidx} ${Task[${thetask}].Objective[${stepidx}]}
/return
}
/return
Sub KillAndLoot(string thtask,string mobfilter,int LootID,int steidx)
/declare i int local 1
:kill_loop
/if (${Task[${thtask}].Objective[${steidx}].CurrentCount} == ${Task[${thtask}].Objective[${steidx}].RequiredCount} ) {
/echo already did step ${steidx} ${Task[${thtask}].Objective[${steidx}]}
/return
}
/if (${AdvLoot.PCount}) {
/for i 1 to ${AdvLoot.PCount}
|/echo ${AdvLoot.PList[${i}].Name}
/if (${AdvLoot.PList[${i}].ID}==${LootID}) {
/beep
/echo we got a ${AdvLoot.PList[${i}].Name}!
/advloot personal ${i} loot
/delay 3s !${AdvLoot.LootInProgress}
/if (${Task[${thtask}].Objective[${steidx}].CurrentCount} == ${Task[${thtask}].Objective[${steidx}].RequiredCount} ) {
/return
}
}
/next i
}
/varset myTargetID 0
/call FindMob "${mobfilter}"
/if (${myTargetID}) {
/call GoToNPC "${thtask}" "id ${myTargetID}" ${steidx}
/attack on
/delay 5s ${Me.XTarget}
/while (${Me.XTarget}) {
/delay 1
/if (!${Me.Combat} && ${Target.ID}) {
/attack on
}
/if (${Target.ID} && ${Target.State.Equal[FEIGN]}) {
/attack off
/squelch /target clear
/delay 1s !${Target.ID}
}
/if (${Target.ID} && ${Target.Type.Equal[Corpse]}) {
/squelch /target clear
/delay 1s !${Target.ID}
}
/if (!${Target.ID} && ${Me.XTarget}) {
/tar id ${Me.XTarget[1].ID}
/delay 2s ${Target.ID}==${Me.XTarget[1].ID}
}
}
/if (${AdvLoot.PCount}) {
/for i 1 to ${AdvLoot.PCount}
/if (${AdvLoot.PList[${i}].ID}==${LootID}) {
/beep
/echo we got a ${AdvLoot.PList[${i}].Name}!
/advloot personal ${i} loot
/delay 3s !${AdvLoot.LootInProgress}
/if (${Task[${thtask}].Objective[${steidx}].CurrentCount} == ${Task[${thtask}].Objective[${steidx}].RequiredCount} ) {
/return
}
}
/next i
}
}
/goto :kill_loop
/return
Sub FindMob(string mobfiltera,string mobfilterb)
/declare mobfilter string local ${mobfiltera}
/declare MobsInRadius int local ${SpawnCount[${mobfilter}]}
/if (${MobsInRadius} == 0 && ${mobfilterb.Length} > 0) {
/varset mobfilter ${mobfilterb}
/varset MobsInRadius ${SpawnCount[${mobfilter}]}
}
/echo Found ${MobsInRadius} mobs I can choose from.
/declare MobCounter int local 0
/declare MobID int local 0
/declare PathLength float local 0
/declare MobIDDistance float local 0
/declare PathCount int local 1
/declare PathShortest int local 0
/declare MobIDValid int local 0
| Lets cut down on the time here a bit, we don't need to check more than 10 mobs in our vicinity, everything above that is just unreasonable
| and when people are in huge zones, it will take forever to parse through...
/if (${MobsInRadius} > 25) {
/varset MobsInRadius 25
}
/varset myTargetID 0
/if (${MobsInRadius} > 0) {
/for MobCounter 1 to ${MobsInRadius}
/varset MobID ${NearestSpawn[${MobCounter},${mobfilter}].ID}
/if (${Select[${Spawn[ID ${MobID}].Type},AURA,BANNER,CAMPFIRE,CORPSE,CHEST,ITEM,TRIGGER,TRAP,TIMER,MOUNT,MERCENARY,OBJECT]}) /continue
/varset PathLength ${Navigation.PathLength[id ${MobID}]}
/if (${PathLength} > 0) {
/if (${PathCount}==1) {
/varset myTargetID ${MobID}
/varset PathShortest ${PathLength}
} else /if (${PathLength} <= ${PathShortest}) {
/varset myTargetID ${MobID}
/varset PathShortest ${PathLength}
}
/varcalc PathCount ${PathCount}+1
}
/next MobCounter
/if (${myTargetID}) /message \agPulling \at${Spawn[${myTargetID}].Name}(${myTargetID}) \axat \ay${PathShortest} \axfeet.
} else {
}
/return
Sub CheckTask(string taskname,string npcfilter,string keyword)
| Ok First things first, do we actually have the task?
/if (${Task[${taskname}].ID} > 0) {
/echo we have the ${taskname} task
} else {
/call GoToNPC "${taskname}" "${npcfilter}" -1
/makemevisible
/delay 1s
/say ${keyword}
/delay 5s ${Window[TaskSelectWnd].Open}
/if (${Window[TaskSelectWnd].Open}) {
/notify TaskSelectWnd TSEL_AcceptButton leftmouseup
/delay 2s ${Task[${taskname}].ID} > 0
}
/if (${Task[${taskname}].ID} == 0) {
/beep
/echo sorry but I could not grab the task ${taskname}, ending macro.
/end
}
}
/return
Sub GoToNPC(string ttask,string filter,int stindex,bool dontcheckinvis)
/if (${Task[${ttask}].Step.Index}==${stindex} || ${stindex}==-1) {
/if (!${dontcheckinvis}) {
/echo im checking invis ${dontcheckinvis}
/call CheckInvis
} else {
/echo no reason to check invis
}
/nav id ${Spawn[${filter}].ID}
/delay 2s ${Navigation.Active}==TRUE
/delay 120s ${Navigation.Active}==FALSE
/target id ${Spawn[${filter}].ID}
/delay 1s ${Target.ID}==${Spawn[${filter}].ID}
} else {
/echo already did step ${stindex} ${Task[${ttask}].Objective[${stindex}]}
}
/return
Sub CheckInvis
/if (${invisspell.Equal[NULL]}) {
/return
}
/declare needinvis int local 0
:NEEDINVIS
/if (${Me.Invis}==TRUE) /return
/varset needinvis 0
|/if (${Me.Invis}==FALSE && ${Select[${Me.Class.ShortName},SHD,MAG,DRU]}) {
/if (${Me.Invis}==FALSE) {
/varset needinvis 1
}
/if (${needinvis}) {
/if (${Me.Casting.ID}==0) {
/if (${Me.AltAbilityReady[${invisspell}]}) {
/alt act ${Me.AltAbility[${invisspell}].ID}
|/echo whups im not AA invis, lets fix that
/delay 5
} else {
/if (${FindItem[Cloudy Potion].ID}) {
/useitem "Cloudy Potion"
/echo whups im not invis lets fix that
/delay 5
}
/if (${FindItem[Philter of Shadows].ID}) {
/useitem "Philter of Shadows"
/echo whups im not invis lets fix that
/delay 5
}
/if (!${FindItem[Cloudy Potion].ID} && !${FindItem[Philter of Shadows].ID}) {
/echo No Potions Continue without them
/return
/delay 5
}
}
/delay 1
}
} else {
/delay 1
}
/goto :NEEDINVIS
}
/return
[/CODE]