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

  • If mods are okay for you, you can try Wolfhud, it has a setting for that: steamcommunity.com/app/218620/discussions/8/135514287302191315 – Sentry Dec 2 '17 at 10:33
  • @Sentry thanks, it'd be nice if this was possible without a mod, but I doubt that's possible. On the other hand, I managed to get the code in the discussion to work, will post it as an answer in a bit (still fiddling with some things) – phflack Dec 3 '17 at 19:22
0

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
  • Couldn't figure out a way to format the code in the bullet points, looking back on it, it'd probably be more cluttered that way – phflack Dec 14 '17 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.