I have two questions that maybe someone can answer. I have a randomly picked NPC following the player around trying to stay unnoticed through a FollowPlayer package. It works, but it's quite obvious that the player is being followed by the way the Follow packages work. I would like to use SandboxAndKeepEyeOn, but it doesn't seem to work. The NPC doesn't follow around. Does anybody have experience with this package and why it might not be working?
The next thing, I want the NPC to engage in dialogue or ambush the player at the moment that the player is in a lonely spot. That means, the NPC follows the player around trying to stay unnoticed until the player is not seen anymore by anybody but the ambushing NPC. I have been looking on ways to achieve this, but I haven't found a decent solution. The nearest way I think might work is through the SKSE function GetNumRefs tied with GetLOS.
Something like the following...
int numNPC = Cell.GetNumRefs(43) ; kNPC = 43int index = 0int NPCwithLOS = 0While index < numNPCif Cell.GetNthRef(index, 43).getLOS PlayerRef && Cell.GetNthRef(index, 43) != AmbusherRef NPCwithLOS += 1EndIfindex += 1EndWhile
This is supposed to loop through all NPC's in the cell and check for LOS with each one. Everytime it finds an NPC with LOS, it will add one to the NPCwithLOS variable, except if it is the ambusher. If this returns 0, then the ambusher would proceed with the ambush, if not he will keep following. I'm not sure if this would work or if there might be an easier way. But the problem I see with this is that it is only checking one cell, and there might be other NPC's with LOS in nearby cells...
Any idea on how to do this better than the above code? Would this code work at all???
Thanks!