Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Time Capsule (How-to Library) » "How does it work?" Part 8: Skill Checks
"How does it work?" Part 8: Skill Checks[message #198518]
|
Wed, 08 October 2008 15:40
|
|
Headrock |
|
Messages:1760
Registered:March 2006 Location: Jerusalem |
|
|
GENERAL SKILL CHECKS[/b]</font>
While our skills and attributes are used in a ton of different places in the code, some of the most basic actions we perform often require a skill check. Stuff like picking a lock, or planting a bomb, requires us to test our skills and see if we were successful.
This article discusses those Skill Checks and the circumstances in which they occur. Once again, the article will use Pseudo-Code, a rough translation from computer language to plain English (ok, as plain English as I can manage). You do not need to have any background in programming to understand this. A high-school education will be enough
---------------------------------
Skill checks are very simple procedures, and they are all very similar to one another in terms of the calculation. Still, they fall into two main groups:
A) Skills involved in interaction with a locked door
Skills... not involved in interaction with a locked door
But before we actually see which skill checks the game contains, let's explain what a skill check is, and how it's calculated.
The SkillCheck function will test a certain "grouping" of one or more skills, for the purpose of determining whether an action is a success or a failure. We tell the function which ACTION we want to undertake, and it will run the calculations based on a different set of skills for each function. We also tell the function how difficult the action is, based on external parameters, and that will figure into the final result.
When the function is done calculating our required skills (a number called your "BASE_CHANCE" of success), it will roll a random number between 0 and 99, and compare it to the BASE_CHANCE. It subtracts the random number from the BASE_CHANCE value, and returns the result to whatever part of the code called for a skill check. That part of the code later determines whether the result was good enough for us to succeed in the action. Most actions require a result of 0 or more to succeed, while some allow a "partial" success with results that are less than 0. But 0 is seen as the minimum for a "full success" in carrying out the action.
Let's examine the basic structure of the skillcheck function. Later on, when we look at the actions themselves, we'll see get more specific details on how each action works.
<div class="pre][pre]
SKILLCHECK FUNCTION
-------------------
1. Calculate a BASE_CHANCE which is based on a certain set of skills. Each action requires a different combination of skills.
2. Apply a penalty to BASE_CHANCE due to fatigue
3. Apply an "external modifier" to BASE_CHANCE, which we provide depending on the action we're trying to perform.
4. Some types of skill checks are harder, and for them we do this:
If by now BASE_CHANCE is still less than 30, there's no chance to fulfill the action (BASE_CHANCE=0). This makes some actions impossible to perform by amateurs. If this happens, ignore step 5 (morale modifier).
5. Apply a modifier to BASE_CHANCE based on our merc's morale.
6. Make sure BASE_CHANCE is somewhere between 0 and 99.
7. Finally, roll a random number between 0 and 99.
8. Subtract RANDOM_NUMBER from BASE_CHANCE, and return the result
[/code]
Again, several parts of this formula will change based on the circumstances and the spcific action we're doing. The basis should be clear enough though.
---------------------------------
<font size="">DOOR-INTERACTION SKILL CHECKS
I guess the best place to start would be doors and containers. Both are handled in exactly the same way, so for this entire article a "DOOR" is interchangeable with a "CONTAINER" of any sort.
---------------------------------
DETECTING TRAPS ON FIRST ENCOUNTER WITH A DOOR
First off, there's a basic algorithm that decides whether we have any special occurances when approaching the door. If the door is closed, unlocked and untrapped, it will simply be opened. Otherwise, if the door is trapped, the program will determine whether or not we notice that trap. Note, this code runs when our character reaches the door (after being ordered to open it!), but before they actually try to open it. It really only determines whether we should get the "door interaction" menu, or open the door immediately, or notify us of a trap.
If Door is Opened, then
If Door is Trapped and the player hasn't yet spotted (or failed to spot) this trap in the past, then
If Trap_Detection >= Trap_Level, then
Notify player about a trap!
If Player failed to find trap (or no trap there), then
Pull up Door-Interaction menu (to close the door)
Else
Close the door automatically.
If Door is Closed, then
If Door is Locked, then
If Door is Trapped and the player hasn't yet spotted (or failed to spot) this trap in the past, then
If Trap_Detection >= Trap_Level, then
Notify player about a trap!
If Player failed to find trap (or no trap there), then
If we're in "auto-bandage" mode, then
Attempt to unlock this door automatically.
Else
Pull up Door-Interaction menu
Else (trap found)
Do nothing.
Else (Door unlocked)
Open the door automatically.
What this basically does is to determine whether the door is locked or trapped. Unlocked doors will be opened automatically, and locked doors will bring up a menu. If a trap is present and the player hasn't yet found (or missed) that trap earlier, the program checks to see if the trap's spotted now - if so, it'll say a quote to warn you, and you have to click the door again to interact with it further. I'm not sure how a door can be trapped if it's already open, but apparently the code knows how to handle this. I'm not sure what exactly happens in Autobandange mode either - what happens if the character fails to unlock the door? What happens if they unlock a trapped door? I have no idea, I don't think either of these things have ever happened to me.
Also note that if the first character who approached the door does NOT notice the trap, then no one else will, until you actually EXAMINE THE DOOR FOR TRAPS (or, trigger the trap accidentally).
----------------------------------------------
NOTICING TRAPPED DOORS
This is the skill check that's triggered when a character attempts to interact with a trapped door or container. The result here is compared against the trap level to determine whether the trap has been detected (see above). The same exact calculation will run when we're actually looking for traps (more about that later).
Please note that this is NOT a regular skill check, it's a special check which is used only for trap detection. That's why it's not similar to the formula of skill checks outlined earlier in this article.
Experience_Bonus = Merc's_Effective_Experience_Level
Explosives_Bonus = Merc's_Effective_Explosives_Skill / 40
Wisdom_Penalty = (100 - Merc's_Effective_Wisdom) / 20
Detection_Level = Experience_Bonus + Explosives_Bonus - Wisdom_Penalty
The detection level is based mainly on the character's effective experience level. It is then increased by 1 point for every 40 levels of the Explosives skill, and finally reduced by 1 point for every 20 points of wisdom below 100.
So, starting with our Experience Level as a base value, Explosives level 40 gives us a +1 bonus; Explosives 80 gives us a +2 bonus; Wisdom 80 gives us -1; Wisdom 20 gives us -4.
Trap detection level can go as high as 12 (10 experience level, plus 2 points for explosive skill of 80 or higher, and no penalty for wisdom 81 or higher).
"Effective" here means that the skill check also takes into account the character's drunkness. I've explained drunkness in previous articles, but to sum it up, if you're really plastered you get 50% less "effective" skill than your actual merc's skill (As displayed on the merc's profile). There are 4 levels of drunkness, from Sober to Drunk, and a fifth level called "Hung-over". Simply put, don't handle explosives while drunk, kids.
Effective_Experience_Level is also affected by other, more esoteric occurances, having to do with the character's personality quirks. For instance, claustrophobic characters will get a -1 Experience Level penalty in underground sectors.
If we're LOOKING FOR TRAPS, then
Maximum_Random_Bonus = (Detection_Level / 3) + 1
Random_Bonus = any number between 0 and Maximum_Random_Bonus
Detection_Level is increased by Random_Bonus
"Looking for traps" means that we've selected the option to look for traps in the door interaction menu (that's the magnifying glass icon). It uses this same calculation, as we'll see later on in this article. Looking for traps may add a certain bonus to our Detection_Level, but doesn't always.
If Merc has more than 20 points of bleeding wounds, or is in shock (from being hit), then
Random_Penalty = any number between 0 and 2
Detection_Level is decreased by Random_Penalty
Characters who are seriously wounded, or still suffering from shock of being hit in combat, may receive a penalty to their trap detection level. Note that injuries here pertain only to UNBANDAGED wounds.
If Detection_Level < 1, then
Detection_Level = 1
Nice. If the trap level is 1 (a lousy trap), then anyone will be able to detect it!
------------------------------
Let's move on to the Door Interaction menu. We've got several options for interaction with doors:
- We can try to open it.
- We can try to close it.
- We can examine for traps
- We can try to disarm traps (whether we know a trap is there or not)
- We can try to pick the lock
- We can try to lock the door
- We can try to use a key
- We can blast the door open with a shaped charge
- We can kick the door open
- We can pry the door open with a crowbar
-----------------------------
EXAMINING A DOOR FOR TRAPS
We'll start with this, because we've already covered some of the concepts, so it'll be simpler.
If Door is Trapped, then
If Detect_Level < Trap_Level, then
Tell player that the door is untrapped.
Else
Tell player that the door is trapped, and what type of trap it is.
Very simple. The "Detect_Level" is calculated the same as explained above, with Experience Level, Explosives Skill and Wisdom playing the most important parts. Note that you may get a small bonus to your detect level because you're specifically searching for traps. For more on this, read the formula two sections up. You'll also notice that if you examine for traps, the game will tell you what type of trap this is. If the sector is clear of enemies, you can go ahead and open any siren-trapped doors.
----------------------------
DISARMING TRAPS
This section deals with disarming traps on DOORS. Disarming mines and planted bombs is handled a bit differently (we'll get to that later).
PLEASE NOTE: Any attempt to disarm a door will automatically detect the trap (if there is one), regardless of whether or not it has actually been detected previously. So if you think you've failed to discover a trap, have your explosives expert try to disarm anyway.
If Trap_Type is EXPLOSIVE, then
Result = DISARM_TRAP_CHECK with a modifier of (7 * Trap_Level)
Else
Result = DISARM_ELECTRONIC_TRAP_CHECK with a modifier of (7 * Trap_Level)
If Result >= 0, then
Remove trap.
Else
Activate trap.
If Trap is set to trigger only once, then
Remove trap.
Please note that there's something wrong here, but I'll explain it in a minute. This is just the basic algorithm, we're going to want to see how the disarm check itself actually goes.
This is a true SKILL CHECK, and uses the SKILL CHECK calculation that was outlined earlier in this article.
DISARM_TRAP AND ELECTRONIC_TRAP SKILL CHECK
-------------------------------------
If DISARM_TRAP_CHECK (a regular, explosive trap), then
Explosives_Bonus = Merc's_Effective_Explosives_Skill * 7
Experience_Bonus = Merc's_Effective_Experience_LeveL * 10
Base_Chance = Explosives_Bonus + Experience_Bonus
Base_Chance is divided by 10
Wisdom_Penalty = (100 - Merc's_Effective_Wisdom) / 5
Base_Chance is reduced by Wisdom_Penalty
If Explosives_Bonus = 0, then
Base_Chance = 0
If DISARM_ELECTRONIC_TRAP_CHECK (Siren and electric traps), then
Skill_Bonus = Merc's_Effective_Mechanical_Skill, OR Merc's_Effective_Explosives_Skill, whichever is higher!
Skill_Bonus multiplied by 7
Dexterity_Bonus = Merc's_Effective_Dexterity * 2
Experience_Bonus = Merc's_Effective_Experience_Level * 10
Base_Chance = Skill_Bonus + Dexterity_Bonus + Experience_Bonus
Base_Chance is divided by 10
Wisdom_Penalty = (100 - Merc's_Effective_Wisdom) / 5
Base_Chance is reduced by Wisdom_Penalty
If Merc doesn't have the ELECTRONICS trait, then
Base_Chance is reduced by 25%
If Skill_Bonus = 0, then
Base_Chance = 0
Calculate Fatigue Penalty (read about this later)
Base_Chance is reduced by Fatigue Penalty
Base_Chance is increased by the External_Modifier (in both cases, it equals Trap_Level * 7)
Calculate Morale Modifier (read about this later)
Base_Chance is modified by Morale_Modifier
If Base_Chance > 99, then
Base_Chance = 99
If Base_Chance < 0, then
Base_Chance = 0
Random_Number = anywhere between 0 and 99
Result = Base_Chance - Random_Number
It's not a terribly complicated formula, although there's a little surprise there.
Basically, disarming an explosive trap requires good explosives skill, experience level, and Wisdom. Without an explosives skill, your chance will be a big fat 0.
Electronic traps are a bit easier to disarm because you can use either a high explosives skill or a high mechanical skill, and dexterity also helps you. Of course, without the ELECTRONICS trait, you suffer a 25% penalty to your chance. If you have 0 mechanical skill and 0 explosives skill, you will fail an electronic trap check automatically.
As to Fatigue and Morale modifiers, they will be calculated every time we run a skill check, so I'll cover them here. They are similar to the modifiers used when firing weapons (explained in my previous articles).
Fatigue_Penalty is based on your current stamina (the blue bar)
- If Stamina is between 85 and 100, then Fatigue_Penalty = 0
- If Stamina is between 70 and 84, then Fatigue_Penalty = 10
- If Stamina is between 50 and 69, then Fatigue_Penalty = 25
- If Stamina is between 30 and 49, then Fatigue_Penalty = 50
- If Stamina is between 15 and 29, then Fatigue_Penalty = 75
- If Stamina is between 1 and 14, then Fatigue_Penalty = 90 (but you're probably passed out, anyway)
- If Stamina is 0, then Fatigue_Penalty = 100 (you're out cold)
Naturally, the higher your fatigue penalty, the worse.
Let's see how this is calculated against our skill:
Fatigue_Penalty = ((Base_Chance * Fatigue_Penalty) / 100) / 2
Base_Chance is reduced by Fatigue_Penalty
Now let's have a look at morale modifiers:
If Merc's_Morale is greater than 50, then
Morale_Modifier = (Merc's_Morale - 45) / 10
else
Morale_Modifier = ( (Merc's Morale - 50) * 2) / 5
Not difficult maths. The result is that at 55 morale you get a +1 bonus, and another +1 for every 10 points of morale above that. Conversely, as your morale drops, you get -1 penalty for every 2-3 morale points below 50. This is applied DIRECTLY to your Base_Chance for the skill check.
Now remember I was talking about a surprise? It has to do with the External_Modifier we applied much earlier. Let's remind you:
Base_Chance is increased by the External_Modifier (in both cases, it equals Trap_Level * 7)
The modifier is 7 times the Trap's Difficulty Level. The weird thing is, this modifier acts as a BONUS to your skill check! So in fact, the higher the level of the trap, the EASIER it is to disarm! It's completely ridiculous!!! Baaaaaad programming! I need a drink.
---------------------------------
LOCKPICKING
Another fine formula which I'm sure you'll all be interested in. Also far simpler than disarming.
If Lock can't be picked
Automatic failure
If Lock_Type = Keycard or Electronic lock, then
Result = ELECTRONIC_LOCKPICKING_CHECK with an external modifier of (-1) * Lock_Difficulty
Else
Result = LOCKPICKING_CHECK with an external modifier of (-1) * Lock_Difficulty
If Result >= 0, then
Lock is picked!
Open the door automatically.
Now let's have a look at the skill check itself. It's very similar to disarming. No surprises here though, external modifier will be a penalty as it should be.
Mechanical_Bonus = Merc's_Effective_Mechanical_Skill
Wisdom_Bonus = ( Merc's_Effective_Wisdom + 100 ) / 200
Dexterity_Bonus = ( Merc's_Effective_Dexterity + 100 ) / 200
Experience_Bonus = Merc's Effective_Experience_LeveL * 3
Base_Chance = ( Mechanical_Bonus * Wisdom_Bonus * Dexterity_Bonus ) + Experience_Bonus
First off, we see that the Mechanical skill is the most important one here. We use it as a base for the rest of the calculation. Without any mechanical skill, you simply cannot pick locks.
Dexterity and Wisdom serve as multipliers. Simply put, if you have 50 wisdom, you get a 25% reduction to your chance. At 100 wisdom, the chance is untouched. Funny, but at 0 wisdom you get only a 50% reduction to your chance, so you can still pick locks if your merc is a complete idiot. Same goes for Dexterity. Experience level also helps - each level will add 3 points to your chance, up to a maximum of 30 points (EXP level 10).
If Merc has the LOCKPICKING trait, then
Base_Chance is increased by 25 for each level of the LOCKPICKING trait
If Lock is an electronic lock or Keycard lock, then
If Character does not have the ELECTRONICS skill, then
Base_Chance is reduced by 50%!
The lockpicking trait helps to defeat any lock. It will add 25 points to your chance, and if you're an expert at lockpicking you get a cool 50 points. That's really really helpful.
If the lock is electronic, however, you absolutely must have the Electronics trait, otherwise your chance is cut by 50%!
If Merc doesn't have a lockpick, then
Base_Chance = 0
Else
Base_Chance is multiplied by Lockpick's_Condition / 100
Unlike disarming, lockpicking requires a tool - your trusty lockpick or similar item (in 1.13, utility knives can do it too). The condition of the item serves as a direct percentage modifier to your chance, so keep your lockpick in good condition!!
If Mechanical_Bonus = 0, then
Base_Chance = 0.
Just making sure you have some mechanical skill. Otherwise, forget about it.
Calculate Fatigue_Penalty (Explained earlier in this article)
Base_Chance is reduced by Fatigue_Penalty
Fatigue penalty applies here (it's explained in the Disarming section of this article). However, morale does not affect lockpicking.
Base_Chance is reduced by External_Modifier, which is (-1) * Lock Difficulty
The external modifier here is (-1) * Lock Difficulty, which means that the harder the lock, the harder it will be to pick. Lock difficulty can be anywhere between 1 and 100, I think. A lock with 100 difficulty can only be opened by a merc with 100 mechanical, 100 wisdom, 100 dexterity, and experience level 10, which gives you a total Base_Chance of 130. That's because you need a Base_Chance that's at least 30 points higher than the lock's difficulty, if you want to have any sort of chance to pick this lock (read the next line).
If Base_Chance < 30, then
Base_Chance = 0
If your chance by now is less than 30%, you will automatically fail. This is done to prevent amateurs from picking complicated locks by sheer chance.
Calculate Morale Modifier (read about this later)
Base_Chance is modified by Morale_Modifier
if Base_Chance > 99, then
Base_Chance = 99
Random_Number = anywhere between 0 and 99
Result = Base_Chance - Random_Number
Finally, we add a morale modifier, make sure that the chance is within the boundaries, and then roll a random number against it. If the result is 0 or more, the lock will be picked!
------------------------------
BLOWING A DOOR OPEN WITH A SHAPED CHARGE
Way more fun than lockpicking. The algorithm is, again, relatively simple.
If Merc doesn't have a Shaped-Charge, then
Failure. Duh.
Naturally, you're going to need a shaped charge. Some MODs (like UC, if I remember correctly) made any bomb useable as a shaped charge. So it doesn't really matter what item you use, as long as it's flagged as a "SHAPED-CHARGE" in items.xml. Naturally, if the item isn't an explosive, the whole thing will fail miserably, probably with a crash to desktop. But modders are advised to watch out for these things anyway.
Result = PLANTING_BOMB_CHECK. No external modifier.
The skill check is done with no special modifiers.
If Result >= -20, then
Current_Lock_Damage increased by (Explosion_Strength * 2)
If Current_Lock_Damage is greater than Lock's_Damage_Capacity, then
Lock is blown open!
Else
Merc is blown open! Whoops!
The result needs to be anything more than -20, which is makes this easier and safer than regular bomb-planting.
The damage dealt to the lock equals twice the amount of damage this bomb would do to a person (if it can be used as a regular explosive at all... in 1.13 Shaped Charges can only be placed on doors anyway).
A lock can only tolerate so much damage, and if the explosion (plus any previous damage to this lock) has already exceeded the lock's resilience, then the lock is blown open.
If the skill check returned a result of -21 or less, then the explosive goes off prematurely, injuring the merc instead. In this case, it triggers a regular explosion of the item, with regular damage values, and can potentially also hurt other mercs in the vicinity (based on the properties of the explosive item).
Now let's have a look at the skill check itself. Note that this is the same skill check used for planting explosives anywhere else, except we can get a result of down to -20 and still succeed in blowing the lock. Please note that the same skill check will later be used for planting explosives anywhere, not just on doors. We'll get to that later.
Explosives_Bonus = Merc's_Effective_Explosives_Skill * 7
Wisdom_Bonus = Merc's_Effective_Wisdom * 2
Experience_Bonus = Merc's_Effective_Experience_Level * 10
Base_Chance = (Explosives_Bonus + Wisdom_Bonus + Experience_Bonus) / 10
So far so good. Explosives skill is the most important factor (7/10 of the final result), followed by wisdom, and finally experience level (1 point of chance per experience level). But the numbers make it so that most mercs would find it pretty hard to plant a bomb without having a very good chance of blowing themselves up, so novice demolitionists would be blown to bits way too often. To fix this, the program "skews" the values a bit with this complicated calculation:
Base_Chance = (Base_Chance + 100 * (Base_Chance / 25) ) / (Base_Chance / 25 + 1)
Don't ask me how this works, it's too messy for me. But the result is that we get some bonus to our chance. If the Base_Chance was average (around 50), we get a whopping 30 point bonus. The higher base_Chance goes above or below that, the less bonus we get. The lower it goes, the less bonus we get, so at 22 Base_Chance we receive no bonus. At least that's what the comments in the code say. Apparently, some mercs are just too stupid to plant a bomb correctly.
Calculate Fatigue_Penalty
Base_Chance is reduced by Fatigue Penalty
Explained earlier in this article.
Base_Chance is increased by External_Modifier...
Which is 0 at the moment. Ok, no worries.
Calculate Morale_Modifier
Base_Chance is modified by Morale_Modifier
Explained earlier in this article.
If Chance > 99, then
Chance = 99
If Chance < 0, then
Chance = 0
Staying within the acceptable boundaries.
Random_Number = anywhere between 0 and 99
Result = Base_Chance - Random_Number
Remember, we need at least -20 here! Sounds pretty damn easy. I doubt anyone could fail planting a shaped-charge, even if they tried to fail. Just kidding, it's still dangerous, so watch out.
--------------------------------
USE THE FORCE, LUKE
Well, you don't actually have to use the force, kicking the door down would also work, in case you don't have enough midi-cholera or whatever. Once again, the procedure is very simple.
Make some noise, regardless of success.
If no lock exists, or door is unlocked, then
Automatically open the door and make it unlockable in the future. No need for further calculations
If Lock cannot be broken, then
Abort this attempt. It's an automatic failure. No need for further calculations.
Result = SMASH_DOOR_CHECK, with an external modifier of (-1) * ( Lock's_Smash_Difficulty - Current_Lock_Damage )
If Result >= 0, then
Success!
If Result is between -10 and -1, then
Current_Lock_Damage is increased by (10 + Result)
If Result is between -40 and -11, then
Failure, but award a tiny bit of experience in the STRENGTH attribute
Else (Result =< -40)
You're just a failure.
Pretty simple, we make all the usual checks, including a skill check with an interesting External_Modifier. The harder the lock, the
more difficult it will be to kick open, although any damage the lock has already sustained will help offset this penalty.
Finally, we see that a positive result will break the lock, but if we get a result of just below 0, we'll still make some lock damage (anywhere between 1 and 10 lock damage, depending on how badly we failed our skill check). Anything below that is a failure, although if we got more than -40 we still get a token chance to increase our strength, as a consolation prize.
Please note that damage to the lock helps, so if you've hit the lock but didn't break open the door (the game will say "LOCK HIT"), the next attempt will be somewhat easier.
Now the skill check:
Base_Chance = Merc's_Effective_Strength
Calculate Fatigue_Penalty
Base_Chance is reduced by Fatigue_Penalty
Base_Chance is reduced by the External_Modifier, which equals (-1) * ( Lock's_Smashing_Difficulty - Current_Lock_Damage )
If Chance < 30, then
Chance = 0
Calculate Morale_Modifier
Base_Chance is modified by Morale_Modifier
If Chance > 99, then
Chance = 0
Random Number = anywhere between 0 and 99
Result = Base_Chance - Random_Number
I wish they were all this simple! Would save me a ton of typing!
In any case, you can see that it's basically Strength that decides our success rate. However, if you fail to reach a Base_Chance of 30 by the end of the formula, you'll get 0 chance, just like with lockpicking. Of course, remember that we can accept down to -10 result here, as that will still damage the lock and make the next kick more likely to succeed.
PLEASE NOTE: A merc's "Effective Strength" is calculated differently from other "Effective" skills. Strength is not altered by drunkness, but it DOES depend on your character's current health. Any bandaged and non-bandaged damage to your character will reduce your effective strength. The maximum which can be reduced is about 50% strength, when you're just barely alive.
--------------------------------------
PRYING A LOCK OPEN (AKA THE "CARRY A BIG STICK" APPROACH)
As you'll see, the Crowbar formula is strikingly similar to kicking in a door. Of course, it wouldn't be the crowbar formula without some big nasty item to help you out.
If no crowbar is found, then
Forget it, you shouldn't even be running this formula!
Make some noise, regardless of success or failure.
If no lock exists, or door is unlocked, then
Automatically open the door and make it unlockable in the future. No need for further calculations
If Lock cannot be broken, then
Abort this attempt. It's an automatic failure. No need for further calculations.
Metal_Fatigue = Merc's_Effective_Strength, OR ( Lock's_Smashing_Difficulty + 30 ), whichever is LOWEST
Random_Number = Anywhere between 1 and Metal_Fatigue.
Do damage to the crowbar, equalling Metal_Fatigue
Result = OPEN_WITH_CROWBAR Skill check, with an external_Modifier of (-1) * ( Lock's_Smashing_Difficulty - Current_Lock_Damage )
If Result >= 0, then
Break the lock.
If Result is between -10 and -1, then
Current_Lock_Damage is increased by (10 + Result)
If Result is between -40 and -11, then
Failure, but award a tiny bit of experience in the STRENGTH attribute
Else (Result =< -40)
You're just a failure.
Almost the same as kicking a door down. You'll notice that some damage will be done to the crowbar before we even check for success. If the merc is weaker, less damage will be done to the crowbar, but then you have less chance of breaking the lock . Also, lock difficulty may affect how much damage is done.
Finally, like with kicking doors, a result between -10 and -1 will still allow us to damage the lock, making it easier to pry in our next attempt.
Skill check:
Base_Chance = Merc's_Effective_Strength + 20
... blah blah blah same thing as kicking down a door, I'm not going to repeat it all over again. The difference should already be obvious.
Apparently, all a crowbar does is add a flat +20 bonus to your base chance. Nothing more, nothing less. The crowbar's condition doesn't even matter. If it's still a piece of metal, however twisted it might be, you can still pry locks with it. Everything else is EXACTLY the same as the Door Kicking skill check.
Again, remember that Effective Strength doesn't rely on drunkness level, but rather on how healthy your character is compared to his maximum health (I.E. any damage and bandaged damage will count against your effective strength).
---------------------------
UNLOCK DOOR
Ok, it looks through your inventory and your keychain, and if it finds the right key it unlocks the door. Seriously, what did you expect, complex formulae? Ok, yeah, I expected something more interesting here, but seriously, that's all it does.
---------------------------
LOCK DOOR
It's... The same.
---------------------------
TAMPERING WITH A DOOR
Part of the door handling formula deals with any attempt to open a door that may trigger a trap inadvertantly. This only happens if:
A) The player isn't examining the door for traps. That can't trigger the trap, it seems.
The player isn't disarming a trap. You can blow the trap if you fail the disarm check, but that's irrelevant here.
C) The player isn't unlocking the door. If you've got a key, the trap doesn't trigger.
So basically, any attempt to open a trapped lock without first disarming it may end up in an explosion. The program will check whether we notice a trap in the last second though. Note that this part of the function runs BEFORE we get a chance to do whatever it was we wanted to do to the door.
If Door is Locked and has a Trap on it, then
We assume that everything beyond this point answers to this condition, obviously.
Calculate Merc's_Trap_Detection_Level
We did this very early in this article when approaching a door for the first time. See the section at the top of this thread called "NOTICING TRAPPED DOORS".
If Merc's_Trap_Detection_Level < Trap's_Difficulty, then
KABOOOOOOMMMMMMMM! ... Or, WEEOOOOWEEEOOOOWEEEOOOO well whatever the trap's supposed to do. In other words, set the trap off.
Stop our Merc from executing whatever he was trying to do to the door.
If the trap is supposed to go off only once, then
Disable the trap
Else (succeeded in trap detection)
If we didn't know there was a trap here already (or failed to find one by examining the door...), then
Notify the player that this door is trapped.
Else (You already know the lock is trapped)
KAAAAABOOOOOOOOOOOOOOOOOOOOOOOOMMMMMMMM. The game assumes you were trying to set the trap off intentionally.
Stop our Merc from executing whatever he was trying to do to the door.
If the trap is supposed to go off only once, then
Disable the trap
So basically, watch out - if a merc's already spotted a trap on this door earlier, you're not going to get a second warning... Try to lockpick the door or something similar, and the trap WILL trigger. This also happens if the merc who previously checked the door failed to find the trap, and so you got careless and your merc is now getting blown to bits.
--------------------------------------------------------------------------------------------------------
(Continued in next post...)
[Updated on: Mon, 27 April 2015 23:46] by Moderator Report message to a moderator
|
|
|
|
|
|
"How does it work?" Part 8: Skill Checks
By: Headrock on Wed, 08 October 2008 15:40
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Wed, 08 October 2008 15:42
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Panpiper on Wed, 08 October 2008 16:40
|
|
|
Re: "How does it work?" Part 8: Skill Checks
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Wed, 08 October 2008 16:56
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: cdunigan on Wed, 08 October 2008 17:31
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Wed, 08 October 2008 19:13
|
|
|
Re: "How does it work?" Part 8: Skill Checks
|
|
|
Re: "How does it work?" Part 8: Skill Checks
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Wed, 24 December 2008 07:32
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Kaerar on Wed, 24 December 2008 08:09
|
|
|
Re: "How does it work?" Part 8: Skill Checks
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Kaerar on Thu, 25 December 2008 12:33
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Thu, 25 December 2008 15:05
|
|
|
Re: "How does it work?" Part 8: Skill Checks
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Thu, 25 December 2008 16:59
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: BirdFlu on Thu, 25 December 2008 20:26
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: Headrock on Fri, 26 December 2008 01:53
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: BirdFlu on Fri, 26 December 2008 02:54
|
|
|
Re: "How does it work?" Part 8: Skill Checks
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: BirdFlu on Fri, 26 December 2008 12:12
|
|
|
Re: "How does it work?" Part 8: Skill Checks
By: BirdFlu on Fri, 26 December 2008 12:21
|
Goto Forum:
Current Time: Mon Dec 02 08:34:29 GMT+2 2024
Total time taken to generate the page: 0.01482 seconds
|