Project Zomboid

Project Zomboid

Disable Burglar Alarms
rientelfon  [udvikler] 13. nov. 2021 kl. 16:58
Bugs & Suggestions
This is a place to post any issues discovered and any suggestions.
< >
Viser 1-7 af 7 kommentarer
Muad'Dib 14. nov. 2021 kl. 15:09 
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.
Sidst redigeret af Muad'Dib; 14. nov. 2021 kl. 15:12
rientelfon  [udvikler] 14. nov. 2021 kl. 18:05 
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.
Sidst redigeret af rientelfon; 14. nov. 2021 kl. 18:09
Muad'Dib 18. nov. 2021 kl. 12:05 
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 kl. 6:01 
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.
Sidst redigeret af Fiber; 28. nov. 2021 kl. 6:11
rientelfon  [udvikler] 28. nov. 2021 kl. 7:02 
Sorry about that, it is fixed now!
Crio 19. jan. 2022 kl. 4:36 
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 :)
Sidst redigeret af Crio; 19. jan. 2022 kl. 4:37
rientelfon  [udvikler] 19. jan. 2022 kl. 19:30 
that is a good question, i will look into it
< >
Viser 1-7 af 7 kommentarer
Per side: 1530 50