Jump to content

"Factionalize" Clothing for NPCs


kingtitan

Recommended Posts

Apologies Drake, I posted my comment and didn't see that you had posted until I had already posted! Anyway, I gave your script a shot but it didn't remove the NPC or the player from the faction unfortunately. Correct me if i'm wrong, but was the variable 'wearer' ever actually initialized? It seems to be an almost useless variable within the script!
Link to comment
Share on other sites

Apologies Drake, I posted my comment and didn't see that you had posted until I had already posted! Anyway, I gave your script a shot but it didn't remove the NPC or the player from the faction unfortunately. Correct me if i'm wrong, but was the variable 'wearer' ever actually initialized? It seems to be an almost useless variable within the script!

 

No need to apologize. I wonder why it didn't work on the player, if it previously did, as that part of it wasn't even touched.

 

"wearer" is always set right after the "if self.isActor == 0" block. So if "self" is an actor, "wearer" stores a reference to it.

 

However, you're right, I actually missed the very purpose I explained that much in detail. "self.isActor" will never be "0" under your conditions, as you're in MenuMode while the temporary holding container is open and the check will not run, and when you close it, the items either go back into the NPC's inventory or into your's. They will never be "dropped" that way. My check only serves a purpose, if You, the player, actually "drop" the item to the ground without unequipping it. That's the only way "isActor" could return "0".

 

It should rather be used in a "self != wearer" approach, to check if the item switched from one's inventory into another's, which is what happens when using the temporary holding container to access NPCs' inventories.

 

Let me see... maybe this will do better:

Scn ATPrisonerCollarScript

ref self
ref wearer

Begin GameMode

Set self To GetContainer

if ( wearer != 0 && wearer != self ) ; container changed and still has reference to previous wearer
       wearer.SetFactionRank ATPrisonerFaction, -1
       set wearer to 0 ; delete reference to previous wearer
endif

if ( self.IsActor == 0 ) ; item got dropped, previous wearer got removed from faction by previous check in this case, too
       Return
endif

set wearer to self ; store reference to current wearer 

if ( self.GetEquipped ATPrisonerCollar )
       self.SetFactionRank ATPrisonerFaction, 0
else
       self.SetFactionRank ATPrisonerFaction, -1
endif

End

That should be more robust now and serve the actual purpose.

Sorry for the confusion last time.

Link to comment
Share on other sites

Ah, as you said yourself, no need to apologize! Well finally good news on my end, the script worked perfectly for both an NPC and the Player character!! I couldn't have asked for more, thanks to all of you guys for helping me out and especially you drake for finally sorting it all out! If I hadn't already, I would gladly give every one of you kudos. Again, many thanks! http://forums.nexusmods.com/public/style_emoticons/dark/thumbsup.gif
Link to comment
Share on other sites

  • Recently Browsing   0 members

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