Talk:Find (Procedure)
Jump to navigation
Jump to search
Is there a way to limit the object list to only what the subject has LOS on? —The preceding unsigned comment was added by Jbezorg (talk • contribs) 2013-02-17T23:36:59
- I can't say for sure, since I don't know anything about ObjectLists at all, and know almost nothing about scripting. But if they are Arrays (Papyrus), you could maybe, after populating the array with find, do something like...
; Using the player here, but use whatever actor you like.
Actor Property PlayerREF Auto
PlayerREF.Find(PlayerREF.GetCurrentLocation(), yourTarget, yourObjectList, false, false)
; Remove items from the object list that aren't found. WARNING, may be slow.
Int iElement = yourObjectList.Length
While iElement
iElement -= 1
If (!PlayerREF.HasLOS(yourObjectList[iElement]))
; Remove the element.
yourObjectList[iElement] = none
Endif
EndWhile
If they are formlists instead of arrays, then something like this instead:
; Using the player here, but use whatever actor you like.
Actor Property PlayerREF Auto
PlayerREF.Find(PlayerREF.GetCurrentLocation(), yourTarget, yourObjectList, false, false)
; Remove items from the object list that aren't found. WARNING, may be slow.
Int iElement = yourObjectList.GetSize()
While iElement
iElement -= 1
Ref rObject = yourObjectList.getAt(iElement)
If (!PlayerREF.HasLOS(rObject))
; Remove the element.
yourObjectList.RemoveAddedForm(rObject)
Endif
EndWhile
Something like that: I know probably less than you about scripting, but this may take you in vaguely the right direction maybe. Catwheezle (talk) 2013-02-28T15:23:10 (EST)