Hi, I have a problem while trying to use SetFactionRank and GetFactionRank.
I'm using this in a script that is part of a quest:
Faction Property MyFaction Auto...Actor npc...npc.addToFaction(MyFaction)...
MyFaction is correctly linked to the relevant faction in the quest script properties. The script compiles without error.
The NPC is a levelled actor. I can print the NPC's name and race using npc.getLeveledActorBase().getName(), so the npc seems to be correctly initialized by the time addToFaction is called.
However, I get this error in the papyrus log:
Error: Cannot set the faction rank with a None faction
The stack points to the call of addToFaction within my script.
In game, the console command getfactionrank [myfactionid] returns -2, meaning the npc wasn't added to the faction.
I'd like to understand what is going on, as I am not experienced enough in Papyrus to understand the error message. The way I understand it, it's complaining that at runtime the faction property is not linked to a faction object in the script properties, am I wrong?
I have checked the script properties a few times now and double checked various tutorials on the net, and I can tell that the faction property is correctly defined and linked in the script properties. Maybe the error is related to something else?
Could this problem be the result of unforeseen interaction between my mod and other mods?
Thank you for any help you might offer.