Jump to content

Can't add npc to custom faction

Recommended Posts

Hi there.


Trying my hand to modding, but I have some trouble out there, so if someone could give me a hand, I'd be most grateful. I looked all over the web trying to figure it out, search around there for similar issue, but could never find any solutions...


For this mod, I made a "lover" faction that I want to use to manage affection. So that this might be working with any npc, including custom ones, I don't want to manually add the npcs to that faction, but have a script check on the first line of dialogue if the speaker is in the faction and, if not, add it in. After some fumbling around and finding out I had to generate a SQE file for the dialogue to appear (that bug still not fixed ? Oo ), I could try the mod... only to find out that it doesn't work. It won't add the npc to the faction and the check itself seems not to work. If I manually add the npc to the faction using console, the next line will show up properly (having for condition the speaker being in the custom faction). Checking the log repeatidly, I came across what seems to be the issue :

[07/18/2014 - 12:20:14PM] ERROR: Cannot set the faction rank with a None faction
    [ (04003F5E)].Actor.SetFactionRank() - "<native>" Line ?
    [SwLo_SweetLoverMain (0C000D62)].SwLo_SweetLoverMainQuest.swloSetLover() - "SwLo_SweetLoverMainQuest.psc" Line 11
    [topic info 0C000D66 on quest SwLo_SweetLoverMain (0C000D62)].swlo_TIF__03000D66.Fragment_5() - "swlo_TIF__03000D66.psc" Line 9

But I'm pretty sure I defined the faction property in both the script and the fragment properly, both compile without a hitch and trying over and over to find what the hell is wrong since yesterday, I'm getting crazy and so turn to you guys in hope that you might help me there. :(


Here's the fragment, with the call in the begin window :

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
Scriptname swlo_TIF__03000D66 Extends TopicInfo Hidden

Function Fragment_5(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

SwLo_SweetLoverMainQuest Property SweetLover  Auto

And the script where I defined my function :

scriptname SwLo_SweetLoverMainQuest extends Quest

;Variable and property definition
Faction Property swloLovers auto
SexLabFramework property SexLab auto
GlobalVariable Property swlo_lsFollowing  Auto  

;Add the character in lover faction if not already in it.
Function swloSetLover(Actor lover)
    if !lover.IsInFaction(swloLovers)
        lover.setfactionrank(swloLovers, 0)
        debug.Notification("added to faction" + swloLovers)
        debug.Notification("Already in faction" + swloLovers)

The faction is created in the CK, with a number of ranks already made (without any title yet, though) and no npc in it. I can see it in game using the console and, as I said, forcing them inside with the console does work. Tried adding a npc in the faction already, still not work for other npcs. Even when i add the npc in faction and can progress to the next step, the debug still gives me the "added to factionnone" line, but either it doesn't actually put the npc in the faction (checked with console) or it shouldn't give me that line.


At first, I tried using the line lover.addtofaction(swloLovers), but was causing the same issue.


The script is attached to the "script" tab of the quest, with all properties properly defined both in script and CK "edit properties" tab. I just don't understand why it keeps telling me that this is a none faction. Tried several npcs, both vanilla and from dlcs to no better result. I'm pretty sure I'm missing something either obvious or stupid (or both), but can't find what is wrong there, so if someone might help me, that would be great.


Oh, almost forgot : tried the mod on new game, still doesn't work.

Link to comment

Welp, found a workaround by setting up a "first time" line in my greeting dialogue with the fragment containing


and associated with a simple condition checking if the npc is not in the faction.


Works fine. Removed the function from my main code as it's now redundant. But I think the issue lays in how I called my function or something.


Now I can get some sanity back and brace for the next issue that might come my way. @_@

Link to comment


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use