Jump to content

Is there a way to get an array of Factions that an Actor is in?


Recommended Posts

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
Link to comment
Share on other sites

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...

 

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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