All pastes #391004 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-11 20:49 UTC
rendered paste body
member BestRezSpot()
{
variable int incaj
variable int aggrorange
variable int RezDistance = 0
variable int numpoints
variable unit closestMob
variable int closestMobDistance
variable point3f specialSpot
variable index:lnavregionref SafePoints

closestMob = Unit[-nearest 1,-hostile,-lineofsight,-alive,-notflying,-range 0-50,-origin,${Me.corpse.X},${Me.corpse.Y},${Me.corpse.Z}]
if ${Distance[${closestMob.Location},${Me.Corpse.Location}]}>30
{
	This.Echo["Rezzing at corpse location"]
	return ${Me.corpse.Location}
}
Else
{
	numpoints:Set[${This.CurrentZone.DescendantsWithin[SafePoints,39,${Me.corpse.X},${Me.corpse.Y},${Me.corpse.Z}]}]
	if ${numpoints}
	{
		incaj:Set[1]
		do
		{
			closestMob = Unit[-nearest 1,-hostile,-lineofsight,-alive,-notflying,-range 0-50,-origin,${SafePoints[${incaj}].x},${SafePoints[${incaj}].y},${SafePoints[${incaj}].z}]
			aggrorange:Set[${20+${Object[${MobsList[${incaj}]}].Level}-${Me.Level}}
			if aggrorange>45
				aggrorange:Set[45]
			elseif aggrorange<5
				aggrorange:Set[5]
			closestMobDistance:Set[${Distance[${closestMob.Location},${SafePoints[${incaj}]}]}-${aggrorange}]
			if ${closestMobDistance} > ${RezDistance}
			{
				RezDistance:Set[${closestMobDistance}]
				specialSpot:Set[${SafePoints[${incaj}]}]
			}
		}
		while ${incaj:Inc} <= numpoints
		if !${RezDistance}
		{
			This.Echo["No safe spot to rezz!"]
			return
		
		}
		This.Echo["Safe spot found at ${specialSpot}, ${RezDistance} yards out of aggro range"]
	return ${specialSpot}
	}
	This.Echo["WTF? How'd I die here??"]
	return
}
}