Possible to change ACU zoom level?

Hi all, I often use the "select ACU" hotkey that automatically zooms in on the ACU. Is it possible to change some setting to reduce the zoom level?

I fiddled with the in-game "Zoom Pop" setting but it didn't seem to impact anything. Thanks for any pointers.

I'm not sure.

The hotkey takes us to:

    ['acu_select_cg'] = {action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").ACUSelectCG()',
        category = 'selection', order = 33,},
    ['acu_append_cg'] = {action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").ACUAppendCG()',
        category = 'selection', order = 34,},

Which takes us to:

local lastACUSelectionTime = 0
function ACUSelectCG()
    local curTime = GetSystemTimeSeconds()
    local diffTime = curTime - lastACUSelectionTime
    if diffTime > 1.0 then
        ConExecute('UI_SelectByCategory +nearest COMMAND')
    else
        ConExecute('UI_SelectByCategory +nearest +goto COMMAND')
    end

    lastACUSelectionTime = curTime
end

function ACUAppendCG()
    local selection = GetSelectedUnits() or {}
    ACUSelectCG()
    AddSelectUnits(selection)
end

And that contains the +goto command, which then maps your camera to your selection (the commander). But I don't know how to set its arguments. Maybe @Strogo knows more about it.

A work of art is never finished, merely abandoned

i am not sure but, in interface settings there was "zoom pop distance" slider, does not that change what you want to change?

TA4Life: "At the very least we are not slaves to the UI" | http://www.youtube.com/user/dimatularus | http://www.twitch.tv/zlo_rd

After minimal testing I have to conclude that the <Zoom Pop Distance> does nothing for the desired result, wether at 0 or 160 it does not seem to actually effect the zoom height.

Instead what you can do is use <Select Your ACU>
Screenshot-2022-04-15-ACU.png

Comma == zoom to & select your ACU
Spacebar == select your ACU

I am in the same boat, I use the 'Go to your ACU' and the camera is instantly in the face of the ACU. You always have to zoom out to make it useful.

"UI_SelectByCategory [+add] [+nearest] [+idle] [+goto] categoryExpression\n"
        "+add :            add to current selection\n"
        "+nearest :        select only nearest unit matching category\n"
        "+idle :           select only idle units\n"
        "+inview:          select only units in the current view\n"
        "+goto:            goto the unit if it's already selected\n"

No zoom argument here, but this will work too:

ConExecute('UI_SelectByCategory +nearest +goto COMMAND')
Camera:SetZoom(zoom,seconds)

simply add:

        local cam = GetCamera('WorldCamera')
        cam:SetTargetZoom(150)
function ACUSelectCG()
    local curTime = GetSystemTimeSeconds()
    local diffTime = curTime - lastACUSelectionTime
    if diffTime > 1.0 then
        ConExecute('UI_SelectByCategory +nearest COMMAND')
    else
        ConExecute('UI_SelectByCategory +nearest +goto COMMAND')
        local cam = GetCamera('WorldCamera')
        cam:SetTargetZoom(150)
    end

    lastACUSelectionTime = curTime
end

Thanks a lot. Let me just make sure I understand:

  1. the code above, should it go into the game.pref file? I don't see those definitions Strogo listed in my game.pref file, so perhaps it goes elsewhere?
  2. if it should indeed go into the game.pref file, mine only has one instance of "goto": in the "Profile" section, under "UserKeyMap = {", it says "Backspace = 'goto_commander',". Should it go somewhere there, or am I looking in the wrong place?

Thanks again for any pointers!

@Treos

i'm really sorry for the confusion.

My comment was aimed to Jip.
"simply add" means that Jip could simply add this to the base game code inside the file "misckeyactions.lua"

You can't change this on your side without a mod, but this is the function and location we talk about:
https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/keymap/misckeyactions.lua#L196

Since this function uses the command "GetSystemTimeSeconds" its working in UI-game-state,
means it should be possible to change this with an UI mod on client side.

well, it is possible to do this with an Ui mod:

http://faforever.uveso.de/BetterACUSelectZoom-v1.zip

Its using the keybinding for "Select ACU (control group)"

Shouldn't it be 'go to ACU' instead of select ACU? I tried both keybindings without any other mod, but unfortunately it does not work for me. Am I doing something wrong?

@magge said in Possible to change ACU zoom level?:

Am I doing something wrong?

Well hard to say, what have you done?

  1. make sure you activated the mod inside the game mod manager
  2. validate that you have a keybinding for "Select ACU (control group)"
  3. press the key for "Select ACU (control group)" twice. (doublepress within 1 second)

I missed the "double press"

I think the expected behavior is just to press once 'go to ACU' and the camera has the fixed setting immediately, but thanks for your mod.

@magge
well since its a mod you can change it like you want.

    if diffTime > 1.0 then
        ConExecute('UI_SelectByCategory +nearest COMMAND')
    else
        ConExecute('UI_SelectByCategory +nearest +goto COMMAND')
        local cam = GetCamera('WorldCamera')
        cam:SetTargetZoom(150)
    end

diffTime is the time between now and the last keypress.
if diffTime > 1.0 then
so the line with "+nearest COMMAND" will be executed if you slowly press the key.
But when you press the key twice inside 1 second the other lines with SetTargetZoom will be executed.

Now, if you want this on every key press, then you can change it.

open this file inside the mod:
\Mods\BetterACUSelectZoom\hook\lua\keymap\misckeyactions.lua

delete everything in this textfile and replace it with this:

function ACUSelectCG()
    ConExecute('UI_SelectByCategory +nearest +goto COMMAND')
    local cam = GetCamera('WorldCamera')
    cam:SetTargetZoom(150)
end

save it, restart the game and try again.

@Uveso Thank you very much.

Edit after 20 days:

I thought the mod was broken after the latest patch, but the hot keys for all mods were reset, and you need to rebind them again. Just FYI, if anyone has the same problem, wondering why it does not work suddenly.

Magge is right: just make sure you bind the hotkey to "Select ACU (control group)" and not "Go to ACU". Then the mod works - thanks Uveso.