Jump to content

Detect Corpses?


chris993

Recommended Posts

I've noticed in Fallout New Vegas that NPCs are completely unaware of corpses. When you kill any non hostile NPC through a sneak attack any nearby NPCs are completely blind to it - even if they are standing right in front of the victim - as long as you are hidden it doesn't matter. You don't lose reputation with stealth kills either (which makes sense since they can't see you). This can give any easy way to eliminate Legionaires if sided with the NCR or vice versa.

 

I was wondering if a mod exists that deals with this or how feasible it is to create one.

 

I have started writing a script for a perk that is added to a dead NPC who has been stealth killed. I haven't finished it because I am unsure if such a mod will work properly. I have use capitals to distinguish the comments.

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Scn aaCorpseSignal


Ref Witness
int max
int index
int range
float endTime
float currentTime
float startTime
float fvar;
int factionType	; 0 == civilian, 1 == NCR, 2== Legion, .... expect up to 20
short bDetected

Begin Gamemode

if (endTime == 0)
	TODO:  SET TO CURRENT TIME + 3 MINUTES
	TODO:  SET START TIME
endif


SET CURRENT TIME

;STOP IF CORPSE LONG DEAD (3 MINUTES)
if (currentTime >= endTime) ;or getTimeDead
	TODO: END PERK
	return
endif

;REPEAT EVERY TEN SECONDS
set fvar to currentTime - startTime
set fvar to fvar % 10
if (fvar != 0)
	return
endif	

;EXIT IF PLAYER NOT NEARBY
if (Player.NOTNEARBY == 1)
	return
endif

;iterate through npcs and alert if they meet the criteria

set bDetected to 0
set index to 0
set max to getNumRefs 42 1 0

;ONLY ITERATE UP TO 50 WITNESSES
if (max > 50)
	set max to 50
endif

;TODO: IDENTIFY AND LABEL FACTION (How?)

set Witness to Pencil01	
set Witness to getFirstRef 42 1 0	;NPCS ONLY


label 10

if (bDetected == 0)
	if (index < max)
		
	;TODO:  IF ( VICTIM ENEMY OF WITNESS) 
			;set index to index + 1
			;set Witness to Pencil01
			;set Witness to getNextRef
			;goto 10
		;endif

		;check witness is near enough to notice
		set range to 128 * 20
		if (getDistance Witness <= range)
			;alert if witness is very close
			set range to 128 * 2
			if (getDistance Witness <= range) 
				set bDetected to 1
				set index to index + 1
				set Witness to Pencil01
				set Witness to getNextRef
				goto 10
			
			return
		endif
		;alert if witness can see corpse
		if (getDetected Witness == 1)  ;assume if victim can detect witness then victime is detected by witness
			set index to index + 1
			set Witness to Pencil01
			set Witness to getNextRef
			set bDetected to 1
			goto 10
		endif

	set index to index + 1
	set Witness to Pencil01
	set Witness to GetNextRef
	goto 10
	
	endif
endif

if (bDetected != 0)
	;TODO: 	ALERT WITNESS ... sendAssaultAlarm
	;TODO:	DEPENDING ON FACTION ALERT OTHER FACTIONS
else
	PrintToConsole "No Witnesses"
endif

end

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Edited by chris993
Link to comment
Share on other sites

Thanks

This is one of the first times I have attempted to make a mod to this extent. I have thought about it more and have some specific questions about it and scripting in FalloutNV:

 

1. Are there any issues around adding perks to dead NPCs? If they're are significant what other function would work?

2. Will it have a noticeable affect on performance especially if multiple occurrences are running?

3. Would running a quest script continuously to check if the player has made a successful stealth kill (then running the other script on the victim) have a noticeable affect on performance?

4. How do I reference the subject (victim) of the script as a parameter in functions like GetDetected?

5. Can CreateDetectionEvent be silent or does soundLevel determine its range?

6. Is there a quick way to add a script to every NPC without it conflicting with any existing scripts?

Edited by chris993
Link to comment
Share on other sites

1. Only the player can have perks. You can put your script on a token armor item and add it to the dead actor. Just create a new armor item, unplayable, with no biped slots and add the script to it.

2. Not unless you have dozens of dead bodies in the same cell as the player. The scripts won't be running on cells that aren't loaded.

3. No. This is the best way to do it in my opinion.

4. You are already doing a ref-walk for NPCs. A victim can be found by testing if (Witness.GetDead)

5. Don't know

6.

 if (Witness.GetDead)
   Witness.AddItem DeadGuyScriptToken 1
endif

 

Here's a quote from JE Sawyer on how perks work for companions (yet still the perk is added to the player):

 

 

There is an undocumented feature in F:NV that some modders may find useful. It is the ability to give perks to companions. Or, more accurately, it is the ability to add perks to a special list on the player that will have an effect on any active followers. Here's how it works:

player.addperk XXXXXXXXXXXXX 1

The "1" means "put this on the special list for companions". Companions will still not store/keep perks, but we give the player a second list of non-displayed perks that only apply to companions. If you want the effect to apply to all companions, you do not need to conditionalize the perk owner conditions for the perk's entry points. If you want the perk to be special for the companion, check the NPC's ID or ref in the perk owner conditions.

I recommend making special companion versions of perks even if you want to use existing effects. E.g. if you want to give Raul the equivalent of Shotgun Surgeon for some reason, make a special "RaulShotgunSurgeonPerk" that's filtered just to him, and add it to the player with player.addperk RaulShotgunSurgeonPerk 1 the first time Raul is hired. Even if Raul leaves the party, you shouldn't have to worry about the perk hanging out on the player as long as the perk owner conditions are filtered properly.

N.B.: The effects will ONLY work while a companion is in the party. So in the above scenario, Raul would no longer have the benefits of RaulShotgunSurgeon if he left the party. 



 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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