Pet buffing

Have a macro idea but not sure where to start? Ask here.

Moderator: MacroQuest Developers

User avatar
Slice
a hill giant
a hill giant
Posts: 189
Joined: Wed Oct 30, 2002 2:52 pm

Pet buffing

Post by Slice » Wed Oct 20, 2004 2:50 pm

I'm looking to enhance the current enchanter macro with a routine on pet buffing. What I'm looking for in pseduo-code is:

:Petbuffs
Is NDT available, if so
Check if GroupMemberX has a pet
if so, buff it with NDT and Haste
Increment next groupmember

I've got the basics on checking when NDT is available, I'm just not exactly clear on how to scroll through the group and check for pets.
Slice

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Wed Oct 20, 2004 2:59 pm

Something like this should work..

Code: Select all

/declare Counter int local
| Loop from 0 (yourself, change to 1 if you don't want to check yourself) to the number of group members you have
/for Counter 0 to ${Group}
| If the group member spawn exists (might not be in zone) AND groupmember has a pet AND spell is ready
	/if (${Group[${Counter}].ID} && ${Group[${Counter}].Pet.ID} && ${Me.SpellReady[NDTwhatever]}) {
| Target the pet
		/target id ${Group[${Counter}].Pet.ID}
| Cast
		/cast or whatever ...
	}
/next counter

User avatar
Slice
a hill giant
a hill giant
Posts: 189
Joined: Wed Oct 30, 2002 2:52 pm

Post by Slice » Wed Oct 20, 2004 11:28 pm

That got me started and I've got one question that I know someone has a better way to do this then I've implimented here.

I've set it up so that every time a mob dies, it checks a different groupmember for a pet and casts the pet buffs. I didn't like the for loop because it would buff the first pet, zip through all the other group members and move on to getting ready for the next mob. It would never move past buffing the first persons pet.

My concern is that the way I'm doing it, is that if I have myself and 2 other people (counters 0, 1, and 2) in the group, when I increment the counter to 3, will it gracefully understand there's not a 4th member of the group and move on, or will it throw up an error and what's the better way to do what I'm trying to do. The new code is in the Checkbuffs sub.

Code: Select all

|start this with the tank name you want to assist as the arguement. |ex /macro enc tankname 
#turbo 
#Include SpellCast.inc 

#Event Damage "#*#hits you for#*#" 
#Chat #tell 

Sub Main 
/declare counter int outer 0 
  
:MainLoop 
  /assist ${Param0} 
  /delay 2s ${Target.ID} 

|Next line makes sure the assisted target is an NPC, has less than 95% but more then 10% hps, and is close. 
  /if (${Target.Type.Equal["NPC"]} && ${Target.PctHPs}<95 && ${Target.Distance}<100 && ${Target.PctHPs}>10) { 
    /face
    /call Tash
    /call Nuke 
    /call CheckBuffs 
  } 
/goto :MainLoop 

Sub Tash
  /echo Engaged 
  /call Tash 
  /call Pet
  /call Boggle 
/return 

Sub Tash 
  /call cast "Howl of Tashan" 
  /call Boggle 
/return 

Sub Pet
 /echo Sic 'em Shiny Bob!
 /pet attack
/return

Sub Boggle 
  /if (${Me.TargetOfTarget.ID} == ${Me.ID}) { 
    /echo Boggling 
    /call cast "Boggle" 
    /return 
  } 
/return 

Sub Nuke 
:nuke 

|First line makes sure the mob is still alive before we start casting and we |have 50+ mana. 
|will keep looping and nuking until mob is under 10% 

  /if (${Target.Type.Equal["NPC"]} && ${Me.PctMana}>50) { 
    /call Boggle 
    /if (${Me.SpellReady["Psychosis"]}) /call cast "Psychosis" nodismount 
    /doevents 
    /if (${Target.Type.Equal["NPC"]} && ${Target.PctHPs}>10) /goto :nuke 
  } 
/doevents 
/return 

Sub CheckBuffs 
  /echo Checking Buffs... 
  /doevents 
  /if (!${Me.Buff[Arcane Rune].ID}) /call cast "Ethereal Rune" 
  /if (!${Me.Buff[Clairvoyance].ID}) {
	/target
	/call cast "Clairvoyance" gem1
  }
  /if (!${Me.Buff[Shield of Maelin].ID}) /call cast "Mystic Shield" gem1
  /if (!${Me.Buff[Overwhelming Splendor].ID}) {
	/target
	/call cast "Overwhelming Splendor" gem1
  }
  /if (${Group[${counter}].ID} && ${Group[${counter}].Pet.ID} && ${Me.SpellReady[Night`s Dark Terror]}) { 
    /target id ${Group[${counter}].Pet.ID} 
    /call cast "Speed of Salik"
    /call cast "Night`s Dark Terror"
  } 
  /vardata counter math.calc[${counter}+1]
  /if (${counter}==6) /varset counter 0
/return 

sub Event_Damage 
  /call Boggle 
/return 

Sub Event_Chat(ChatType,Sender,ChatText) 
    /if (${ChatText.Find[speed]}) {
     /target ${Param0}
     /call cast "Speed of Salik" 
    }
    /if (${ChatText.Find[ndt]}) { 
     /target ${Param0} 
     /call cast "Night's Dark Terror" 
    }
    /if (${ChatText.Find[C6]})  { 
     /target ${Param0} 
     /call cast "Clairvoyance"
    }
/return 
Slice

zanomo
a hill giant
a hill giant
Posts: 285
Joined: Thu Jun 24, 2004 11:21 pm

Post by zanomo » Thu Oct 21, 2004 12:50 am

You will keep buffing yourself with ERune with your current check... :wink:

Code: Select all

  /if (!${Me.Buff[Arcane Rune].ID}) /call cast "Ethereal Rune" 

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 21, 2004 5:08 am

Slice wrote:I didn't like the for loop because it would buff the first pet, zip through all the other group members and move on to getting ready for the next mob. It would never move past buffing the first persons pet.
There's a typo in the code I posted which probably would make it only check one person. Happens when you type code directly into your post instead of actually trying it, that's why I say "Something like this should work.. " instead of "This works." :) ..

Anyway, look at the last line, the one with /next. Counter is spelled with a lower case c there and in all other places it's upper case.

User avatar
Slice
a hill giant
a hill giant
Posts: 189
Joined: Wed Oct 30, 2002 2:52 pm

Post by Slice » Thu Oct 21, 2004 3:27 pm

No problem, I caught that but think through the logic on how this executes.

If I were to use the For / Next loop in the CheckBuff event then the logic would flow like this:

Mob is targetted
Debuff Mob
Kill Mob
Check Buffs
NDT is up (2 Minute refresh)
Groupmember1 has a pet, so buff it with NDT
For the rest of the group, NDT is now down so it skips them.
Go back to the top and get ready for the next mob.

I'm trying cycle through each member of the group, every time it passes to the top of the macro. So for a full group, it will check any individuals pet buff every 6th mob.
Slice

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 21, 2004 4:23 pm

Ah yeah, I see your point. Guess I didn't think it through enough earlier hehe.. You'd need to set up a timer for each pet in order to accomplish that. Something like this:

Put this in Main or somewhere where it only gets executed once

Code: Select all

| Set up 6 timers
/declare Counter int local
/for Counter 0 to 5
	/declare PetBuffTimer${Counter} timer outer 0
/next Counter
Then in buffcheck:

Code: Select all

/declare Counter int local
| Loop from 0 (yourself, change to 1 if you don't want to check yourself) to the number of group members you have
/for Counter 0 to ${Group}
| If the group member spawn exists (might not be in zone) AND groupmember has a pet AND timer has run out AND spell is ready
   /if (${Group[${Counter}].ID} && ${Group[${Counter}].Pet.ID} && !${PetBuffTimer${Counter} && ${Me.SpellReady[NDTwhatever]}) {
| Target the pet
      /target id ${Group[${Counter}].Pet.ID}
| Cast
      /cast or whatever ...
| Set the timer for this pet. Replace 6000 with the duration of the buff in 10ths of a second
| You should do a check that the cast was successful before setting it
			/varset PetBuffTimer${Counter} 6000
   }
/next Counter