Payday 2 – How to Place Sentry in AP Mode

payday-2

Is it possible to change the default mode sentries are placed in? Currently mine are placed in the standard mode, but I only ever use AP mode

A Steam discussion post I found suggests it is possible, as well as disabling the toggle action, but links to a dead pastebin page

Being able to place sentries in AP mode would be a great time and ammo saver

Best Answer

The only solution I've found so far is to use a mod

Using the code from the Steam discussion post (thanks for the link, @Sentry), I got it working

  1. Install the mod loader, BLT
  2. Create the APSentry mod
    • Create an APSentry folder in Steam\SteamApps\common\PAYDAY 2\mods\
    • Create a mods.txt file in the APSentry folder
    • Create a APSentry.lua file in the APSentry folder

mods.txt contents:

{
    "name" : "APSentry",
    "description" : "Places sentries as AP sentries",
    "author" : "",
    "contact" : "",
    "version" : "1",
    "updates" :
    [
        {
            "revision" : 1,
            "identifier" : "APSentry"
        }
    ],
    "hooks" :
    [
        {"hook_id" : "lib/units/interactions/interactionext", "script_path" : "APSentry.lua"}
    ]
}

APSentry.lua contents:

local setup_original = SentryGunFireModeInteractionExt.setup

function SentryGunFireModeInteractionExt:setup(...)
    managers.enemy:add_delayed_clbk("sentry_switch_" .. tostring(self._unit:key()), callback(self, self, "_auto_switch_firemode"), 0)
    return setup_original(self, ...)
end

function SentryGunFireModeInteractionExt:_auto_switch_firemode()
    if self:is_owner() then
        if not self._sentry_gun_weapon._use_armor_piercing then
            self:interact(managers.player:player_unit())
        end
        self:set_active(false)
    end
end
Related Topic