Jump to content

Recommended Posts

Posted

I realize that I could make a long list of targeted Factions and iterate through a bunch of "IsInFaction" requests. But, I worry about the performance of that.

 

Isn't there some way to efficiently get a list of the Factions that an Actor is in?

Posted (edited)

Off the top of my head, the only thing I can think of is to create a formlist of all of the usual factions and then run a While/Endwhile loop on it with a check in the middle that says... actually easier this way.

 

FactionsFormList = a formlist in the CK with all of the factions you want to check against.

PlayerFactions = a script level array of factions the player is in

 

Int j = 0

While (j < FactionsFormList.length)

If PlayerREF.IsInFaction(FactionsFormList[j])

PlayerFactions.Add(FactionsFormList[j])

Endif

J +=1

EndWhile

 

Of course, you'd need to define these in the script and also initialize the arrays, but thats easy enough...

Edited by joerqc
Posted
  On 4/16/2018 at 1:49 AM, shatsnazzle said:

I saw this in the SKSE section, maybe F4SE has a similar function.

 

https://www.creationkit.com/index.php?title=GetFactions_-_Actor

 

That would do it. I think I'll explore some options first. But, might be able to request it...

 

  On 4/16/2018 at 1:54 AM, joerqc said:

Off the top of my head, the only thing I can think of is to create a formlist of all of the usual factions and then run a While/Endwhile loop on it with a check in the middle that says... actually easier this way.

 

FactionsFormList = a formlist in the CK with all of the factions you want to check against.

PlayerFactions = a script level array of factions the player is in

 

Int j = 0

While (j < FactionsFormList.length)

If PlayerREF.IsInFaction(FactionsFormList[j])

PlayerFactions.Add(FactionsFormList[j])

Endif

J +=1

EndWhile

 

Of course, you'd need to define these in the script and also initialize the arrays, but thats easy enough...

 

 

Thank you. The trouble is that it's an operation that will likely have to be run quite a bit. So, I don't want to do a loop on 20 items to pull 2 items. It could add up to a performance issue.

Posted (edited)

I've been looking into this as well. But it looks like all faction stuff is single instance based (e.g. check 1 faction for any one method or object) forcing you to reiterate.. The only 'set' or array based command I could find was IsFactionInCrimeGroup, but that still doesn't really help.

 

I also couldn't find a faction event that you might be able to hook into. Using a refcollection might speed up the process though: https://www.creationkit.com/fallout4/index.php?title=RefCollectionAlias_Script

 

What you could do is make a deferred routine, filling up your own array/version of the truth.

You can do that by for instance, hooking into CA_NewLocation event, then checking for all factions (deferred in the background) so that this info is ready when you need it.

Edited by Reginald001
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...