Pacify.inc

Chuckles

Random lurker
Joined
Jul 13, 2006
Messages
180
Reaction score
0
Points
16
Cross-posting from mothership since I know a lot of people don't go there.

A couple weeks ago I was searching for a relatively recent Pacify routine and couldn't find one that worked for me. Since I am in between jobs and have a lot of free time right now, I figured I'd teach myself macro writing and contribute a bit. Here is the .INC I wrote (with this post as a starting point, and a lot of searching around).

I wrote it for my B team Paladin (undergeared, low AA) to pull in Dead Hills HA's, since even with a bard they were wiping too frequently to multi-pulls, and I run that team in the background while I play the A team, so they don't get much attention. It's probably not useful for most, but maybe it will help someone out.

Yes, I'm a little comment and debug statement happy.

Code:
|Pacify.inc  V.1.3.5
|By Chuckles www.macroquest.com.  Hat tip to Zonomo@MQ2 for starting point.
|
|Insert /call PacifyInit wherever you have your startup sub in your Mac
|
|Insert /call Pacify into your pull routine
|
|Assumes you're using Alert list 1 for mobs you want to ignore
|Assumes ${XTarget[1]} is set to autohater to determine if you/your group has aggro
|
|Pacify Sub will set PacReturn to one of the following values on completion:
|
|PACIFY_SUCCESS - Only one mob in AggroDist or all mobs pacified
|PACIFY_NOTARGET - You don't have a mob on target to use as a starting point
|PACIFY_TOOMANY - Number of mobs in AggroDist exceeds MaxMob (there are more mobs than you can safely pacify)
|PACIFY_AGGRO - Looks like someone in your party has aggro (assumes ${XTarget[1]} is set to autohater and targets that spawn}
|
|If you don't use the ${PacReturn} value your pull sub will continue on its merry way regardless of what actually happened
|
|Only tested with a 101-105 paladin as puller.  I don't know why it wouldn't work with another class, but I created this to help my "B" team stop wiping so much.
|
|TODO:
|
|Add a timer to the casting portion to ensure everything is done in 30s or so to avoid pacify wear off 
|Create INI file to save settings
|Test with other classes (Cleric/Chanter/Etc)
|
|Changelog
|V1.3.4 Fixed a bug with setting PACIFY_AGGRO
|V1.3.5 Added a check to not attempt to pacify mobs out of range of the Pacify spell.  Level limit set via new variable PacMaxLevel.
|--------------------------------------------------------------------------------
|SUB: PacifyInit - Load Declares
|--------------------------------------------------------------------------------

Sub PacifyInit
/declare MobArray[150] 				int 		outer
/declare PacCount					int			outer	0
/declare PacArray[150]				int			outer
/declare PacK 						int 		outer
/declare PacM 						int 		outer
/declare PacN 						int 		outer
/declare PacP 						int 		outer
/declare NumMobs 					int 		outer 	0
/declare MobRadius 					int 		outer 	240
/declare AggroDist					int			outer 	70
/declare DebugPac					int			outer 	0
/declare PullID						int			outer
/declare DistX1						float		outer
/declare DistY1						float		outer
/declare DistX2						float		outer
/declare DistY2						float   	outer
/declare MaxMob	    				int			outer	15
/declare Pacify						string		outer	Dulcify
/declare PacifyGem					int			outer	1
/declare PacReturn					string		outer
/declare TempMob					int			outer
/declare PacTimer					timer		outer	0
/declare PacMaxLevel				int			outer	105

/return

|--------------------------------------------------------------------------------
|SUB: Pacify - Pacify Routine)
|--------------------------------------------------------------------------------

Sub Pacify

|Clear the array variables
	/varset PacCount 0
	/varset NumMobs 0
|Check if there is a mob targeted.  If not, return to pulling
	/if (${DebugPac}) /bc Starting Pacify routine
	/if (!${Target.ID}) {
	/varset PacReturn PACIFY_NOTARGET
	/if (${DebugPac}) /bc ${PacReturn}
	/return
	} else {
|Set the current target to ${PullID} so we can go back and pull it later
    /varset PullID ${Target.ID}
    /if (${DebugPac}) /bc ${PullID}
    /if (${DebugPac}) /bc Distance to ${Target.CleanName} is ${Target.Distance}
|Set the location X and Y for the target
    /varset DistX1 ${Spawn[${PullID}].X}
    /varset DistY1 ${Spawn[${PullID}].Y}
	}
|Check the current number of mobs in aggro radius.  If there is only one declare success and go back to pulling	
	/if (${SpawnCount[NPC radius ${MobRadius} zradius 20 noalert 1]}==1) { 
		/varset PacReturn PACIFY_SUCCESS
		/if (${DebugPac}) /bc ${PacReturn}
		/return
	}
