ThoraldGM Posted November 19, 2017 Share Posted November 19, 2017 In the Creation Kit, there is a count column for every resource. I can right click a form, select "Use Info", and a window pops up listing the cells where the references are located in the vanilla game. I can click on anything in the list, and that specific reference will load in the render window. So... the game (at least the Creation Kit) knows how many instances / references are tied to each form and where they are. In fact, I've seen this in FO4Edit too, as "Build Reference Info". My question is... can I replicate that result in Papyrus? I am working on a teleport mod that finds statics or furniture, moves a marker to there with offsets, moves marker to navmesh, then moves player to that marker. So far, the categories have been a little tedious to create, but not overwhelming. There are 20 Red Rockets (including filling station remnants and gas prices signs), and there are 13 power lifts on overpasses or tall buildings. Unfortunately, there are 60 bus stop shelter benches and 43 Pulowski preservation shelters. That's a lot of refs to click, load in the render window, and force to a specific ref alias in each refquest. I'm probably going to select a handful and ignore the rest. But what if a function automagically listed the 60 refs? My existing code could import them and the mod would be done within a week. I've seen requests for Find All References (not just of type or within distance) and I guess that's what I'm looking for too. Only it would be both loaded and unloaded refs. Does Papyrus have an obscure function that mimics CK's Use Info feature? If not, guess I will keep selecting refs by hand in the render window, but 80% of available options are going to be ignored due to time/work constraints. Here's a video of my WIP: https://www.youtube.com/watch?v=2oXbgoB4SZ8 Link to comment Share on other sites More sharing options...
FiftyTifty Posted November 20, 2017 Share Posted November 20, 2017 Why are you forcing them to a specific ref alias, rather than chucking them into a ref collection alias? Link to comment Share on other sites More sharing options...
ThoraldGM Posted November 20, 2017 Author Share Posted November 20, 2017 If there was a way to Select All from Use Info and drag them into one ref collection, that would be immensely useful. But the Use Info window lists cell data. I don't think the actual ref data loads until I click an entry and the render window loads, then ref gets listed in the next window down. Or am I missing some easier step? Otherwise I don't need to manipulate several refs at once in game. I just need a faster way to create aliases in refquest so the master quest can pluck individual targets via aliasID. I also don't know the objref ID numbers until I double click each object in the window. So I've just been working faster by hand until I find a better way. Link to comment Share on other sites More sharing options...
FiftyTifty Posted November 20, 2017 Share Posted November 20, 2017 Use FO4Edit: https://www.creationkit.com/index.php?title=TES5Edit_Scripting_Functions The functions you want to look at are ReferencedByIndex() and ReferencedByCount() Link to comment Share on other sites More sharing options...
ThoraldGM Posted November 20, 2017 Author Share Posted November 20, 2017 Nice. Thanks. Looks like I can at least get a list of objref IDs. Do you know if Pascal can fill an alias collection or array with the returned results? Trying to gauge how much of the process can be automated. Link to comment Share on other sites More sharing options...
FiftyTifty Posted November 21, 2017 Share Posted November 21, 2017 Unfortunately, that has to be done at runtime through Papyrus. Good news, you can put the placed objects into a FormList. Then you just do a bit of the ol' Papyrus: Property RefCollectionAlias aliasrefcolBusStops Auto Const Property RefCollectionAlias aliasrefcolShelters Auto Const Property FormList flstBusStops Auto Const Property FormList flstShelters Auto Const bool bDone = false Event OnInit() if (bDone == false) int iCounterBusStops = 0 int iCounterShelters = 0 int iLoopCountBusStops = flstBusStops.GetSize() int iLoopCountShelters = flstShelters.GetSize() ObjectReference refBusStop ObjectReference refShelter While iCounterBusStops < iLoopCountBusStops refBusStop = flstBusStops.GetAt(iCounterBusStops) as ObjectReference RefCollectionAlias.AddRef(refBusStop) iCounterBusStops += 1 EndWhile While iCounterShelters < iLoopCountShelters refShelter = flstBusStops.GetAt(iCounterBusStops) as ObjectReference RefCollectionAlias.AddRef(refShelter) iCounterShelters += 1 EndWhile Else GoToState("FinalState") EndIf bDone = true EndEvent State FinalState() EndState Et voila, filled ref collection alias. Link to comment Share on other sites More sharing options...
ThoraldGM Posted November 21, 2017 Author Share Posted November 21, 2017 Very interesting, next level approach. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts