Help with a shaman macro

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Braegan
decaying skeleton
decaying skeleton
Posts: 9
Joined: Sat Jan 03, 2004 4:13 am

Help with a shaman macro

Post by Braegan » Sat Jan 17, 2004 1:18 pm

This is a quick macro i put togethor for my shaman to kill a static spawn npc. I'm having a little bit of problem though with the healloop and the rebuffing. After killing the npc it seems to go into a loop where it will heal myself or my pet over and over again repeating infinitely. Also i'd like to place a sit command to med between spawns but am having trouble with that. Currently it is just set to rebuff the pet, but the rebuffing never actually happens. Any and all help would be appreciated.

Code: Select all

| - Macro for Shaman

#Event AlacOff "Your pet's Alacrity spell has worn off."
#Event AlacOn "feels much faster."
#Event HarnessOff "Your pet's Harnessing of Spirit spell has worn off."
#Event HarnessOn "looks tougher"
#Event RMOff "Your pet's Resist Magic spell has worn off."
#Event RMOn "is resistant to Magic"
#Event StamOff "Your pet's Stamina spell has worn off."
#Event StamOn "looks robust"

/declare CastAlacrity global
/declare CastHarness global
/declare CastResist global
/declare CastStamina global

/varset CastAlacrity 0
/varset CastHarness 0
/varset CastResist 0
/varset CastStamina 0


Sub Main
/echo Lisvan Killer v2.0 Online -- Fish 0WNZ J00!
/alert clear 0
/alert add 0 NPC radius 100 "Lisvan"
:Mainloop
/tar myself
/if $alert(0)==TRUE {
	/tar npc radius 100 Lisvan
	/if $target(type)==NPC /call Combat
	}
/doevents
/call CastBuffs
/goto :Mainloop
/return


Sub Combat
/if $char(state)=="SIT" /stand
/pet attack
/delay 6s
:Tog
/cast "Togor's Insects"
/if $char(casting)=="FALSE" /goto :Tog
/delay 7s
:Envenom
/cast "Envenomed Bolt"
/if $char(casting)=="FALSE" /goto :Envenom
/delay 8s
:Shock
/cast "Shock of Venom"
/if $char(casting)=="FALSE" /goto :Shock
/delay 5s
:petcombat
/if $target(type)==NPC /call healchecks
/return

sub healchecks
:healloop
/if $char(hp,pct)<50 {
	/target myself
	/cast "Greater Healing"
	/delay 4s
	}
/tar pet
/if $target(hp,pct)<50 {
	/cast "Greater Healing"
	/delay 4s
	}
/tar npc Lisvan radius 100
/if $target(type)==NPC /goto :healloop
/if $char(state)=="STAND" /sit
/return



Sub CastBuffs
/if @CastAlacrity==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Alacrity"
	/delay 5s
	}

/if @CastHarness==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Harnessing of Spirit"
	/delay 11s
	}
/if @CastResist==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Resist Magic"
	/delay 6s
	}
/if @CastStamina==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Stamina"
	/delay 6s}

/if $char(state)==STAND /sit
/return
	
	
	
Sub Event_AlacOff
	/varset CastAlacrity 1
	/return

Sub Event_AlacOn
	/varset CastAlacrity 0
	/return

Sub Event_HarnessOff
	/varset CastHarness 1
	/return

Sub Event_HarnessOn
	/varset CastHarness 0
	/return

Sub Event_RMOff
	/varset CastResist 1
	/return

Sub Event_RMOn
	/varset CastResist 0
	/return

Sub Event_StaminaOff
	/varset CastStamina 1
	/return

Sub Event_StaminaOn
	/varset CastStamina 0
	/return
Last edited by Braegan on Sat Jan 17, 2004 2:58 pm, edited 1 time in total.

YKW-28983
a hill giant
a hill giant
Posts: 252
Joined: Sun Dec 01, 2002 11:37 pm

Post by YKW-28983 » Sat Jan 17, 2004 1:34 pm

repost your code in

Code: Select all

"&#91;code&#93;" "&#91;/code&#93;"
brackets and then i'll take a look at it.

Braegan
decaying skeleton
decaying skeleton
Posts: 9
Joined: Sat Jan 03, 2004 4:13 am

