Research:Security and Crime

From OpenMW Wiki
Jump to navigation Jump to search

{{#switch:|subgroup|child=|none=|#default=

}}


Security[edit]

Actions affected On lockpicking and probing
Description Affects doors and containers.
Implementation status Implemented
Analysis status Verified

On picking a lock[edit]

<syntaxhighlight lang="python"> x = 0.2 * pcAgility + 0.1 * pcLuck + securitySkill x *= pickQuality * fatigueTerm x += fPickLockMult * lockStrength

if x <= 0: fail and report impossible roll 100, if roll <= x then open lock else report failure </syntaxhighlight>


On probing a trap[edit]

<syntaxhighlight lang="python"> x = 0.2 * pcAgility + 0.1 * pcLuck + securitySkill x += fTrapCostMult * trapSpellPoints x *= probeQuality * fatigueTerm

if x <= 0: fail and report impossible roll 100, if roll <= x then untrap else report failure </syntaxhighlight>

Pickpocketing[edit]

Actions affected On pickpocket (activate while sneaking)
Description
Implementation status Implemented
Analysis status Mechanic is broken and shouldn't be used as it is, but verified

Pickpocketing is a multi-stage process. Not all items in the NPC's inventory are available, depending on the initial rolls. There are checks on a steal attempt, and when the window is closed.


On initiating[edit]

<syntaxhighlight lang="python"> for each item stack:

   roll 100, stack is visible if roll <= pcSneak

</syntaxhighlight>


On picking an item[edit]

<syntaxhighlight lang="python"> fatigueTerm = fFatigueBase - fFatigueMult*(1 - normalisedFatigue)

  1. where normalisedFatigue is a function of fatigue. empty fatigue bar -> 0.0, full fatigue bar -> 1.0
  2. note fatigueTerm is normally 1.25 at full fatigue.
  1. checks the whole stack no matter how many you try to take
  2. note: filled soulgems have the value of an empty soulgem due to a missing calculation

stackValue = itemValue * itemsInStack valueTerm = 10 * fPickPocketMod * stackValue

x = (0.2 * pcAgility + 0.1 * pcLuck + pcSneak) * fatigueTerm y = (valueTerm + npcSneak + 0.2 * npcAgilityTerm + 0.1 * npcLuckTerm) * npcFatigueTerm t = x - y + x # yes, that is what it does

if t < pcSneak / iPickMinChance:

   roll 100, win if roll <= int(pcSneak / iPickMinChance)

else:

   t = min(iPickMaxChance, t)
   roll 100, win if roll <= int(t)

</syntaxhighlight>


On closing the pickpocket window[edit]

Same calculation as taking an item, but with valueTerm = 0.


Comments[edit]

The stealing process is highly broken for most items; any item or stack of items worth over 100 septims has such a negative result that it is picked at minimum chance, and this is at maximum all stats. A player with stats around 50 is picking at minimum for anything valuable. The available items window is not reset after every successful steal, only when you close the window and retry the pickpocket.

Bounties and Reporting[edit]

Bounties[edit]

Actions affected On being observed committing crimes
Description
Implementation status Implemented
Analysis status Being researched

<syntaxhighlight lang="python"> killing: iCrimeKilling assault: iCrimeAttack pickpocket: iCrimePickpocket trespass: iCrimeTrespass theft: fCrimeStealing * stack value werewolf transformation: iWerewolfBounty </syntaxhighlight>

Trespass includes activating, picking, and using Open magic on an owned door. Normal faction ownership rules apply.


NPC reactions[edit]

Actions affected On being observed committing crimes
Description
Implementation status Implemented with several differences
Analysis status Being researched.

<syntaxhighlight lang="python"> for each observer in the cell: # NPCs only, range unknown

   alarmTerm = 0.01 * observer.alarm
   if crime is killing:
       fightTerm, dispTerm = iFightKilling, iDispKilling
   if crime is assault, observed:
       fightTerm, dispTerm = iFightAttacking, iDispAttackMod
   if crime is assault, victim:
       fightTerm, dispTerm = iFightAttack, fDispAttacking
   if crime is theft:
       fightTerm, dispTerm = fFightStealing * stack value, fDispStealing * stack value
   if crime is pickpocket, observed:
       fightTerm, dispTerm = iFightPickpocket, fDispPickpocketMod
   if crime is pickpocket, victim:
       fightTerm, dispTerm = 4 * iFightPickpocket, fDispPickpocketMod
       if alarmTerm <= 0: alarmTerm = 1.0
   if crime is trespass:
       fightTerm, dispTerm = iFightTrespass, iDispTresspass
   if observer is not victim or observer.isGuard:
       dispTerm *= alarmTerm
   fightTerm += fFightDispMult * (50 - dispTerm)
   x = iFightDistanceBase - fFightDistanceMultiplier * distance(player, observer)
   fightTerm = alarmTerm * (fightTerm + x)
   if observer.fight + fightTerm > 100:
       fightTerm = 100 - observer.fight
   fightTerm = max(0, fightTerm)
   observer.fight += int(fightTerm)
   observer.disposition += int(dispTerm)
   - lots more crime system stuff occurs here -
   if (observer.alarm < 100 or not observer.isGuard) and observer.fight < 100:
       observer.fight is reset to the original value
       if observer is not victim: observer.disposition is reset to the original value

</syntaxhighlight>

Guard reactions[edit]

Actions affected Checked by "Guard" class NPCs every 1.0 seconds
Description
Implementation status Implemented
Analysis status Being researched

<syntaxhighlight lang="python"> if bounty >= iCrimeThreshold:

   if bounty >= iCrimeThreshold * iCrimeThresholdMultiplier:
       guards will immediately initiate combat and cannot be engaged in dialogue
   else:
       guards in range will run to the player and initiate dialogue

</syntaxhighlight>

Comments[edit]

Note that the crime level that prompts the "death warrant" dialogue from the guards (5000 gold) is coded through dialogue conditions, not here.

Thieves Guild reductions[edit]

Actions affected On initiating any dialogue
Description
Implementation status Implemented
Analysis status Verified

Interacts with dialogue through global script variables, which are set every time the player enters dialogue with an NPC.


CrimeGoldDiscount <syntaxhighlight lang="python"> if bounty == 0: CrimeGoldDiscount = 0 else: CrimeGoldDiscount = max(1, fCrimeGoldDiscountMult * bounty) </syntaxhighlight>

CrimeGoldTurnIn <syntaxhighlight lang="python"> if bounty == 0: CrimeGoldTurnIn = 0 else: CrimeGoldTurnIn = max(1, fCrimeGoldTurnInMult * bounty) </syntaxhighlight>

PCHasCrimeGold <syntaxhighlight lang="python"> PCHasCrimeGold = 1 if player can afford bounty (before any discount), 0 if not </syntaxhighlight>

PCHasGoldDiscount <syntaxhighlight lang="python"> PCHasGoldDiscount = 1 if player can afford bounty (with thief discount), 0 if not </syntaxhighlight>

PCHasTurnIn <syntaxhighlight lang="python"> PCHasTurnIn = 1 if player can afford bounty (with turn-in discount), 0 if not </syntaxhighlight>

Prison[edit]

Prison time is proportional to the bounty. Skills can be lost during time spent in prison, except Security which can improve.



{{#switch:|subgroup|child=|none=|#default=

}}