Stealth & Awareness

From Shadowrun Wiki
Jump to: navigation, search

Tested for Shadowrun Returns and DFDC

The hard-coded Stealth Test can be found in the ShadowrunAI script in Assembly-CSharp.dll (you can view it with dnSpy). The most relevant lines are

int num = this.CurrentAwareness(enemy);
 int num2 = 0;
 if (tile.IsOpaque)
 			{
 				num2 += 99;
 				break;
 			}
 			num2 += StatsUtil.getCoverStealth(tile.CoverType);
 int num3 = 0;
 int num4 = enemy.GetSkill(Skill.Skill_Stealth, false) * 5 - num3 + num2 * 4;
 return num > num4;

And Covertype is

public static int getCoverStealth(StatsUtil.Cover curCover)
 	{
 		switch (curCover)
 		{
 		case StatsUtil.Cover.NONE:
 			return 0;
 		case StatsUtil.Cover.LIGHT:
 			return 1;
 		case StatsUtil.Cover.IN_LIGHT:
 		case StatsUtil.Cover.MED:
 			return 2;
 		default:
 			return 3;
 		}
 	}


This test is used in the CanAISeeTarget function also in the ShadowrunAI script. If Stealth test is true AND the target is in the line of sight cone and vision distance (default for low and high alert states is 18 tiles) then AI can see the target. If the alert state is RED, the stealth test returns true automatically. If the target is in an opaque tile for the beholder, it is an automatic false.

It compares the result of the "enemy's" stealth test num4 against the beholder's current awareness num. Awareness (ranging from 0 to 99) was implemented in the game, and is greater if there is an alarm state. If num is greater than num4 then it returns true (the beholder suceeded in the stealth test, or, conversely, the target failed).

"enemy", in this case, is any target perceived as hostile in a character's line of sight (it could be a shadowrunner in a guard's line of sight. I point out here that there IS a stealth skill. It just never made it to the final version of the game as something you could spend karma on. Default value in isogame.Skills for stealth skill is 0. Guess everybody ended up with zero stealth. Too bad it has a weight of 5 in calculating num4

Cover type DOES give you extra stealth, however. The numbers in the StatsUtil script are:

No cover: 0 Light cover: 1 Medium cover: 2 Otherwise (heavy cover): 3

So you could have up to 12 (4 x 3) bonus from cover. I assume the in light/in darkness aspect also never made the cut to the final version.

In SRR by default if there are enemies in the map it will start in turn-based mode unless line-of-sight turn mode is enabled. That's OK if you don't want to mess with "Player Menu" triggers that enter and exit manual turn mode. Mind you, the Player Menu is still useful when you want to ambush enemies that you know to be behind a door.

The Problem[edit | edit source]

SRR and Dragonfall never implemented the possibility of entering turn mode at will when turn mode is line-of-sight enabled, so you ALWAYS get ambushed by enemies unless you get a dialog option to attack them first. SRHK at last gave us the option to start combat first. Another problem is that in freemove you don't control the position of your three sidekicks, so even with Player0 having cover bonus your teammates will be spotted if they are not behind cover. Riggers must keep their drones behind cover too! Until now, I guess nobody knew that you COULD get stealth bonus from cover, since the default awareness of 75 always gets you spotted as the max cover bonus is just 12.

The Solution[edit | edit source]

The default awareness for characters in the editor is 75, which is much bigger than the max heavy cover stealth bonus 12. Well, when building your campaign set the guard's awareness to:

11 if only heavy cover will hide you from him. 7 if medium and heavy cover will hide you from him. 3 if all three types of cover will hide you from him. With zero awareness he won't see you at all.

Line-of-Sight Combat OFF (game default)[edit | edit source]

And that's all you need if you are not going to use line-of-sight combat enter. The scene will start in turn-based mode if hostiles are present and stay in it unless you neutralise all of them. Remember that all shadowrunners and their drones must be BEHIND cover (butts sticking out from corners will be spotted when flanked by guards). Enemies will attack you if you either attack a visible enemy (just ready a weapon and click on him, the red target disk will be there) or if someone is spotted.