Post by Braegan » Sat Jan 17, 2004 3:58 pm

k reposted it. Any help would be appreciated.

YKW-28983
a hill giant
a hill giant
Posts: 252
Joined: Sun Dec 01, 2002 11:37 pm

Post by YKW-28983 » Sat Jan 17, 2004 5:13 pm

First things first

Code: Select all

/declare CastAlacrity global 
/declare CastHarness global 
/declare CastResist global 
/declare CastStamina global 

/varset CastAlacrity 0 
/varset CastHarness 0 
/varset CastResist 0 
/varset CastStamina 0 
put this in a sub. they are not like #define. These are MQ commands.

put them in your main sub above

Code: Select all

 
/echo Lisvan Killer v2.0 Online -- Fish 0WNZ J00! 
/alert clear 0 
/alert add 0 NPC radius 100 "Lisvan" 
:Mainloop 

On all of the if statements where your comparing one thing to a number add an n after /if.

Code: Select all

sub healchecks 
:healloop 
/if $char(hp,pct)<50 { 
   /target myself 
   /cast "Greater Healing" 
   /delay 4s 
   } 
/tar pet 
/if $target(hp,pct)<50 { 
   /cast "Greater Healing" 
   /delay 4s 
   } 
/tar npc Lisvan radius 100 
/if $target(type)==NPC /goto :healloop 
/if $char(state)=="STAND" /sit 
/return 

should be

Code: Select all

sub healchecks 
:healloop 
/if n $char(hp,pct)<50 { 
   /target myself 
   /cast "Greater Healing" 
   /delay 4s 
   } 
/tar pet 
/if n $target(hp,pct)<50 { 
   /cast "Greater Healing" 
   /delay 4s 
   } 
/tar npc Lisvan radius 100 
/if $target(type)==NPC /goto :healloop 
/if $char(state)=="STAND" /sit 
/return 
make the same changes to your buff check sub.

Braegan
decaying skeleton
decaying skeleton
Posts: 9
Joined: Sat Jan 03, 2004 4:13 am

Post by Braegan » Sun Jan 18, 2004 2:50 am

Okay i made those changes and now it no longer goes into an infinite loop. Sometimes when the mob dies though the character does not sit down, i think because he is targeting pet. any ideas on how to fix that? Also when pets buff wears off it cast the buff and then macro ended and it said it could not find :healloop. Once again i'm trying to muddle through this and any help is appreciated.

Code: Select all

| - Macro for Shaman

#Event AlacOff "Your pet's Alacrity spell has worn off."
#Event AlacOn "feels much faster."
#Event HarnessOff "Your pet's Harnessing of Spirit spell has worn off."
#Event HarnessOn "looks tougher"
#Event RMOff "Your pet's Resist Magic spell has worn off."
#Event RMOn "is resistant to Magic"
#Event StamOff "Your pet's Stamina spell has worn off."
#Event StamOn "looks robust"

Sub Main
/declare CastAlacrity global
/declare CastHarness global
/declare CastResist global
/declare CastStamina global

/varset CastAlacrity 0
/varset CastHarness 0
/varset CastResist 0
/varset CastStamina 0

/echo Lisvan Killer v2.0 Online -- Fish 0WNZ J00!
/alert clear 0
/alert add 0 NPC radius 100 "Lisvan"
:Mainloop
/tar myself
/if $alert(0)==TRUE {
	/tar npc radius 100 Lisvan
	/if $target(type)==NPC /call Combat
	}
/doevents
/call CastBuffs
/goto :Mainloop
/return


Sub Combat
/if $char(state)=="SIT" /stand
/pet attack
/delay 6s
:Tog
/cast "Togor's Insects"
/if $char(casting)=="FALSE" /goto :Tog
/delay 7s
:Envenom
/cast "Envenomed Bolt"
/if $char(casting)=="FALSE" /goto :Envenom
/delay 8s
:Shock
/cast "Blizzard Blast"
/if $char(casting)=="FALSE" /goto :Shock
/delay 5s
:petcombat
/if $target(type)==NPC /call healchecks
/return

sub healchecks
:healloop
/if n $char(hp,pct)<50 {
	/target myself
	/cast "Greater Healing"
	/delay 4s
	}
/tar pet
/if n $target(hp,pct)<50 {
	/cast "Greater Healing"
	/delay 4s
	}
