detecting npcs

Post » Sat May 28, 2011 10:15 am

I'm fiddling around with companions right now and was wondering if there is a way to check if ANY npc can detect the calling actor?

Multiple npcs will be using this script.
User avatar
Ebou Suso
 
Posts: 3604
Joined: Thu May 03, 2007 5:28 am

Post » Sat May 28, 2011 1:48 am

Try http://www.uesp.net/wiki/Tes3Mod:GetDetected.
User avatar
Marnesia Steele
 
Posts: 3398
Joined: Thu Aug 09, 2007 10:11 pm

Post » Sat May 28, 2011 6:27 am

That's what I had planned to use, but it doesn't work if you aren't checking for a specific npc right?

"if the calling NPC can detect the given actor". I'd have to use GetDetected on all npcs in the cell using a targeted script and mwse? But I'd still have the problem of the "given actor" part because its running on all the CM partners.
User avatar
trisha punch
 
Posts: 3410
Joined: Thu Jul 13, 2006 5:38 am

Post » Sat May 28, 2011 9:08 am

if script is local, I'd try something like
short global pwDetectCount
begin pwNPCScriptshort lastDetectedif ( ( GetDetected "player" ) != lastDetected )	set lastDetected to ( GetDetected "player" )	if ( lastDetected )		set pwDetectCount to ( pwDetectCount + 1 )	else		set pwDetectCount to ( pwDetectCount - 1 )	endifendifend
if pwDetectCount is > 0, someone should be detecting
untested though
[EDIT]changes to add missing player reference, thanks RAKninja
User avatar
Jerry Jr. Ortiz
 
Posts: 3457
Joined: Fri Nov 23, 2007 12:39 pm

Post » Sat May 28, 2011 3:03 am

doesnt getdetected require you to list the actor you are checking? such as the examples given -

if ( GetDetected, "teres arothan" == 1 )		if ( GetDetected, Player == 1 )


as such you'd have to have a copy of that script on every NPC in the area that you are checking, right?

and would this not be impractical to use on a companion, as they generally follow the PC around?

though if that sample script does work i can think of a multitude of uses for it =D
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Sat May 28, 2011 6:27 am

doesnt getdetected require you to list the actor you are checking?

Opps, sure, forgot the player bit, editing...
nd would this not be impractical to use on a companion, as they generally follow the PC around?
Yes, I think it could be more usuful for generic following NPC.
User avatar
Ladymorphine
 
Posts: 3441
Joined: Wed Nov 08, 2006 2:22 pm

Post » Fri May 27, 2011 7:52 pm

Opps, sure, forgot the player bit, editing...
Yes, I think it could be more usuful for generic following NPC.


Unfortunately, I'm actually checking to see if any other NPC can detect the companion, not the player. (Although, I can't believe I didn't realize that the player would count as detecting the npc too...).

In the end I decided it wasn't possible since you have to include a reference to be detected. Since its a local script running on many npcs, It would be impractical to give each of them unique scripts.
User avatar
gemma
 
Posts: 3441
Joined: Tue Jul 25, 2006 7:10 am

Post » Sat May 28, 2011 6:14 am

might be possible with MWSE, though. not sure how it would perform or exactly how to script it.
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm


Return to III - Morrowind