Jump to content

Recommended Posts

Posted

I spent a few days on google, wiki and every forum I can think of I guess I need some help with this one.( Most questions I found related to this seem to be unresolved a simple can't be done and I will just find another way.)

 

I'm trying to target the nearest actor to the player but not the playerRef and not the akspeaker.

 

I have tried Game.FindRandomActorFromRef(Game.GetPlayer(), 256.0) always returns the akspeaker

 

                  Game.FindRandomActor(0.0, 0.0, 0.0, 256.0) always returns the player

           

                  Game.FindClosestActor(0.0, 0.0, 0.0, 256.0) always returns the player

 

                  ect.,ect,ect, pretty much all the FindActor functions returns the playerRef or akspeaker

 

I'm speaking to one NPC and I have another closely following me actually closer than the akspeaker most times but it still returns akspeaker or playerRef.

 

Now that I have the npc following the player having something that will target the DialogFollower would work too. Only spent about a half day looking for something that would work for that so I may have over looked something simple. I have never asked for help for anything here I normaly learn more about what I'm doing by researching issues myself. but I am truly stuck and any help would be appriciated thank you.

 

 

Posted

My apologies if this does not seem immediately helpful, but I'm trying to get on the same page.

 

Do you mean you are trying at any given time to "target nearest", whoever the actor might be? Or do you mean you have a random un-named actor following you around that you cannot target? :huh:

 

("akspeaker" I'm not familiar with - can you elaborate, and/or provide a link to where you found the term?)

 

To manually target a nearby NPC, you can always just enter first-person view, face the NPC, enter the console and click on them once to bring up an ID. Are you trying to work out how to accomplish this a different way?

Posted

My apologies if this does not seem immediately helpful, but I'm trying to get on the same page.

 

Do you mean you are trying at any given time to "target nearest", whoever the actor might be? Or do you mean you have a random un-named actor following you around that you cannot target? :huh:

 

("akspeaker" I'm not familiar with - can you elaborate, and/or provide a link to where you found the term?)

 

To manually target a nearby NPC, you can always just enter first-person view, face the NPC, enter the console and click on them once to bring up an ID. Are you trying to work out how to accomplish this a different way?

 

 

Yes I need to target the nearest actor but not the person I'm talking too and not the player in a papyrus script  in the CK ." akspeaker" is the dialog target. This is for a mod so console commands are not an option but thank you :)  I may have to look into setting up a scene for this but I figured the way I made this post if someone found away around this problem then this should jump right out at them since they more than likely had the same hurdle to overcome. Then I can tag this post and the next poor sap who runs into this problem might have this post pop up on google right away and not spend days reading dead ends for a fix.

Posted

Maybe try something like this (needs SKSE):
 

 

Cell playerCell = player.getParentCell()
int iNumRef
int iRef
 
iNumRef = playerCell.getNumRefs(43)
iRef = 0
while iRef < iNumRef
        Actor aNPC = playerCell.getNthRef(iRef, 43) as Actor
 
        If  (aNPC != Player) && (aNPC != akSpeaker) && (aNPC.GetDistance(player) < 256)
            Debug.Notification("have it!")
            ...  stuff to do
        EndIf
     iRef += 1
endWhile

 

Not fast, but should be OK as long as you don't call this code very often.

 

 

Posted

Maybe try something like this (needs SKSE):

 

 

Cell playerCell = player.getParentCell()
int iNumRef
int iRef
 
iNumRef = playerCell.getNumRefs(43)
iRef = 0
while iRef < iNumRef
        Actor aNPC = playerCell.getNthRef(iRef, 43) as Actor
 
        If  (aNPC != Player) && (aNPC != akSpeaker) && (aNPC.GetDistance(player) < 256)
            Debug.Notification("have it!")
            ...  stuff to do
        EndIf
     iRef += 1
endWhile

 

Not fast, but should be OK as long as you don't call this code very often.

 

Your awesome thanks I'm out of time today but I'll try it out seems like it should work.  I don't recall seeing "getNthRef in wiki or anywhere else I looked must have over looked it somehow I think I was just frustrated by some of the useless fuctions I did find thanks again.

 

Edit: Who needs to sleep worked perfect I was expecting to put it in a loop so a slight delay was no biggie. Tried it out about 5 times returned pretty quick with the right actor. So thanks to you there will be 3-ways in Working Girl when SexLab is released :) I found a lot of post in google with this question but they were never answered after I get some sleep I'll put some tags up so others can find this easier

 

  • 4 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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