[HELP REQ] Factions not adding via script

Post » Fri May 27, 2011 5:56 pm

Hello there chums, I have a question for you.

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
User avatar
He got the
 
Posts: 3399
Joined: Sat Nov 17, 2007 12:19 pm

Post » Fri May 27, 2011 12:07 pm

You can't add factions to a leveled list item, you will need to add it to the actor.

Furthermore, faction membership is owned by the BASE and not the INSTANCE. Meaning that once an actor is added to a faction, all copies of that actor will also be part of that faction. Meaning that you may need to re-think your idea entirely if the same base actor will ever be added to two different factions via your method. You are likely best off either using different sets of actors for each faction if they are to appear at the same time, or just changing the factions on a placed dummy actor that uses the same base prior to the actors being spawned by the leveled list.
User avatar
Sammie LM
 
Posts: 3424
Joined: Thu Nov 30, 2006 1:59 pm

Post » Fri May 27, 2011 7:10 pm

...or just changing the factions on a placed dummy actor that uses the same base prior to the actors being spawned by the leveled list.

What an excellent idea! I am trying to create a storyline divergence here, so for any one playthrough, only one faction will be added. Thanks, I'll tell you if it works out.

EDIT: Excellent, issue resolved. Thank you.
User avatar
Bonnie Clyde
 
Posts: 3409
Joined: Thu Jun 22, 2006 10:02 pm


Return to IV - Oblivion