Basic pet attack nearest npc macro

Joined
Jan 14, 2010
Messages
127
Reaction score
1
Points
16
Age
37
Looking for a macro that targets the nearest npc and does a /pet attack with like a 5-10 second timer between loops. Not sure where to look for macro basics on doing something like this.

I would even be fine with a macro that hits letter x then 2 (my target nearest npc followed by pet attack hotkey) every 5-10 seconds.
 
  • Like
Reactions: EQDAB
Here is a basic macro that should do what you asked.

If your character doesn't have a target, it will target the nearest npc, and make pet attack. It will wait 10 seconds before checking if you have a target again.

Code:
Sub Main
:top
/if !${Target.ID} { 
	/target npc
	/delay 1s
	/pet attack
	}
/delay 10s
/goto :top

Just copy the code into notepad, save it as something like "petattack.mac" in your macro folder, then "/macro petattack" ingame.
 
  • Like
Reactions: daxxtrias and EQDAB
This is the one i wrote.


Code:
:Loop
    /call GMCheck
    /hidec all
    /target npc
    
    /if (${Range.Between[1,355:${Target.Distance}]})     {
                                                        /delay 1s
                                                        /pet attack
    } else {
            /target clear
            /echo no tragets in range
            }
    /delay 2s
    /goto :Loop
                                                                                                                                                                                        
/return

| -------------------------------------------------------------------------------------
| SUB : Check for GM's
| -------------------------------------------------------------------------------------

Sub GMCheck
/if (${Spawn[gm].ID}) {
  /beep
  /beep
  /echo GM entered the zone!
  /echo For safety reasons the macro is ending...
  /endmacro
}
/return
 
  • Like
Reactions: daxxtrias and EQDAB
I used several variations of these type macros and decided to take it a step further and made this:

Code:
|Usage: /mac Petkill <radius> <Main Target> <Main Target PH> <Secondary Target> <Secondary Target PH>
|ex: /mac Petkill 150 Kindle goblin Synge a_
|-this will watch 150 foot radius and attack any NPCs with the following things in their names: Kindle, goblin, Singy, a_
|-beware with "a_" as Sara Conner would be a valid target and get attacked and, as a terminator and former teenage girl, she'll mess you up.
|-If you only wanted to kill bats and skeletons, you could use /macro petkill 150 bat skeleton bat bat (the 2nd and 3rd mention of the name doesn't add anything therefore pointless)
|-if you wanted to kill everything in the 150 radius, /mac petkill 150 npc npc npc npc (see next line)
|-this is still a little WIP - haven't added a check for the length of the variable to verify it's > 2.  With the length check, it's possible use /mac petkill 150 THISMOBONLY and it'll wait for that mob to appear instead of having to type the current /mac petkill 150 THISMOBONLY THISMOBONLY THISMOBONLY THISMOBONLY

Sub Main (int PetKillRange, string NamedToFind1, string PHToFind1, string NamedToFind2, string PHToFind2)
   /echo Killing ${NamedToFind1}/${PHToFind1} - ${NamedToFind2}/${PHToFind2} in ${PetKillRange} feet

   :Loop
   /if (${SpawnCount[NPC ${NamedToFind1} radius ${PetKillRange}]}>0 && !${Pet.Target.ID}) {
       /pet kill ${NearestSpawn[NPC ${NamedToFind1} radius ${PetKillRange}].CleanName}
       /delay 5
   }
   /if (${SpawnCount[NPC ${PHToFind1} radius ${PetKillRange}]}>0 && !${Pet.Target.ID}) {
       /pet kill ${NearestSpawn[NPC ${PHToFind1} radius ${PetKillRange}].CleanName}
       /delay 5
   }
   /if (${SpawnCount[NPC ${NamedToFind2} radius ${PetKillRange}]}>0 && !${Pet.Target.ID}) {
       /pet kill ${NearestSpawn[NPC ${NamedToFind2} radius ${PetKillRange}].CleanName}
       /delay 5
   }
   /if (${SpawnCount[NPC ${PHToFind2} radius ${PetKillRange}]}>0 && !${Pet.Target.ID}) {
       /pet kill ${NearestSpawn[NPC ${PHToFind2} radius ${PetKillRange}].CleanName}
       /delay 5
   }
/goto :Loop

/return
 
  • Like
Reactions: daxxtrias and EQDAB
CWTN has an awesome mage plugin

seems like yours is a little refined, and just kill's thing, maybe you can add it giving pet weapons out, and possible mage gear.

I am not a programmer and don't know how, but this is just a suggestion.
Keep up the GREAT WORK