• IS THIS SITE UGLY? Click "RG3" at the very bottom-left of this page to change it. To dismiss this notice, click the X --->
Resource icon

Utility MQ2SpawnSort 0.2

Download now: Join us with Level 2 access
or earn your way in with RedCents.
Included in Very Vanilla
Very Vanilla Included! No need to download.
Server Type
Live, Emu, TLP, Test Server
Plugin to add a TLO similar to NearestSpawn, but lets you sort by (almost) anything. Syntax is:

Rich (BB code):
${SpawnSort[<n>,<asc|desc>,<member>,<spawn search string>]}
It returns the nth spawn that matches your spawn search string, sorting in ascending or descending order by whatever member you like (Level, PctHPs, etc). The member to sort by can be anything on a spawn type, so if you can do ${Spawn[something].<member>}, it'll work. A notable exception is "sub-members", like Class.ShortName. If there's a period in there, it won't work :(.

Some random examples:

The lowest level player within 100 yards:

Rich (BB code):
${SpawnSort[1,asc,Level,pc radius 100]}
The 2nd highest level npc in the zone:

Rich (BB code):
${SpawnSort[2,desc,Level,npc]}
Lowest HP group member:

Rich (BB code):
${SpawnSort[1,asc,PctHPs,group]}
It handles a a special case for MQ2Nav as well, you can do:

Rich (BB code):
/varset closestNPCID ${SpawnSort[1,asc,PathLength,npc radius 1000].ID}
Which will give you the closest NPC within 1000 yards, but using MQ2Nav path length instead of just straight line distance. PathExists works too, in case you just want to find the first spawn you can navigate to but don't care about distance.

The returned type is spawn, so if ${Spawn[].Whatever} works, so will ${SpawnSort[].Whatever}.

If the spawn search string restricts it to NPCs on your xtarget (i.e. includes xtarhater), you can sort by xtarget members, e.g. PctAggro, and it will return XTargetType instead of SpawnType. E.g.

Rich (BB code):
# if any npcs on xtarget have less than 100% aggro
/if (${SpawnSort[1,asc,PctAggro,xtarhater].PctAggro} < 100) {
    /varset npcIDontHaveAggroOnID ${SpawnSort[1,asc,PctAggro,xtarhater].ID}
    # stuff to get aggro back
}
You can also use "group" in spawn search, and sort by something on groupmember (probably the most useful is PctAggro again). It'll return GroupMemberType too. e.g.

Rich (BB code):
# if the highest aggro player in the group isn't the main assist
/if (!${SpawnSort[1,desc,PctAggro,group].MainAssist}) {
    /varset playerWithAggroID ${SpawnSort[1,desc,PctAggro,group].ID}
    # heal them or whatever
}
Thanks toots for the idea and donating for development!
Author
alynel
Downloads
4
Views
54
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from alynel

Latest reviews

will replace of lot of stuf in any pull macro even in kiss.
Top