Jump to content

GetInFaction() returning False even if the Actor is in the faction


Recommended Posts

Hello, I was trying the IsInFaction() function to check if the Alias Actor of RelationshipMarriageWedding Quest is in my Potential Wife Faction, during the wedding confirmation dialog

- The PotentialWifeFaction members are Ysolda, Jenassa (HirelingJenassa), Lydia (HousecarlWhiterun) and Camilla Valerius, but the function only returns TRUE when marrying Ysolda and Jenassa

- The Alias_LoveInterestNPC property is filled with the vanilla LoveInterest Alias (filled with “GetInFaction PotentialMarriageFaction” Match Condition)  

Does anyone have any idea why the function returns FALSE when marrying Lydia and Camilla Valerius, even if I’m sure I put them in the Faction?
 

Scriptname MarriageScript extends Quest
 
Faction Property PotentialWifeFaction Auto
Quest Property PlayersWifeQuest Auto
ReferenceAlias Property Alias_LoveInterestNPC Auto
 
Function OnMarriage()
 
    IF Alias_LoveInterestNPC.GetActorRef().IsInFaction(PotentialWifeFaction)
        PlayersWifeQuest.SetStage(20)
    else
        Debug.MessageBox("The actor is not in the Potential Wife Faction")
    endif
 
EndFunction
Link to comment
Share on other sites

check these

  • are the properties filled correctly 
  • tell us if the faction is added to alias using the KIT in the Alias
  • or code
  • or applied directly to the actor

code wise debug it please, it may OK in CK, but you may require a clean save

Debug.MessageBox("This RefAlias variable /"Alias_LoveInterestNPC/" is filled: " + (Alias_LoveInterestNPC.getReference() as Actor != none))

if filled it will print: This RefAlias property "Alias_LoveInterestNPC" is filled: TRUE

if empty it will print: This RefAlias property "Alias_LoveInterestNPC" is filled: false

then do the same with the others 

Debug.MessageBox("This Quest property is filled: " + (PlayersWifeQuest  != none))
Debug.MessageBox("This Faction property is filled: " + (PotentialWifeFaction != none))

Once you see what is happening, I believe you can work it out for yourself 👍🏽👍🏽they either not filled (overridden by dirty save) needing a clean save

I think you double check it in the KIT enough already, (if not check the KIT)  but when it does not work in the game, check all and sundry ingame, you be surprise at the result.  You can either for testing fill the variables with code to avoid going quest stages or start a new game then console thru quest stages to test your code. 

Link to comment
Share on other sites

OOPS if you filled the variables with code dynamically, it will override the save and work OK?, just make sure they filled before you call the OnMarriage() function

Form Function GetFormFromFile(int aiFormID, string asFilename) native global

Actor akActor = Game.GetFormFromFile("myMod", "0x000FFF")

Function Onmarriage()
 	patchCode()

 	;your code goes here	
EndFunction

Function patchCode()

 	; code like example goes here
 	; remove on saving
 	; it needs to runs once
EndFunction

https://ck.uesp.net/w/index.php?title=GetFormFromFile_-_Game&mobileaction=toggle_view_desktop

patching test code  is less work then debugging you will find 😉😉😉😉

EDIT I tried this many years ago, but is has buggy as hell and crashes more often than not,  if you need to see something new in game quickly that not loading.. 

https://www.afkmods.com/index.php?/topic/3721-skyrim-creation-kit-feature-hot-loading-plugins/

HOT LOADING PLUGIN... but is a dev feature, worst that can happen is it will crash.

plus for pity sake do not save if you use it ...  it is not for game play, just hot loaded it test it and quit.

 

Link to comment
Share on other sites

4 hours ago, PeterMartyr said:

check these

  • are the properties filled correctly 
  • tell us if the faction is added to alias using the KIT in the Alias
  • or code
  • or applied directly to the actor

code wise debug it please, it may OK in CK, but you may require a clean save

Debug.MessageBox("This RefAlias variable /"Alias_LoveInterestNPC/" is filled: " + (Alias_LoveInterestNPC.getReference() as Actor != none))

if filled it will print: This RefAlias property "Alias_LoveInterestNPC" is filled: TRUE

if empty it will print: This RefAlias property "Alias_LoveInterestNPC" is filled: false

then do the same with the others 

Debug.MessageBox("This Quest property is filled: " + (PlayersWifeQuest  != none))
Debug.MessageBox("This Faction property is filled: " + (PotentialWifeFaction != none))

Once you see what is happening, I believe you can work it out for yourself 👍🏽👍🏽they either not filled (overridden by dirty save) needing a clean save

I think you double check it in the KIT enough already, (if not check the KIT)  but when it does not work in the game, check all and sundry ingame, you be surprise at the result.  You can either for testing fill the variables with code to avoid going quest stages or start a new game then console thru quest stages to test your code. 

Thanks! I've done all the suggested tests and the problem was actually the dirty save

Gonna make sure to practice more these Patching Code and Hot Loading methods in the future

Link to comment
Share on other sites

patching the code is quick an easy fix, if it a lot drama to get back to quest stage, is quick fix, also remember once you save, you can comment out the patch, it work is done, the save is updated

yeah I patch has go, for testing.. but once you completed your current sprint, I would drop back to clean save, removing testing patches

a sprint is like a week worth of work

Link to comment
Share on other sites

  • Recently Browsing   0 members

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