Jump to content

player.GetNthFollower gets NPC that isn't following player


Recommended Posts

Here's the two lines that produce the output:

 

set TempRef to player.GetNthFollower Count
PrintC "%.0f - %n - %i - %.0f - %.0f - %n - %i - %.0f" Count, TempRef, TempRef, Package, Procedure, Target, Target, FollowerOnboardStatus

 

Screen-Shot1019.jpg

 

The player is cornelio not Farwil. I'm thinking this isn't a bug with obse but something goofy in this particular game. But, how to avoid it? If I do a double check to see if the npc's target is the player it won't work because sometimes the target is the player and sometimes is says <no name> for a legitimate follower that is following in the game. Any ideas?

Thanks

Link to comment
Share on other sites

I don't how complex is your checking, but if this function returns invalid values I think I would try to check field returned by GetFollowers myself and test the records against 0 (as 0 means often invalid reference). In case of invalid entries I would simply cease any action and would call GetFollowers again next frame.

Link to comment
Share on other sites

Thanks RomanR. I've done what you suggest with looking at element 0 of the returned array (GetFollowers). That's what the line right above tdt is showing. I'm not sure what you mean with "cease any action and would call GetFollowers again next frame". I'm still foggy about the doing something in the next frame. Do you always have to use a timer or set a flag or something? I'll give it a try for sure. That would be great if that's all I need to do. This script is run from a spell and can be repeatedly cast with the same result but there are several other scripts where I need the followers info like doors for instance.

Here's the whole script:

 

Line 1: SCN a1ccFollowerInfoScript
Line 2:
Line 3: short NumberOfFollowers
Line 4: short Count
Line 5: short Procedure
Line 6: short Package
Line 7: short FollowerOnboardStatus
Line 8: short PlayerOnBoardStatus
Line 9: short NumElements
Line 10:
Line 11: ref TempRef
Line 12: ref Target
Line 13:
Line 14: array_var Followers_ary
Line 15:
Line 16:
Line 17: Begin ScriptEffectStart
Line 18: let Count := 0
Line 19: let NumberOfFollowers := player.GetNumFollowers
Line 20: let Followers_ary := player.GetFollowers
Line 21: let NumElements := ar_Size Followers_ary
Line 22: printc "%.0f Followers" NumberOfFollowers
Line 23: printc "Index - Name - RefId - Package - Procedure - Target - Onboard"
Line 24: While Count < NumberOfFollowers
Line 25: if ( Count == 0 )
Line 26: let FollowerOnboardStatus := a1ccDwemerHomeRef.Follower1Onboard
Line 27: elseif ( Count == 1 )
Line 28: let FollowerOnboardStatus := a1ccDwemerHomeRef.Follower2Onboard
Line 29: else
Line 30: let FollowerOnboardStatus := a1ccDwemerHomeRef.Follower3Onboard
Line 31: endif
Line 32: set TempRef to player.GetNthFollower Count
Line 33: set Target to TempRef.GetPackageTarget
Line 34: let Package := TempRef.GetCurrentAIPackage
Line 35: let Procedure := TempRef.GetCurrentAIProcedure
Line 36: PrintC "%.0f - %n - %i - %.0f - %.0f - %n - %i - %.0f" Count, TempRef, TempRef, Package, Procedure, Target, Target, FollowerOnboardStatus
Line 37:
Line 38: let Count += 1
Line 39: Loop
Line 40: let PlayerOnBoardStatus := a1ccDwemerHomeRef.PlayerOnBoard
Line 41: printc "PlayerOnboard = %.0f" PlayerOnBoardStatus
Line 42: ;Array version
Line 43: printc " "
Line 44: set Count to 0
Line 45: While Count < NumElements
Line 46: let TempRef := Followers_ary[Count]
Line 47: set Target to TempRef.GetPackageTarget
Line 48:
Line 49: printc "%.0f - %n - %n - %i" Count, TempRef, Target, Target
Line 50:
Line 51: let Count += 1
Line 52: Loop
Line 53:
Line 54: end

