Papyrus: Does AddToRemoveFromFaction affect base actors?

Post » Thu Jun 18, 2015 10:32 pm

I need to update the factions of 172 base actors entirely in Papyrus. I also need to update the relationships between 77 factions entirely in Papyrus, too. I don't like having 249 overriding records in the plugin because, obviously, that makes my plugin very, very prone to compatibility/interference issues, so I'm taking steps to move all of those changes out of the plugin.

Would something like this work for updating base actors?

Formlist Property BaseActors AutoFormlist Property FactionsToAdd AutoFunction AddFactionsToActors(Formlist FactionsToAdd, Formlist BaseActors)    Int iIndex = 0    If BaseActors.GetSize() == FactionsToAdd.GetSize() ; Formlists must be set up as key-value pairs and the same size        While (iIndex < BaseActors.GetSize() - 1)            Actor currentActor = BaseActors.GetAt(iIndex) as Actor            Faction currentFaction = FactionsToAdd.GetAt(iIndex) as Faction            currentActor.AddToFaction(currentFaction)        EndWhile    EndIf    iIndex += 1EndFunction

Or should I use quest aliases?

User avatar
Louise
 
Posts: 3407
Joined: Wed Nov 01, 2006 1:06 pm

Post » Thu Jun 18, 2015 2:50 pm

If "BaseActors" contains a list of ActorBase, the line "Actor currentActor = BaseActors.GetAt(iIndex) as Actor" will fail. You cannot cast an ActorBase as an Actor.

Maybe you can try using a formlist of Actor instead of ActorBase. I know that if you drag and drop an actor into a formlist in Creation Kit, you are using the ActorBase, and not a specific reference (an Actor). I don't even know if CK allows you to put an Actor or ObjectReference in a form list. But you can probably do it by script, by filling the formlist with a script.

User avatar
Sarah Evason
 
Posts: 3507
Joined: Mon Nov 13, 2006 10:47 pm


Return to V - Skyrim

cron