|Build the Mobcount array.  Technically we don't really need an array here, but it's useful for debugging
  /for PacK 1 to ${SpawnCount[NPC radius ${MobRadius} zradius 20 noalert 1]}
     /varcalc NumMobs ${NumMobs}+1
	 /varset MobArray[${NumMobs}] ${NearestSpawn[${PacK},NPC radius ${MobRadius} zradius 20 noalert 1].ID}
	 /varset TempMob ${MobArray[${NumMobs}]}
|Check if the current spawn is named, and if it is restart the routine
	 	/if (${Spawn[${TempMob}].Named} && ${TempMob}!=${PullID}) {
		/popup Named
		/if (${DebugPac}) /bc [+r+] NAMED - Restarting Pacify Array [+r+]
		/tar id ${TempMob}
		/call Pacify
			}
	 /if (${DebugPac}) /bc Added [+y+] ${Spawn[${TempMob}]} to the MobCount Array [+y+]
|Check if the current spawn is in combat, dead, or the original pull target.  If so, don't add it to the Pacify array
	 /if (${TempMob}==${PullID} || ${Spawn[${TempMob}].PctHPs}<99 || ${Spawn[${TempMob}].Type.Equal[Corpse]} || ${Spawn[${TempMob}].Level}>${PacMaxLevel}) {
		/if (${DebugPac}) /bc We will not pacify Spawn ID ${TempMob} which is ${Spawn[${TempMob}].CleanName}
		/next PacK
		} else {
|Check the distance from the mob you're checking to the pull target
			/varset DistX2 ${Spawn[${TempMob}].X}
			/varset DistY2 ${Spawn[${TempMob}].Y}
			/if (${DebugPac}) /bc Mob ${TempMob} Distance is: ${Math.Distance[${DistY1},${DistX1}:${DistY2},${DistX2}]}
			/if (${Math.Distance[${DistY1},${DistX1}:${DistY2},${DistX2}]} < ${AggroDist}) {
|If it's less than your defined aggro radius add it to the pacify array
				/varcalc PacCount ${PacCount}+1
				/varset PacArray[${PacCount}] ${TempMob}
			}
		}	  	  	  
  /next PacK
|Debug statements that are otherwise useless
	/if (${DebugPac}) /bc Added ${NumMobs} mobs to the MobCount array
	/if (${DebugPac}) { 
		/for PacM 1 to ${NumMobs}
  		/bc Added Spawn ID ${MobArray[${PacM}]} which is ${Spawn[${MobArray[${PacM}]}].CleanName} to the MobCount Array
  		/next PacM
		}
	/if (${DebugPac}) /bc Added ${PacCount} mobs to the pacify array
	/if (${DebugPac}) {
		/if (${PacCount}>0) {  
			/for PacN 1 to ${PacCount}
  			/bc Added Spawn ID ${PacArray[${PacN}]} which is ${Spawn[${PacArray[${PacN}]}].CleanName} to the Pacify Array
  			/next PacN
			}
		}
|End useless debug statements
|Begin Pacify Routine
	/if (${String[${Me.Gem[${PacifyGem}]}].NotEqual[${Pacify}]}) /memspell 1 "${Pacify}" 
	/if (${PacCount}>${MaxMob}) { 
	    /popup Too many mobs!
	    /varset PacReturn PACIFY_TOOMANY
	    /if (${DebugPac}) /bc ${PacReturn}
	    /return
    	}
    /if (${PacCount}==0) { 
	    /popup No mobs to Pacify; pulling!
	    /varset PacReturn PACIFY_SUCCESS
	    /if (${DebugPac}) /bc ${PacReturn}
	    /return
    	}
	:restart
	/varset PacTimer 30s
	/for PacP 1 to ${PacCount}
	/if (${Me.XTarget}) {
		/varset PullID ${Me.XTarget[1]}
		/tar id ${PullID}
		/varset PacReturn PACIFY_AGGRO
		/return
		} else {
			/tar id ${PacArray[${PacP}]}
				:castloop
				/if (${Me.SpellReady[${PacifyGem}]}) {
				/call cast ${Pacify}
				/if (${DebugPac}) /bc Casting ${Pacify} on ${Spawn[${PacArray[${PacP}]}].CleanName}
					} else {
					/delay 1s
					/goto :castloop
					}
		/if (${DebugPac}) /bc ${castReturn}
		/if (${DebugPac} && ${Macro.Return.NotEqual[CAST_SUCCESS]}) /bc Resist or Spell Fail restarting Pacify loop
		/if (${Macro.Return.NotEqual[CAST_SUCCESS]}) /goto :restart
		/if (${DebugPac}) /bc ${PacTimer}
		/doevents
	/next PacP
	}
/tar id ${PullID}
/varset PacReturn PACIFY_SUCCESS
/delay 4s
/if (${DebugPac}) /bc ${PacReturn}
/return
 
Last edited:
very nice and it can always be useful, im not that good at integrating new incs but ill try to do this, ive always wanted to do my own version of inc have had some ideas
 
Updated with a couple bug fixes and a level check for the pacify spell.