Difference between revisions of "FindRandomReferenceOfAnyTypeInListFromRef - Game"

imported>Tox2ik
imported>Tox2ik
Line 22: Line 22:
<source lang="papyrus">
<source lang="papyrus">
import debug
import debug
FormList property AllEnchantedArmors auto ; roughly 1500 entries
FormList property lookForItems auto       ; roughly 1500 entries (all enchanted armors)
float distance = 2560.0          ; slightly longer than the carpet in The Great Porch of Dragonsreach
float distance = 2560.0          ; slightly longer than the carpet in The Great Porch of Dragonsreach
int len = lookForItems.getSize()
int len = lookForItems.getSize()
Line 48: Line 48:
trace("no items found. list: " +lookForItems+ ", list entries: " + len)
trace("no items found. list: " +lookForItems+ ", list entries: " + len)
endif
endif
</source>


 
This example will look any enchanted armor that the lookForItems FormList has been filled with (in the CK).
</source>
While the search distance and the length of the form list look ominously big, this example should find an
item within a second if the player is within the specified distance of a qualifying item.  The reason for
iterating so many times is not really well founded, but it follows the example in critterBird.psc.


== See Also ==
== See Also ==
Anonymous user