Radial Pet Attack

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

lestor
orc pawn
orc pawn
Posts: 16
Joined: Sat Jan 10, 2004 6:31 am

Radial Pet Attack

Post by lestor » Fri Jan 30, 2004 9:37 pm

This will tell your pet to attack every mob within a radius around your character. It will run in the background queing up mobs for the pet to attack. But it won't spam you with pet attack messages. Each time it tells the pet to attack a mob it adds it into the database, and it won't target or tell the pet to attack that mob again.

However, when the database starts to get very large it tends to slow down your computer... [If anyone knows a way to remedy this, I'd appreciate the tip. :)] so, the database is flushed when it reaches a certain number of entries. (Be sure to specify that in the macro text.)

When you wish to end the macro, you will need to /end.

Enjoy,

Lestor

Code: Select all

| - Radial pet attack macro by Lestor
| - Syntax: /macro petattack [radius]

#turbo 

| Change this number to specify the maximum number of mobs to que up.
#define QEUCOUNT 20

Sub Main
	/declare count1 global
	/declare count2 global
	
	/call FlushDB

	/declare targetID global
	/declare range global
	
	/varset range @Param0
	/echo Radius set to @range

	/if $defined(Param0)==FALSE {
		/echo Usage /macro petattack [range]
		/echo Default range is 200.
		/varset range 200
		}

	/varset count2 0
	/varset targetID $char(id)

	:Loop
		/doevents
		/if n @count2>QEUCOUNT /call FlushDB
		/call AttackTarget
		/doevents
		/delay 1
		/varset targetID $char(id)
		/goto :Loop
/return

sub AttackTarget
	:Loop
		/doevents
		/if n $spawn($searchspawn(npc,id:@targetID,next),distance)>@range /return
		/call CheckTargetID $searchspawn(npc,id:@targetID,next)
		/varset targetID $searchspawn(npc,id:@targetID,next)
		/if $return==EXSISTS /goto :Loop
	/delay 1

	/target id @targetID
	/echo Attacking '$target(name)'...
	/pet attack
/return

Sub FlushDB
	/zapvars novars notimers
	/varset count1 0
	/varset count2 0
	/echo Flushing database...
	/declare targetDB array
	/delay 10
/return

Sub CheckTargetID(id)
	/varset count1 0
	:Loop
		/if n @targetDB(@count1)==$searchspawn(npc,id:@targetID,next) /return EXSISTS
		/if @targetDB(@count1)==UNDEFINED-ARRAY-ELEMENT {
			/call AddTargetID @id
			/varadd count2 1
			/return ADDED
			}
		/varadd count1 1
		/goto :Loop
/return
	
Sub AddTargetID(id)
	/varset targetDB(@count1) @id
/return

funkeymonk
decaying skeleton
decaying skeleton
Posts: 6
Joined: Tue Jan 27, 2004 11:51 pm

Post by funkeymonk » Sun Feb 01, 2004 3:05 pm

You could impliment a simple counter and when it reaches a certain number stop sending targets to the pet until the pet kills them down
I put the FUNK in MoNK

Funkey Monk

funkeymonk
decaying skeleton
decaying skeleton
Posts: 6
Joined: Tue Jan 27, 2004 11:51 pm

Post by funkeymonk » Sun Feb 01, 2004 4:08 pm

You could impliment a simple counter and when it reaches a certain number stop sending targets to the pet until the pet kills most of the monsters on the list.
:D
I put the FUNK in MoNK

Funkey Monk