Code:
scn DDJailShacklesQUSTSCPT
short DDJSTutCheck
short DDJSShackleCheck
short DDJSDefault
short DDJSRemove
short DDJSMinor
short DDJSMajor
short DDJSSerious
short DDJSFameMod
short DDJSInfamyMod
short DDJSNoShackles
short DDJSBreakOut
short DDJSBounty
short DDJSJailDays
short DDJSCrimeDays
short DDJSRandom
short DDJSLoop
short DDJSJailMod
short DDJSSkillMod
short DDJSBladeMod
short DDJSBluntMod
short DDJSHtHMod
short DDJSArmMod
short DDJSBlockMod
short DDJSHvyArmMod
short DDJSAthlMod
short DDJSAcrMod
short DDJSLgtArmMod
short DDJSMarkMod
short DDJSMercMod
short DDJSSpchMod
short DDJSIlluMod
short DDJSAlchMod
short DDJSConjMod
short DDJSMystMod
short DDJSAlteMod
short DDJSDestMod
short DDJSRestMod
short DDJSJailMod2
short DDJSJailMod3
short DDJSAttrMod
short DDJSAgiMod
short DDJSEndMod
short DDJSPerMod
short DDJSSpeMod
short DDJSStrMod
short DDJSWilMod
short DDJSTurnIn
short DDJSGold
ref DDJSSmith
Begin GameMode
if (DDJSDefault < 1) ;Set all variables to default values
addTopic DDJSSmithShackles
addTopic DDJSDoyenShackles
set DDJSMinor to 300
set DDJSMajor to 1500
set DDJSSerious to 4000
set DDJSFameMod to -15
set DDJSInfamyMod to 21
set DDJSJailMod to 2
set DDJSJailMod2 to 10
set DDJSDefault to 1
endif
if (DDJSTutCheck < 1) ;Equip iron shackles at game start
if (GetStage MQ01 < 84)
message " "
message " "
player.AddItem DDIronShackles 1
player.EquipItem DDIronShackles 1
set DDJSBreakOut to 1
set DDJSTutCheck to 1
endif
elseif (DDJSTutCheck == 1) ;Start the initial "remove the shackles" quest
if (GetStage MQ01 >= 90)
if (player.GetEquipped DDIronShackles == 1)
startQuest DDJSStartingQuest
setStage DDJSStartingQuest 10
set DDJSTutCheck to 2
else
startQuest DDJSStartingQuest
setStage DDJSStartingQuest 30
stopQuest DDJSStartingQuest
set DDJSTutCheck to 2
endif
endif
endif
if (DDJSTurnIn > 0)
DDJSSmith.sayTo player Steal 0 ;Make smith actually say something when reporting you to the guards (connected to added dialogue)
set DDJSTurnIn to 0
endif
if (getPlayerInSEWorld) ;If the player is wearing shackles when in SI, remove them.
if (player.GetEquipped DDIronShackles >= 1 || player.GetEquipped DDSteelShackles >= 1 || player.GetEquipped DDEbonyShackles >= 1)
set DDJSBreakOut to 1
player.RemoveItem DDIronShackles 1
player.RemoveItem DDSteelShackles 1
player.RemoveItem DDEbonyShackles 1
set DDJSShackleCheck to 2
endif
endif
if (DDJSRemove > 0) ;Remove shackles function. Can be used from the console
set DDJSRemove to 0
if (player.GetEquipped DDIronShackles >= 1 || player.GetEquipped DDSteelShackles >= 1 || player.GetEquipped DDEbonyShackles >= 1)
player.RemoveItem DDIronShackles 1
player.RemoveItem DDSteelShackles 1
player.RemoveItem DDEbonyShackles 1
set DDJSShackleCheck to 2
endif
endif
if (IsPlayerInJail == 0) ;Player is not in jail
if (player.GetEquipped DDIronShackles >= 1 || player.GetEquipped DDSteelShackles >= 1 || player.GetEquipped DDEbonyShackles >= 1)
if (DDJSBreakOut < 1)
if (AnvilPCCellDoorRef.GetLocked == 0 || BravilPCCellDoorRef.GetLocked == 0 || BrumaPCCellDoorRef.GetLocked == 0 || CheydinhalPCCellDoorRef.GetLocked == 0 || ChorrolPCCellDoorRef.GetLocked == 0 || ICPCCellDoorRef.GetLocked == 0 || LeyawiinPCCellDoorRef.GetLocked == 0 || SkingradPCCellDoorRef.GetLocked == 0)
set DDJSBreakOut to 1 ;Player is not in jail, has shackles and one prison door is unlocked - Player has broken out!
elseif (player.GetCrimeGold < 1) ;Player is not in jail, has shackles, crime gold < 1 and has not broken out of jail - Remove shackles and apply jail time penalties
if (DDJSJailMod > 0)
player.RemoveItem DDIronShackles 1
player.RemoveItem DDSteelShackles 1
player.RemoveItem DDEbonyShackles 1
set DDJSCrimeDays to getGameSetting ICrimeDaysInPrisonMod
set DDJSJailDays to DDJSBounty/DDJSCrimeDays
set DDJSLoop to 0
set DDJSBladeMod to 0
set DDJSBluntMod to 0
set DDJSHtHMod to 0
set DDJSArmMod to 0
set DDJSBlockMod to 0
set DDJSHvyArmMod to 0
set DDJSAthlMod to 0
set DDJSAcrMod to 0
set DDJSLgtArmMod to 0
set DDJSMarkMod to 0
set DDJSMercMod to 0
set DDJSSpchMod to 0
set DDJSIlluMod to 0
set DDJSAlchMod to 0
set DDJSConjMod to 0
set DDJSMystMod to 0
set DDJSAlteMod to 0
set DDJSDestMod to 0
set DDJSRestMod to 0
Label 0
set DDJSRandom to 1 + 0.2 * GetRandomPercent
if (DDJSRandom == 1)
if (player.getAV Blade > DDJSJailMod)
set DDJSSkillMod to (player.getAV Blade - DDJSJailMod)
player.setAV Blade DDJSSkillMod
set DDJSBladeMod to DDJSBladeMod - DDJSJailMod
else
player.setAV Blade 0
endif
elseif (DDJSRandom == 2)
if (player.getAV Blunt > DDJSJailMod)
set DDJSSkillMod to (player.getAV Blunt - DDJSJailMod)
player.setAV Blunt DDJSSkillMod
set DDJSBluntMod to DDJSBluntMod - DDJSJailMod
else
player.setAV Blunt 0
endif
elseif (DDJSRandom == 3)
if (player.getAV HandToHand > DDJSJailMod)
set DDJSSkillMod to (player.getAV HandToHand - DDJSJailMod)
player.setAV HandToHand DDJSSkillMod
set DDJSHtHMod to DDJSHtHMod - DDJSJailMod
else
player.setAV HandToHand 0
endif
elseif (DDJSRandom == 4)
if (player.getAV Armorer > DDJSJailMod)
set DDJSSkillMod to (player.getAV Armorer - DDJSJailMod)
player.setAV Armorer DDJSSkillMod
set DDJSArmMod to DDJSArmMod - DDJSJailMod
else
player.setAV Armorer 0
endif
elseif (DDJSRandom == 5)
if (player.getAV Block > DDJSJailMod)
set DDJSSkillMod to (player.getAV Block - DDJSJailMod)
player.setAV Block DDJSSkillMod
set DDJSBlockMod to DDJSBlockMod - DDJSJailMod
else
player.setAV Block 0
endif
elseif (DDJSRandom == 6)
if (player.getAV HeavyArmor > DDJSJailMod)
set DDJSSkillMod to (player.getAV HeavyArmor - DDJSJailMod)
player.setAV HeavyArmor DDJSSkillMod
set DDJSHvyArmMod to DDJSHvyArmMod - DDJSJailMod
else
player.setAV HeavyArmor 0
endif
elseif (DDJSRandom == 7)
if (player.getAV Athletics > DDJSJailMod)
set DDJSSkillMod to (player.getAV Athletics - DDJSJailMod)
player.setAV Athletics DDJSSkillMod
set DDJSAthlMod to DDJSAthlMod - DDJSJailMod
else
player.setAV Athletics 0
endif
elseif (DDJSRandom == 8)
if (player.getAV Acrobatics > DDJSJailMod)
set DDJSSkillMod to (player.getAV Acrobatics - DDJSJailMod)
player.setAV Acrobatics DDJSSkillMod
set DDJSAcrMod to DDJSAcrMod - DDJSJailMod
else
player.setAV Acrobatics 0
endif
elseif (DDJSRandom == 9)
if (player.getAV LightArmor > DDJSJailMod)
set DDJSSkillMod to (player.getAV LightArmor - DDJSJailMod)
player.setAV LightArmor DDJSSkillMod
set DDJSLgtArmMod to DDJSLgtArmMod - DDJSJailMod
else
player.setAV LightArmor 0
endif
elseif (DDJSRandom == 10)
if (player.getAV Marksman > DDJSJailMod)
set DDJSSkillMod to (player.getAV Marksman - DDJSJailMod)
player.setAV Marksman DDJSSkillMod
set DDJSMarkMod to DDJSMarkMod - DDJSJailMod
else
player.setAV Marksman 0
endif
elseif (DDJSRandom == 11)
if (player.getAV Mercantile > DDJSJailMod)
set DDJSSkillMod to (player.getAV Mercantile - DDJSJailMod)
player.setAV Mercantile DDJSSkillMod
set DDJSMercMod to DDJSMercMod - DDJSJailMod
else
player.setAV Mercantile 0
endif
elseif (DDJSRandom == 12)
if (player.getAV Speechcraft > DDJSJailMod)
set DDJSSkillMod to (player.getAV Speechcraft - DDJSJailMod)
player.setAV Speechcraft DDJSSkillMod
set DDJSSpchMod to DDJSSpchMod - DDJSJailMod
else
player.setAV Speechcraft 0
endif
elseif (DDJSRandom == 13)
if (player.getAV Illusion > DDJSJailMod)
set DDJSSkillMod to (player.getAV Illusion - DDJSJailMod)
player.setAV Illusion DDJSSkillMod
set DDJSIlluMod to DDJSIlluMod - DDJSJailMod
else
player.setAV Illusion 0
endif
elseif (DDJSRandom == 14)
if (player.getAV Alchemy > DDJSJailMod)
set DDJSSkillMod to (player.getAV Alchemy - DDJSJailMod)
player.setAV Alchemy DDJSSkillMod
set DDJSAlchMod to DDJSAlchMod - DDJSJailMod
else
player.setAV Alchemy 0
endif
elseif (DDJSRandom == 15)
if (player.getAV Conjuration > DDJSJailMod)
set DDJSSkillMod to (player.getAV Conjuration - DDJSJailMod)
player.setAV Conjuration DDJSSkillMod
set DDJSConjMod to DDJSConjMod - DDJSJailMod
else
player.setAV Conjuration 0
endif
elseif (DDJSRandom == 16)
if (player.getAV Mysticism > DDJSJailMod)
set DDJSSkillMod to (player.getAV Mysticism - DDJSJailMod)
player.setAV Mysticism DDJSSkillMod
set DDJSMystMod to DDJSMystMod - DDJSJailMod
else
player.setAV Mysticism 0
endif
elseif (DDJSRandom == 17)
if (player.getAV Alteration > DDJSJailMod)
set DDJSSkillMod to (player.getAV Alteration - DDJSJailMod)
player.setAV Alteration DDJSSkillMod
set DDJSAlteMod to DDJSAlteMod - DDJSJailMod
else
player.setAV Alteration 0
endif
elseif (DDJSRandom == 18)
if (player.getAV Destruction > DDJSJailMod)
set DDJSSkillMod to (player.getAV Destruction - DDJSJailMod)
player.setAV Destruction DDJSSkillMod
set DDJSDestMod to DDJSDestMod - DDJSJailMod
else
player.setAV Destruction 0
endif
elseif (DDJSRandom == 19)
if (player.getAV Restoration > DDJSJailMod)
set DDJSSkillMod to (player.getAV Restoration - DDJSJailMod)
player.setAV Restoration DDJSSkillMod
set DDJSRestMod to DDJSRestMod - DDJSJailMod
else
player.setAV Restoration 0
endif
else
;Do nothing
endif
set DDJSLoop to DDJSLoop + 1
if DDJSLoop < DDJSJailDays
GoTo 0
endif
if (DDJSBladeMod != 0 || DDJSBluntMod != 0 || DDJSHtHMod != 0 || DDJSArmMod != 0 || DDJSBlockMod != 0 || DDJSHvyArmMod != 0 || DDJSAthlMod != 0)
message "Skill reductions: | Blade: %.0f | Blunt: %.0f | Hand to Hand: %.0f | Armorer: %.0f | Block: %.0f | Heavy Armor: %.0f | Athletics: %.0f", DDJSBladeMod, DDJSBluntMod, DDJSHtHMod, DDJSArmMod, DDJSBlockMod, DDJSHvyArmMod, DDJSAthlMod
endif
if (DDJSAcrMod != 0 || DDJSLgtArmMod != 0 || DDJSMarkMod != 0 || DDJSMercMod != 0 || DDJSSpchMod != 0 || DDJSIlluMod != 0)
message "Skill reductions: | Acrobatics: %.0f | Light Armor: %.0f | Marksman: %.0f | Mercantile: %.0f | Speechcraft: %.0f | Illusion: %.0f", DDJSAcrMod, DDJSLgtArmMod, DDJSMarkMod, DDJSMercMod, DDJSSpchMod, DDJSIlluMod
endif
if (DDJSAlchMod != 0 || DDJSConjMod != 0 || DDJSMystMod != 0 || DDJSAlteMod != 0 || DDJSDestMod != 0 || DDJSRestMod)
message "Skill reductions: | Alchemy: %.0f | Conjuration: %.0f | Mysticism: %.0f | Alteration: %.0f | Destruction: %.0f | Restoration: %.0f", DDJSAlchMod, DDJSConjMod, DDJSMystMod, DDJSAlteMod, DDJSDestMod, DDJSRestMod
endif
endif
if (DDJSJailMod2 > 0)
if (DDJSJailDays >= DDJSJailMod2)
set DDJSJailMod3 to DDJSJailDays / DDJSJailMod2
set DDJSAgiMod to 0
set DDJSEndMod to 0
set DDJSPerMod to 0
set DDJSSpeMod to 0
set DDJSStrMod to 0
set DDJSWilMod to 0
set DDJSLoop to 0
Label 1
set DDJSRandom to 1 + 0.06 * GetRandomPercent
if (DDJSRandom == 1)
if (player.getAV Agility > 10)
set DDJSAttrMod to (player.getAV Agility - 1)
player.setAV Agility DDJSAttrMod
set DDJSAgiMod to DDJSAgiMod - 1
endif
elseif (DDJSRandom == 2)
if (player.getAV Endurance > 10)
set DDJSAttrMod to (player.getAV Endurance - 1)
player.setAV Endurance DDJSAttrMod
set DDJSEndMod to DDJSEndMod - 1
endif
elseif (DDJSRandom == 3)
if (player.getAV Personality > 10)
set DDJSAttrMod to (player.getAV Personality - 1)
player.setAV Personality DDJSAttrMod
set DDJSPerMod to DDJSPerMod - 1
endif
elseif (DDJSRandom == 4)
if (player.getAV Speed > 10)
set DDJSAttrMod to (player.getAV Speed - 1)
player.setAV Speed DDJSAttrMod
set DDJSSpeMod to DDJSSpeMod - 1
endif
elseif (DDJSRandom == 5)
if (player.getAV Strength > 10)
set DDJSAttrMod to (player.getAV Strength - 1)
player.setAV Strength DDJSAttrMod
set DDJSStrMod to DDJSStrMod - 1
endif
elseif (DDJSRandom == 6)
if (player.getAV Willpower > 10)
set DDJSAttrMod to (player.getAV Willpower - 1)
player.setAV Willpower DDJSAttrMod
set DDJSWilMod to DDJSWilMod - 1
endif
else
;Do nothing
endif
set DDJSLoop to DDJSLoop + 1
if DDJSLoop < DDJSJailMod3
GoTo 1
endif
if (DDJSAgiMod != 0 || DDJSEndMod != 0 || DDJSPerMod != 0 || DDJSSpeMod != 0 || DDJSStrMod != 0 || DDJSWilMod != 0)
message "Attribute reductions: | Agility: %.0f | Endurance: %.0f | Personality: %.0f | Speed: %.0f | Strength: %.0f | Willpower: %.0f", DDJSAgiMod, DDJSEndMod, DDJSPerMod, DDJSSpeMod, DDJSStrMod, DDJSWilMod
endif
endif
endif
endif
endif
elseif (player.GetEquipped DDIronShackles == 0 || player.GetEquipped DDSteelShackles == 0 || player.GetEquipped DDEbonyShackles == 0)
set DDJSShackleCheck to 2 ;Player is not in jail and has no shackles - Set "no shackles" variable
endif
elseif (DDJSShackleCheck > 1) ;If player is in jail, but has no shackles
set DDJSBounty to player.GetCrimeGold ;Check how many/serious crimes the player has commited and apply correct shackles
if (player.GetCrimeGold + GetPCInfamy*DDJSInfamyMod + GetPCFame*DDJSFameMod < DDJSMinor) ;Minor offense
set DDJSNoShackles to 1 ;No shackles needed
set DDJSShackleCheck to 1
set DDJSBreakOut to 0
set DDJSCrimeDays to getGameSetting ICrimeDaysInPrisonMod
set DDJSJailDays to DDJSBounty/DDJSCrimeDays
messageBox "If I choose to serve my time, I'll be in here for %.0f days", DDJSJailDays
elseif(player.GetCrimeGold + GetPCInfamy*DDJSInfamyMod + GetPCFame*DDJSFameMod < DDJSMajor) ;Major offense
if (DDJSNoShackles != 1 || player.GetEquipped DDIronShackles == 0 || player.GetEquipped DDSteelShackles == 0 || player.GetEquipped DDEbonyShackles == 0)
if (getPlayerInSEWorld == 0)
message " "
message " "
player.AddItem DDIronShackles 1 ;Equip iron shackles
player.EquipItem DDIronShackles 1
endif
set DDJSShackleCheck to 1
set DDJSBreakOut to 0
set DDJSCrimeDays to getGameSetting ICrimeDaysInPrisonMod
set DDJSJailDays to DDJSBounty/DDJSCrimeDays
messageBox "If I choose to serve my time, I'll be in here for %.0f days", DDJSJailDays
endif
elseif(player.GetCrimeGold + GetPCInfamy*DDJSInfamyMod + GetPCFame*DDJSFameMod < DDJSSerious) ;Serious crime
if (DDJSNoShackles != 1 || player.GetEquipped DDIronShackles == 0 || player.GetEquipped DDSteelShackles == 0 || player.GetEquipped DDEbonyShackles == 0)
if (player.GetAV Fatigue > 550)
player.setEnchantment DDSteelShackles500ENCH DDSteelShackles ;Apply 500 fatigue penalty + silence
elseif (player.GetAV Fatigue > 500)
player.setEnchantment DDSteelShackles450ENCH DDSteelShackles ;Apply 450 fatigue penalty + silence
elseif (player.GetAV Fatigue > 450)
player.setEnchantment DDSteelShackles400ENCH DDSteelShackles ;Apply 400 fatigue penalty + silence
elseif (player.GetAV Fatigue > 400)
player.setEnchantment DDSteelShackles350ENCH DDSteelShackles ;Apply 350 fatigue penalty + silence
elseif (player.GetAV Fatigue > 350)
player.setEnchantment DDSteelShackles300ENCH DDSteelShackles ;Apply 300 fatigue penalty + silence
elseif (player.GetAV Fatigue > 300)
player.setEnchantment DDSteelShackles250ENCH DDSteelShackles ;Apply 250 fatigue penalty + silence
elseif (player.GetAV Fatigue > 250)
player.setEnchantment DDSteelShackles200ENCH DDSteelShackles ;Apply 200 fatigue penalty + silence
elseif (player.GetAV Fatigue > 200)
player.setEnchantment DDSteelShackles150ENCH DDSteelShackles ;Apply 150 fatigue penalty + silence
elseif (player.GetAV Fatigue > 150)
player.setEnchantment DDSteelShackles100ENCH DDSteelShackles ;Apply 100 fatigue penalty + silence
elseif (player.GetAV Fatigue > 100)
player.setEnchantment DDSteelShackles50ENCH DDSteelShackles ;Apply 50 fatigue penalty + silence
else
player.setEnchantment DDSteelShacklesENCH DDSteelShackles ;Apply 0 fatigue penalty + silence
endif
if (getPlayerInSEWorld == 0)
message " "
message " "
player.AddItem DDSteelShackles 1 ;Add steel shackles
player.EquipItem DDSteelShackles 1 ;Equip steel shackles
endif
set DDJSShackleCheck to 1
set DDJSBreakOut to 0
set DDJSCrimeDays to getGameSetting ICrimeDaysInPrisonMod
set DDJSJailDays to DDJSBounty/DDJSCrimeDays
messageBox "If I choose to serve my time, I'll be in here for %.0f days", DDJSJailDays
endif ;Unthinkable crime
elseif (DDJSNoShackles != 1 || player.GetEquipped DDIronShackles == 0 || player.GetEquipped DDSteelShackles == 0 || player.GetEquipped DDEbonyShackles == 0)
if (player.GetAV Fatigue > 550)
player.setEnchantment DDEbonyShackles550ENCH DDEbonyShackles ;Apply 550 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 500)
player.setEnchantment DDEbonyShackles500ENCH DDEbonyShackles ;Apply 500 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 450)
player.setEnchantment DDEbonyShackles450ENCH DDEbonyShackles ;Apply 450 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 400)
player.setEnchantment DDEbonyShackles400ENCH DDEbonyShackles ;Apply 400 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 350)
player.setEnchantment DDEbonyShackles350ENCH DDEbonyShackles ;Apply 350 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 300)
player.setEnchantment DDEbonyShackles300ENCH DDEbonyShackles ;Apply 300 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 250)
player.setEnchantment DDEbonyShackles250ENCH DDEbonyShackles ;Apply 250 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 200)
player.setEnchantment DDEbonyShackles200ENCH DDEbonyShackles ;Apply 200 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 150)
player.setEnchantment DDEbonyShackles150ENCH DDEbonyShackles ;Apply 150 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 100)
player.setEnchantment DDEbonyShackles100ENCH DDEbonyShackles ;Apply 100 fatigue penalty + 40 security/sneak penalty + silence
elseif (player.GetAV Fatigue > 50)
player.setEnchantment DDEbonyShackles50ENCH DDEbonyShackles ;Apply 50 fatigue penalty + 40 security/sneak penalty + silence
else
player.setEnchantment DDEbonyShacklesENCH DDEbonyShackles ;Apply 0 fatigue penalty + 40 security/sneak penalty + silence
endif
if (getPlayerInSEWorld == 0)
message " "
message " "
player.AddItem DDEbonyShackles 1 ;Add ebony shackles
player.EquipItem DDEbonyShackles 1 ;Equip shackles
endif
set DDJSShackleCheck to 1
set DDJSBreakOut to 0
set DDJSCrimeDays to getGameSetting ICrimeDaysInPrisonMod
set DDJSJailDays to DDJSBounty/DDJSCrimeDays
messageBox "If I choose to serve my time, I'll be in here for %.0f days", DDJSJailDays
endif
endif
End