I am trying to spawn a NPC from a leveled list of NPCs. None of the NPCs in the list have factions (I want to keep them as generic as possible).
So I made a dummy cell and put one of the leveled list icons in that cell. I Made it a Persistent Ref, and Initially Disabled. I gave it the reference TRNOotGIROBattleMercLeveledListMeleeREF01
Using a script I them proceed to move it to the correect location. An actor is generated by the leveled list and appears on the marker as expected.
TRNOotGIROBattleMercLeveledListMeleeREF01.enable TRNOotGIROBattleMercLeveledListMeleeREF01.resurrect TRNOotGIROBattleMercLeveledListMeleeREF01.setFactionRank TRNOotGIROMercenaryFactionEvil 0 TRNOotGIROBattleMercLeveledListMeleeREF01.moveto TRNOotGIROBattleGatehouseRoof01MARKER
What I have done is spawn a number of such NPCs. They have all been generated by the same means. However they attack each other. The faction clearly sets the deposition with members of that same faction to be 100. AI aggression is only 50 so I couldn't understand what was wrong.
I added the following to debug:
short q set q to TRNOotGIROBattleMercLeveledListMeleeREF01.getfactionrank TRNOotGIROMercenaryFactionEvil PrintC "Merc is in Faction = %g", q
This returns "Merc is in Faction = -1"
From this I concluded that the faction wasn't successfully added. I cannot figure out how to fix it, and I'm hoping that someone knows whats happening.
Thanks.
Note: I am using OBSE v16