Project Zomboid

Project Zomboid

Disable Burglar Alarms
rientelfon  [developer] 13 Nov, 2021 @ 4:58pm
Bugs & Suggestions
This is a place to post any issues discovered and any suggestions.
< >
Showing 1-7 of 7 comments
Muad'Dib 14 Nov, 2021 @ 3:09pm 
Not really a bug or suggestion. Well kinda. I'm working on integrating your mod with Better Lockpicking - my preferred lockpicking and alarm-detecting mod of choice. Would like to know if you are ok with that.

So far not much is done, except I added a requirement to have screwdrivers and scissors to disarm an alarm. Here's the code

if level >= 5 or playerObj:HasTrait("Burglar") then if alarmFound and square:getModData().failedDisarm == nil then local disarmalarmUI = context:addOption(disarm, square, DisarmAlarm, playerObj, baseChance) disarmalarmUI.toolTip = ISToolTip:new(); disarmalarmUI.toolTip:initialise(); disarmalarmUI.toolTip:setVisible(false); disarmalarmUI.toolTip:setName("Requirements") local color -- if not playerObj:getPerkLevel(Perks.Lockpicking) == "5" then -- color = " <RGB:0.9,0,0> " -- disarmalarmUI.toolTip.description = color .. getText("Tooltip_vehicle_recommendedSkill", playerSkill .. "/" .. window:getModData().LockpickLevel.num, "") .. " <LINE> " -- disarmalarmUI.notAvailable = true -- end if not playerObj:getInventory():containsType("Screwdriver") then color = " <RGB:0.9,0,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("ContextMenu_Require", getItemNameFromFullType("Base.Screwdriver")) .. " <LINE> " disarmalarmUI.notAvailable = true end if not playerObj:getInventory():containsType("Scissors") then color = " <RGB:0.9,0,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("ContextMenu_Require", getItemNameFromFullType("Base.Scissors")) .. " <LINE> " disarmalarmUI.notAvailable = true end end end

Still need to integrate with Better Lockpicking "lockpicking" skill and their alarm detection system. But I thought these requirements and tooltips could help you with this version.

Like all my mods I won't publish it in Steam since I own the game on GOG. So it will probably just be obscure. Still all credit to you and all that.
Last edited by Muad'Dib; 14 Nov, 2021 @ 3:12pm
rientelfon  [developer] 14 Nov, 2021 @ 6:05pm 
Oh, thanks for the suggestion, I actually like the idea of having required tools. I will see about implementing that into my mod. Once I am finished with my latest mod, I will update it with your suggestion.

Also, very nice work on your implementation, I like it.
Last edited by rientelfon; 14 Nov, 2021 @ 6:09pm
Muad'Dib 18 Nov, 2021 @ 12:05pm 
I like your implementation, you improved on what I suggested! Another suggestion: don't assume players will read or remember the skill level necessary to disarm alarms. Therefore, it's better to have the panel show up as long as they detect an alarm but show why they can't disable the alarm. My implementation is:

if not playerObj:HasTrait("Burglar") then color = " <RGB:0.9,0.5,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("Burglars have a higher chance of disabling alarms") .. " <LINE> " else color = " <RGB:0,128,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("Burglars have a higher chance of disabling alarms") .. " <LINE> " end if not (playerSkillLock >= 5) then color = " <RGB:0.9,0,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("Lockpicking Skill: " .. playerSkillLock .. "/" .. "5" .. "") .. " <LINE> " disarmalarmUI.notAvailable = true else color = " <RGB:0,128,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("Lockpicking Skill: " .. playerSkillLock .. "/" .. "5" .. "") .. " <LINE> " end if not (playerObj:getPerkLevel(Perks.Electricity) >= 3) then color = " <RGB:0.9,0,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("Electrical Skill: " .. playerSkillElect .. "/" .. "3" .. "") .. " <LINE> " disarmalarmUI.notAvailable = true else color = " <RGB:0,128,0> " disarmalarmUI.toolTip.description = disarmalarmUI.toolTip.description .. color .. getText("Electrical Skill: " .. playerSkillElect .. "/" .. "3" .. "") .. " <LINE> " end

The end result is this:
https://imgur.com/a/F7rjR1q

You will notice it says "Burglars have a higher chance of disabling alarms" in yellow - it makes clear that burglars have a higher chance than non burglars while not locking out the option.

Next thing I'm trying to figure out is using ZombRand and the baseChance to take into account degrees of success. What I mean is (just an example):

Critical failure (difference between ZombRand and BaseChance is more than 30) = Alarm triggers

Complete failure (difference between ZombRand and BaseChance is more than 20 but less than 30) = Unable to disable the alarm and locks future attempts

Partial failure (difference between ZombRand and BaseChance is more than 10 but less than 20) = Unable to disable the alarm but you can try again

Partial success (difference between ZombRand and BaseChance is more than +10 but less than +20) = Alarm disabled and you get scrap electronics

Complete success (difference between ZombRand and BaseChance is more than +10 but less than +20) = Alarm disabled and you get a home alarm

When I can code this I will update you here in case you want something like that. I will ask for help in the Discord to try and figure out how to do this.
This however implies some feedback for the player to know which kind of failure/success he got. Currently I use
self.character:Say("Unable to Disarm")
And that could be adapted to any number of outcomes.
Fiber 28 Nov, 2021 @ 6:01am 
Upon detecting alarm from context menu getting error and "Requirements for disabling" Tab is empty aswell:

function: AddDisarmContextMenu -- file: DisarmAlarm_action.lua line # 103
function: DisarmAlarmOptions -- file: DisarmAlarm_action.lua line # 59
function: detectAlarm -- file: DisarmAlarm_contextmenu.lua line # 2
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@d481b05b
function: createMenu -- file: ISWorldObjectContextMenu.lua line # 460
function: createMenu -- file: ISMenuContextWorld.lua line # 50
function: createWorldMenu -- file: ISContextManager.lua line # 28
function: doRClick -- file: ISObjectClickHandler.lua line # 56
function: onObjectRightMouseButtonUp -- file: ISObjectClickHandler.lua line # 360
---------------------------------------------

P.S if alarm in the house not present everything is fine.
Last edited by Fiber; 28 Nov, 2021 @ 6:11am
rientelfon  [developer] 28 Nov, 2021 @ 7:02am 
Sorry about that, it is fixed now!
Crio 19 Jan, 2022 @ 4:36am 
Suggestion:

Not sure if this would fit into this mod or might be an idea for an independent one, i couldn't find any mod that provides it, so if i'm mistaken, please excuse me :)

Wouldn't it make sense, that the house alarms would be disabled a few days after the power went out? So that the house alarms have a backup battery which runs out of power after e.g. 48h power outage?

If a mod doing this already exists, I'd appreciate any references :)
Last edited by Crio; 19 Jan, 2022 @ 4:37am
rientelfon  [developer] 19 Jan, 2022 @ 7:30pm 
that is a good question, i will look into it
< >
Showing 1-7 of 7 comments
Per page: 1530 50