SetFactionRank In Actor Script

Post » Fri Oct 18, 2013 1:32 am

Papyrus noob here.

I have an NPC that needs to have its faction ranks updated when a certain quest stage is reached via dialogue. Unfortunately, after scouring Google, the CK wiki and this forum, I remain without a clue. I think that my problem is just not knowing which event to use in the NPC's script, or maybe my entire approach is wrong.

My latest failure is as follows:

Event OnInit()	RegisterForSingleUpdate(1.0)EndEventEvent OnUpdate()	Bool bUpdate = true	If (BobQuest.GetStage() >= 50)		Bob.SetFactionRank(PotentialFollowerFaction, 0)		Bob.SetFactionRank(CurrentFollowerFaction, 0)		Bob.SetFactionRank(PotentialMarriageFaction, 0)		Bob.SetRelationshipRank(Game.GetPlayer(), 3)		bUpdate = false		UnregisterForUpdate()	EndIf	If bUpdate		RegisterForSingleUpdate(1.0)	EndIfEndEvent

The listed factions are set to -1 on the NPC, because I don't want the "Follow me" or marriage dialogue available until stage 50 of the quest. I also want the NPC to automatically become a follower at the end of the conversation, without the player having to initiate conversation again, hence (CurrentFollowerFaction, 0). Whether this works, I do not know.

It's all moot for the moment, because I don't know how to tell the actor script to run the above If routine and set the necessary faction ranks. If anyone has an idea, or if I am totally out of the ballpark in my thinking here, I'd appreciate the help.

Thanks.

User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm

Post » Fri Oct 18, 2013 8:39 am

Wouldn't you do this directly from the quest stage fragment? As long as the NPC actor is defined to the quest script as a property, you should be able to do it when the quest event occurs.

Since everything is event-driven, I find it helps to consider what the event is happening to. In this case, the quest is getting its stage changed. However, it may be that the event triggering the SetStage could also do the SetFactionRank, if it involves the same Actor .
User avatar
Jennie Skeletons
 
Posts: 3452
Joined: Wed Jun 21, 2006 8:21 am

Post » Fri Oct 18, 2013 12:25 am

That was actually the first thing I tried, but I don't know how to create properties for factions in the quest stage view. In the Quest Aliases tab, there's a place under "Alias Data" labeled Alias Factions, and I placed all of the relevant factions there on the actor alias, but it doesn't work. Ditto for attempting to trigger the faction change from dialogue.

Alias_Bob.GetReference().SetFactionRank(PotentialFollowerFaction, 0)Alias_Bob.GetReference().SetFactionRank(CurrentFollowerFaction, 0)Alias_Bob.GetReference().SetFactionRank(PotentialMarriageFaction, 0)Alias_Bob.GetReference().SetRelationshipRank(Game.GetPlayer(), 3)

Result:

... variable PotentialFollowerFaction is undefined... SetFactionRank is not a function or does not exist... variable CurrentFollowerFaction is undefined... 

And so on.

User avatar
Irmacuba
 
Posts: 3531
Joined: Sat Mar 31, 2007 2:54 am

Post » Fri Oct 18, 2013 1:07 am

That result implies that Alias_Bob is not an Actor. Check the alias definition. Also the akFaction parameter is the alias name (local) for the faction, not the actual name. That allows the script to have the factions passed in when you play - the clue being that it's looking for a variable.
User avatar
meghan lock
 
Posts: 3451
Joined: Thu Jan 11, 2007 10:26 pm

Post » Fri Oct 18, 2013 6:03 am

Bob is the quest alias for unique actor UR_Bob.

I don't know what you mean by "the alias name for the faction," because I don't know how to define a quest alias for a faction, other than to add the factions to the actor alias, which doesn't work. Alias_FactionName doesn't compile either.

User avatar
Juanita Hernandez
 
Posts: 3269
Joined: Sat Jan 06, 2007 10:36 am


Return to V - Skyrim