/tar npc Lisvan radius 100
/if $target(type)==NPC /goto :healloop
/if $char(state)=="STAND" /sit
/return



Sub CastBuffs
/if n @CastAlacrity==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Alacrity"
	/delay 5s
	/goto :healloop
        }

/if n @CastHarness==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Harnessing of Spirit"
	/delay 11s
        /goto :healloop
	}
/if n @CastResist==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Resist Magic"   
	/delay 6s
        /goto :healloop
	}
/if n @CastStamina==1 {
	/tar pet
	/if $char(state)==SIT /stand
	/cast "Stamina"
	/delay 6s
        /goto :healloop
        }

/return
	
	
	
Sub Event_AlacOff
	/varset CastAlacrity 1
	/return

Sub Event_AlacOn
	/varset CastAlacrity 0
	/return

Sub Event_HarnessOff
	/varset CastHarness 1
	/return

Sub Event_HarnessOn
	/varset CastHarness 0
	/return

Sub Event_RMOff
	/varset CastResist 1
	/return

Sub Event_RMOn
	/varset CastResist 0
	/return

Sub Event_StaminaOff
	/varset CastStamina 1
	/return

Sub Event_StaminaOn
	/varset CastStamina 0
	/return

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Post by Troy_swe » Thu Apr 15, 2004 6:16 pm

Fun macro indeed, tryde it out and getting the same errors as you did Braegan. Did some searching but my guess I need to learn more of the basics before I can get it to work myself, could anyone skilled maybe take a peak it would be a blast. =)

Thanks in advance,

/troy

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Thu Apr 15, 2004 7:20 pm

Might be a moot point but why are you /goto calling a loop outside the sub you are working in? wouldn't /call healchecks make more sense?

Code: Select all

sub healchecks 
:healloop 
/if n $char(hp,pct)<50 { 
   /target myself 
   /cast "Greater Healing" 
   /delay 4s 
   } 
/tar pet 
/if n $target(hp,pct)<50 { 
   /cast "Greater Healing" 
   /delay 4s 
   } 
/tar npc Lisvan radius 100 
/if $target(type)==NPC /goto :healloop 
/if $char(state)=="STAND" /sit 
/return 



Sub CastBuffs 
/if n @CastAlacrity==1 { 
   /tar pet 
   /if $char(state)==SIT /stand 
   /cast "Alacrity" 
   /delay 5s 
   [color=red]/goto :healloop [/color]
        } 

/if n @CastHarness==1 { 
   /tar pet 
   /if $char(state)==SIT /stand 
   /cast "Harnessing of Spirit" 
   /delay 11s 
        [color=red]/goto :healloop [/color]
   } 
/if n @CastResist==1 { 
   /tar pet 
   /if $char(state)==SIT /stand 
   /cast "Resist Magic"    
   /delay 6s 
        [color=red]/goto :healloop [/color]
   } 
/if n @CastStamina==1 { 
   /tar pet 
   /if $char(state)==SIT /stand 
   /cast "Stamina" 
   /delay 6s 
       [color=red] /goto :healloop [/color]
        } 

/return 

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Post by Troy_swe » Thu Apr 15, 2004 7:57 pm

-edit :double post
Last edited by Troy_swe on Thu Apr 15, 2004 8:03 pm, edited 1 time in total.

Troy_swe
orc pawn
orc pawn
Posts: 12
Joined: Fri Apr 09, 2004 11:36 am

Post by Troy_swe » Thu Apr 15, 2004 7:57 pm

Changed that to /call healchecks and it helped so it dosent end the macro now when buffing, However it tryes to target the npc and even if hes not there it dosent stop trying to.

Code: Select all

/tar npc Lisvan radius 100 
/if $target(type)==NPC /goto :healloop 
/if $char(state)=="STAND" /sit 
/return 
is the problem here?

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Fri Apr 16, 2004 4:27 am

This is just a long shot cause i'm tired and don't have the focus to step through the winding path of your code but here is a theory for you to look at:

Sub CastBuffs targets your pet, then calls HealCheck. HealCheck loops forever IF the target is an NPC. If the named target is NOT there, then your current target DOESN'T change, it stays your pet. I think a pet is classed as an NPC.