GetAll or GetNth Nearest?

Post » Thu Jun 21, 2012 12:26 pm

FindNearest? Great. FindRandom? Fine. Find NEXT Nearest? How do I do this?

For instance, I want to find all books in the area... are maybe I want to find the guard farthest away from the player, so he runs and sounds the alarm while his two buddies pummel the player.

The only thing I can think of is calling a FindRandom(thing) 50 or 60 times and keep popping unique hits into an array. There has to be a better way...

Am I missing a command or something? Or did Beth really not implement something like FindNthReferenceOfType() in Papyrus?
User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Thu Jun 21, 2012 10:31 am

Unfortunately there's not, no. I agree with you completely, it would be wonderful to have, but I'm afraid we'll have to rely on SKSE if we ever want this kind of functionality, unless Bethesda implement it in a future patch, as they have done in previous games when releasing DLC.

Cipscis
User avatar
Lou
 
Posts: 3518
Joined: Wed Aug 23, 2006 6:56 pm

Post » Thu Jun 21, 2012 4:25 pm

One word: "Wow"

Well, at least someone is finally documenting the SKSE API in the CK wiki.
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Thu Jun 21, 2012 4:41 pm

SKSE already has this functionality via http://www.creationkit.com/GetNthRef_-_Cell.
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Thu Jun 21, 2012 3:16 pm

Oh great, thanks for that RandomNoob. I really need to take a look at the SKSE progress that's happened over my absence.

Cipscis
User avatar
FITTAS
 
Posts: 3381
Joined: Sat Jan 13, 2007 4:53 pm

Post » Thu Jun 21, 2012 10:12 pm

Ummm... I don't belive that gives you the next nearest reference. It lets you iterate over all the refs in the cell, certainly, but it doesn't do anything about ordering them by distance.

That said, it wouldn't be too hard to generate a list and sort it based on idistance from reference X. Use an array, and a simple sort algorithm and you're there.

[edit]

Of course, for finding all books in the cell, or just looking for the most distant guard, it's fine :)
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Thu Jun 21, 2012 10:51 am

Is there any way, in the Tamriel worldspace, of getting the references of those cells adjacent to the player's parent cell? I did look, but couldn't see :(. Finding all the references of a type in a cell is all very well, but if your character is outdoors and near a cell boundary then there's a bit of a problem :).
User avatar
Taylrea Teodor
 
Posts: 3378
Joined: Sat Nov 18, 2006 12:20 am

Post » Thu Jun 21, 2012 5:43 pm

Two approaches I've tried: a cloak effect spell and a quest that fills references starting with the nearest to the player.

The cloak effect seems to work most reliably.
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm


Return to V - Skyrim