Possible to change ACU zoom level?

"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.