Skip to content

MQ2SpawnSort

MQ2SpawnSort

Find spawns by whatever variable you like, sortable

Authors: alynel

Resource Download Support Repo

Plugin to add a TLO similar to NearestSpawn, but lets you sort by (almost) anything. Thanks toots for the idea and donating for development!

Top-Level Objects

SpawnSort

Returns the nth spawn that matches your spawn search string, sorting in ascending or descending order by any spawn member.

There's a special case to handle MQ2Nav as well, see examples.

Forms

spawn SpawnSort[<n>,<asc|desc>,<member>,<spawnsearch>]

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 😔.

xtarget SpawnSort[<n>,<asc|desc>,<member>,<xtarget-specific spawnsearch>]

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

groupmember SpawnSort[<n>,<asc|desc>,<member>,group]

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.