switchtarg.inc -- switches targets

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

BardsAreTooEasy
a lesser mummy
a lesser mummy
Posts: 39
Joined: Sun Feb 27, 2005 3:01 pm

switchtarg.inc -- switches targets

Post by BardsAreTooEasy » Tue Apr 12, 2005 10:00 pm

here's an include that will switch targets. i use it for a few reasons. at low levels i have one genbot powerleveling a tank. ill have the tank pull 3, and this will switch targets to make sure that he hits them all while they kill themselves on the DS. At higher levels i use this when my tank goes out and pulls. if he gets two i use this to switchtargets so that both mobs get snared. I've actually found lots of uses for this .inc, but those are the 2 main ones. I will put an example use at the bottom. In the example i have a druid genbot'd. I love genbot btw, beautiful work =)

Code: Select all


#turbo

Sub SwitchTarg

	|Defines
	
	/if (!${Defined[targ1]}) /declare targ1 string outer

	/if (!${Defined[targ2]}) /declare targ2 string outer
	
	/if (!${Defined[targ3]}) /declare targ3 string outer


	|Set variables to 3 nearest spawns
	
	/varset targ1 ${NearestSpawn[1, npc radius 250]}
	
	/varset targ2 ${NearestSpawn[2, npc radius 250]}
	
	/varset targ3 ${NearestSpawn[3, npc radius 250]}


	|Switch targets
	
	/if (${String[${Target}].Equal[${targ1}]}) {
		
		/tar ${targ2}
		
		/delay 2s
		
		/return
		
}
	
	/if (${String[${Target}].Equal[${targ2}]}) {
		
		/if (${String[${NearestSpawn[1, npc ${targ3} radius 50]}].NotEqual[NULL]}) /tar ${targ3}
		
		/if (${String[${NearestSpawn[1, npc ${targ3} radius 50]}].Equal[NULL]}) /tar ${targ1}
		
		/delay 2s
		
		/return
		
}

	/if (${String[${Target}].Equal[${targ3}]}) {
		
		/tar ${targ1}
		
		/delay 2s
		
		/return
		
}
		
/return

example of use. If i get 1 or 2 adds this code will make sure that they all get snared at 70% health. Add a /doevents SnareResist somewhere in your macro, like in your main loop.

Code: Select all


Sub snare

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
	|Reliably snares target with genbot
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

	/if (!${Defined[snarevar]}) /declare snarevar int outer 0
	
	/if (!${Defined[snaretimer]}) /declare snaretimer timer outer 0
	
	/if (!${Defined[switchtarg]}) /declare switchtarg int outer 0

	/if (!${Defined[yourgenbot]}) /declare yourgenbot string outer YOURBOTSNAME

	/if (${Target.PctHPs}<70 && ${snaretimer}==0 && ${snarevar}==0) {

		/t ${yourgenbot} sn ensnare

		/varset snaretimer 900

}

|Snare second/third target if needed. First switch targets after first is snared, then snare second one

	/if (${String[${NearestSpawn[2, npc radius 50]}].NotEqual[NULL]} && ${snarevar}==1 && ${switchtarg}==0) {
	
		/call SwitchTarg
		
		/varset switchtarg 1
		
		/varset snaretimer 0
		
}

	/if (${switchtarg}==1 && ${Target.PctHPs}<70 && ${snaretimer}==0 && ${snarevar}==1) {

		/t ${yourgenbot} sn ensnare

		/varset snaretimer 900

}

	/if (${String[${NearestSpawn[3, npc radius 50]}].NotEqual[NULL]} && ${snarevar}==2 && ${switchtarg}==1) {
	
		/call SwitchTarg
		
		/varset switchtarg 2
		
		/varset snaretimer 0
		
}

	/if (${switchtarg}==2 && ${Target.PctHPs}<70 && ${snaretimer}==0 && ${snarevar}==2) {

		/t ${yourgenbot} sn ensnare

		/varset snaretimer 900

}

/return



Sub Event_SnareResist

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
	|Set snarevar to 1 or 2 if mob is snared.  /varset snarevar 0
                |when the mob is dead.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

	/varcalc snarevar ${snarevar}+1

/return