Line-of-Sight Combat ON[edit | edit source]

If you are going to use line-of-sight only combat and don't want to be ambushed all the time, you need the Player Menu (on-actor-click dialog; you can see it work in "A Stitch in Time" for example) to enter and exit turn mode and be able to attack first, otherwise your three hirelings or drones will accidentally walk in front of an enemy's line of sight since you only control their movement in turn-based mode.

Vision Cone (DFDC)[edit | edit source]

In the DFDC Editor you can also change the actors' and player's Attributes Vision Peripheral (not sure how it changes anything), Vision Cone (vision distance in tiles, default 18) and Vision Angle (how wide is the cone, default 90 degrees) in both Character Editor and Do > Actors > Set Actor Base Attribute. You can also build items that add bonus to them. The attribute name for vision distance is Attribute_Vision_Cone_Distance.

Using the Stealth Skill[edit | edit source]

Skill_Stealth exists in the game code, but it's default 0 for all characters. It did not make the cut to the final version of the game (along with some other skills), so you can't either spend karma on it or change it in the Character Editor or Trigger Editor. However, you can do so via items (outfits, cyberware etc) just as you would give a bonus to any other skill. Effectively, each point of stealth gives a penalty of 5 to enemy awareness during the Stealth Test. In this case, actors with awareness of 5 and below will never see an actor of stealth 1 unless it's red alert (not recommended due to weirdness). An actor with awareness 7 won't spot an actor of stealth 1 behind light cover (or greater) but will spot him in the open (effectively they will have awareness 7 − 5 = 2 during the Stealth Test). Remove the stealth bonus and the mechanics will return to bonus from cover only.

This is an outfit item that grants Stealth +1 and Vision Distance +5 bonuses:

id: "Player_NightOps"
 type: ItemType_Outfit
 uirep {
   icon: "icon_outfit_riggerflightsuit"
   name: "Milspec Camo Suit with Goggles"
   description: "Includes Vision Enhancement Goggles. Grants Vison Cone Range +5 and Stealth +1"
 }
 equippedStatusEffects {
   statMods {
     attribute: Attribute_Armor
     intModValue: 2
   }
   statMods {
     attribute: Attribute_Vision_Cone_Distance
     intModValue: 5
   }
   statMods {
     skill: Skill_Stealth
     intModValue: 1
   }
 }
 gear_bundle: "outfitriggerflightsuit"
 outfit_texture: "rigger_flightsuit"
 gear_prefab: "gear_rigger_flightsuit"
 gear_covers_arms: true
 gear_covers_hair: false
 store_cost: 750
 sorting_group: "Player Outfits" 

Perception[edit | edit source]

Quoting the developer Chris Kohnert:

"Assuming the guard sees you, he must then make what we're calling a "perception" check (i.e. "What do I notice about him?"). This is where the non-combat elements of the game start to come into play. For example, if you've managed to procure a guard's uniform, he may take a look at you and decide you aren't a threat. Though, that uniform may not do you any good if you're carrying a couple of assault rifles when the standard issue weapon is a pistol. (Yes, we actually model that level of sophistication! Though whether it gets into the final game is based on how much fun it winds up being. . .)"

From a quick check of the ShadowrunAI and ThreatRecord scripts:

AI perception can be set to Normal, Smart or Dim. That will affect how that hostile might decide you are Suspicious, Neutral or Friend

Teams, valid scene disguises and the credentials element come into play. Quest items can give credentials to player characters in the quest item creation sheet.

Unholstered weapons will raise suspicion unless social allow drawn weapons is true.

Alarm state on also raises suspicion.

If the hostile was attacked his threat perception will obviously increase, and also if he saw a friendly being attacked or die.

If the hostile had heard gunfire he may be more likely to be suspicious.