Okay, I could really use some help here.
I decided to make Lockpicking a skill as well, but as most of you know Rogues have an innate ability to pick locks, and Lockpicking simply improves that.
I looked it up, and supposedly everything relating to how Lockpicking works can be found inside of the scripts Core_h.nss and Placeable_h.nss.
Looking inside of those scripts, Core_h handles how the skill improves your chances, and only runs if you're a Rogue. I changed that so it would only run if you have the first Lockpicking skill (ABILITY_SKILL_LOCKPICKING_1).
I then opened Placeable_h, which seems to handle how a locked object reacts when you activate it. It had some lines that would only run if you were a Rogue. I changed that to require the first Lockpicking skill, just like in Core_h.
But when I go in-game, Rogues are still the only ones capable of opening locks.
Same lock, same number of skill points in Lockpicking, same Cunning, and the non-Rogue gets the "insufficient skill" message while the Rogue opens it successfully.
Here are the scripts, I only changed the lines referencing ABILITY_TALENT_HIDDEN_ROGUE near the start:
Core_h beforefloat GetDisableDeviceLevel(object oCreature)
{
float fPlayerScore = 0.0f;
if (HasAbility(oCreature, ABILITY_TALENT_HIDDEN_ROGUE))
{
fPlayerScore = GetAttributeModifier(oCreature, PROPERTY_ATTRIBUTE_INTELLIGENCE);
#ifdef DEBUG
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "Intelligence Modifier = " + ToString(fPlayerScore));
#endif
int nSkillLevel = 0;
if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_4))
{
nSkillLevel = 4;
} else if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_3))
{
nSkillLevel = 3;
} else if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_2))
{
nSkillLevel = 2;
} else if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_1))
{
nSkillLevel = 1;
}
fPlayerScore += (10.0f * nSkillLevel);
#ifdef DEBUG
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "With Skill = " + ToString(fPlayerScore));
#endif
}
return fPlayerScore;
}Core_h afterfloat GetDisableDeviceLevel(object oCreature)
{
float fPlayerScore = 0.0f;
if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_1))
{
fPlayerScore = GetAttributeModifier(oCreature, PROPERTY_ATTRIBUTE_INTELLIGENCE);
#ifdef DEBUG
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "Intelligence Modifier = " + ToString(fPlayerScore));
#endif
int nSkillLevel = 0;
if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_4))
{
nSkillLevel = 4;
} else if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_3))
{
nSkillLevel = 3;
} else if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_2))
{
nSkillLevel = 2;
} else if (HasAbility(oCreature, ABILITY_SKILL_LOCKPICKING_1))
{
nSkillLevel = 1;
}
fPlayerScore += (10.0f * nSkillLevel);
#ifdef DEBUG
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "With Skill = " + ToString(fPlayerScore));
#endif
}
return fPlayerScore;
}Placeable_h before // If still locked and key not required then rogues can attempt to pick lock.
if (!nActionResult && !bKeyRequired && HasAbility(oUser, ABILITY_TALENT_HIDDEN_ROGUE))
{
// player score
float fPlayerScore = GetDisableDeviceLevel(oUser);
float fTargetScore = IntToFloat(nLockLevel);
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "nLockLevel = " + ToString(nLockLevel));
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "Final Value = " + ToString(fPlayerScore));
nActionResult = (fPlayerScore >= fTargetScore);
}
}
if (nActionResult)
{
// Success
UI_DisplayMessage(OBJECT_SELF, (bUsedKey ? UI_MESSAGE_UNLOCKED_BY_KEY : UI_MESSAGE_UNLOCKED));
PlaySound(OBJECT_SELF, GetM2DAString(TABLE_PLACEABLE_TYPES, "PickLockSuccess", GetAppearanceType(OBJECT_SELF)));Placeable_h after // If still locked and key not required then rogues can attempt to pick lock.
if (!nActionResult && !bKeyRequired && HasAbility(oUser, ABILITY_SKILL_LOCKPICKING_1))
{
// player score
float fPlayerScore = GetDisableDeviceLevel(oUser);
float fTargetScore = IntToFloat(nLockLevel);
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "nLockLevel = " + ToString(nLockLevel));
Log_Trace(LOG_CHANNEL_SYSTEMS_PLACEABLES, GetCurrentScriptName(), "Final Value = " + ToString(fPlayerScore));
nActionResult = (fPlayerScore >= fTargetScore);
}
}
if (nActionResult)
{
// Success
UI_DisplayMessage(OBJECT_SELF, (bUsedKey ? UI_MESSAGE_UNLOCKED_BY_KEY : UI_MESSAGE_UNLOCKED));
PlaySound(OBJECT_SELF, GetM2DAString(TABLE_PLACEABLE_TYPES, "PickLockSuccess", GetAppearanceType(OBJECT_SELF)));
Modifié par Kesaru, 09 février 2010 - 08:26 .