Link to comment
Share on other sites

What do you get if you do a ar_dump Followers_ary ? Also, what exactly is the problem here? Do you think Bremmen should be following you and not Farwil?

 

Using the mod RefScope, you can see exactly what AI package is on an NPC.

 

Also, you are assuming TempRef is an NPC.

Edited by GamerRick
Link to comment
Share on other sites

Thanks GamerRick. I'll have to read up on ar_dump Followers_ary. I'm not familiar with that. I'll give it a try. The problem is the game is crashing when the player activates that door. Bremmen is not and should be following the player. He is following Farwil as he should. The problem is the code above usually always works to give correct followers ( of the player )but in this one particular save game it gives erroneous results.

 

I've used "QQuix Conceptual - AI package info reporter" to look at the AI and my script looks at the AI which is package 1 and procedure 11, shown in the picture. I've also done a moveto Farwil and with the console and tdt it shows the package and procedure and it all agrees package 1 and procedure 11 but he's not following the player so "player.GetNthFollower 0" should not be saying he is following the player.

 

TempRef is just a reference variable that is being set to the follower reference so it works in the print statements. Lines 36 and 49.

Link to comment
Share on other sites

Here's the ar_dump. RefScope is a good idea, I'll work on that. Bremman is a legitimate follower of the player during the quest "The Wayward Knight". My guess is a bug in the game has left something in the save game ever since that quest was played. I just need a way to remove this false status in the game. Maybe to access and change a game variable that is causing obse to think this npc is following the player?

 

ar-dump.jpg

Link to comment
Share on other sites

To cease action I thought of testing the ref against zero, for example like this (print lines are optional):

   set TempRef to player.GetNthFollower Count
   if TempRef != 0
      set Target to TempRef.GetPackageTarget
      let Package := TempRef.GetCurrentAIPackage
      let Procedure := TempRef.GetCurrentAIProcedure
      PrintC "%.0f - %n - %i - %.0f - %.0f - %n - %i - %.0f" Count, TempRef, TempRef, Package, Procedure, Target, Target, FollowerOnboardStatus
   else
      print "Check 1: Follower on index "+$Count+" seems invalid."
   endif

And here:

   set Count to 0
   While Count < NumElements
     let TempRef := Followers_ary[Count]
     if Tempref != 0
        set Target to TempRef.GetPackageTarget
        printc "%.0f - %n - %n - %i" Count, TempRef, Target, Target
     else
        print "Can't get a target - follower on index "+$Count+" is invalid."
     endif
     let Count += 1
   Loop
Edited by RomanR
Link to comment
Share on other sites

Okay, cool. This problem is in a save game from someone who did some testing for me on a mod I'm working on. I recently completed the Wayward Knight myself and Bremman was following me during the quest and then stopped following after the quest completed. This might be something that is extremely rare. The reason I want to look into it is because while playing Morroblivion I had something similar a few times where a dead npc (enemy I killed) was showing up on my follower list. In those cases the rogue follower could be disabled easy enough but with a live actor I wouldn't want to disable them. I have a small Airship mod which has the same problem. When you go onboard by activating the ship Bremman shows up and immediately takes off running fast because he's going back to Farwil (no crash because it all happens outside) My new airship that I'm working on is big with doors and interior spaces and that's what's causing the crashing because I guess forcing a non-following actor into an interior space doesn't work very well.

 

While I was inside the Oblivion realm with Bremman, Farwil, and companion Vilja all following me, for a test, I summoned this new giant airship and the four of us went onboard and went inside with no problem. If you want to try it let me know, I could use another tester.

Thanks

Link to comment
Share on other sites

Okay RomanR. I didn't see your post. We were both typing at the same time. I think I see what you're saying. Maybe the reference is invalid and still gives me the phony baloney? I'll give that a try tomorrow morning. The only thing is the reference is already printing out ( 31bc8 ) but sometimes things don't work the way you think they should. It'll be easier to try it than keep thinking about it.

Thanks

Link to comment
Share on other sites

  • Recently Browsing   0 members

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