• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login
FAForever Forums
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login

C Request for modification unit selection. Ineed HELP

Scheduled Pinned Locked Moved Modding & Tools
7 Posts 3 Posters 305 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    bronedooy
    last edited by bronedooy 12 Jan 2024, 14:35 6 Nov 2024, 00:52

    Hi '_' Need a help.
    I have been looking for a simple solution for managing engineers for a long time. The main thing is to assign the E key to select the T3 engineer, located next to the cursor. And press Ctrl E so that you can add the next T3 next to the highlighted ones. And by pressing Shift -E, add all t3 engineers to the SCREEN.
    Well, yes, this can be applied to T1, T2, SAC engineers and combat engineers, drones, if possible (does the standard key work on the entire map, and not in the screen?
    And I still haven't found how to highlight objects similar to those that are highlighted ONLY on the screen. Not being able to program is baffling.

    1 Reply Last reply Reply Quote 1
    • F Offline
      FreadyFish Global Moderator
      last edited by FreadyFish 11 Jun 2024, 13:53 6 Nov 2024, 13:44

      What are the disturbing issues?

      Here is some code (for the curious) I wrote (borrowed a lot of it) a while back. It selects similar units on screen with one click, and with double click it selects the rest on the whole map. Can easily be adjusted to select a specific category, like your T3 engineers, and to select the closest one.

      I have to look into the adding to the selection of 1 more per click (as I understand you want it to work), but I will get back to you.

      Feel free to fill in if I am missing some details meanwhile.

      -- MultiSelect (click multiple time to extend selection. Eg: Nearest / OnScreen / All)
      local lastClickMultiSelect = -9999
      local totalClicksMultiSelect = 0
      local lastMultiClickUniqueString = nil
      
      local function IsDoubleClick(uniqueString, currentTick, lastClickMultiSelect)
      	return lastMultiClickUniqueString == uniqueString and currentTick < lastClickMultiSelect + 5
      end
      
      local function SetClickData(uniqueString, currentTick)
      	lastMultiClickUniqueString = uniqueString
      	totalClicksMultiSelect = totalClicksMultiSelect + 1
      	lastClickMultiSelect = currentTick
      end
      
      local similarUnitsBlueprints = {}
      function MultiSelectSimilarUnits()
      	local uniqueString = "MultiSelectSimilarUnits"
      	local currentTick = GameTick()
      
      	local str = ''
      	if IsDoubleClick(uniqueString, currentTick, lastClickMultiSelect) then
      		if totalClicksMultiSelect == 1 then
      
      			similarUnitsBlueprints.foreach(function(k,v) str = str .. v.BlueprintId .. "," end)
      
      			ConExecute("Ui_SelectByCategory " .. str .. "SOMETHINGUNPOSSIBLE") -- dodgy hack at the end there to
      
      		end
      	else
      		local units = GetSelectedUnits()
      		if (units ~= nil) then
      			similarUnitsBlueprints = from(units).select(function(k, u) return u:GetBlueprint(); end).distinct()
      
      			similarUnitsBlueprints.foreach(function(k,v) str = str .. "+inview " .. v.BlueprintId .. "," end)
      
      			ConExecute("Ui_SelectByCategory " .. str .. "SOMETHINGUNPOSSIBLE") -- dodgy hack at the end there to
      
      			totalClicksMultiSelect = 0
      		else
      			lastClickMultiSelect = -9999
      		end
      	end
      
      	SetClickData(uniqueString, currentTick)
      end
      
      
      B C 2 Replies Last reply 6 Nov 2024, 15:07 Reply Quote 1
      • B Offline
        bronedooy @FreadyFish
        last edited by bronedooy 11 Jun 2024, 17:10 6 Nov 2024, 15:07

        @FreadyFish Thank you for the connection, you opened the "Found about mod" section, I wrote there. I am a proponent of using simple methods, it is better not to violate the standard method of selecting units, in critical situations it will not let you down, so perhaps this will suit an amateur when you make a full-fledged mod. To be honest, I'm a lamer, I need to know the basics of creating a mod and the subtleties of its compliance with faf requirements. Not to mention working with the code. I am very grateful to you for your response. I will be in touch, of course, in the section of your foundation, it seems to me that there is not much point in having a dialogue in 2 branches.

        1 Reply Last reply Reply Quote 0
        • C Offline
          Ctrl-K @FreadyFish
          last edited by Ctrl-K 11 Jun 2024, 17:29 6 Nov 2024, 17:28

          @FreadyFish your double click won't distinct between click and drag select.

          “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
          — Steve Jobs.
          My UI Mods
          Support me

          F 1 Reply Last reply 6 Nov 2024, 20:00 Reply Quote 0
          • B Offline
            bronedooy
            last edited by 6 Nov 2024, 17:59

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • B Offline
              bronedooy
              last edited by 6 Nov 2024, 18:02

              A samurai has no goal, but there is a way. I'll do that then, I'll try to apply the code, maybe I'll learn something new. But it's not 100%. Are you by any chance a Ru player? I am from Uzbekistan myself, at least I know Russian.

              1 Reply Last reply Reply Quote 0
              • F Offline
                FreadyFish Global Moderator @Ctrl-K
                last edited by 6 Nov 2024, 20:00

                @Ctrl-K Never had that problem but I suppose you are right, thanks!

                @bronedooy It is great if you want to try! If you want to learn I will gladly guide you but I will also help you actually finish it. Feel free to send me a DM if you have specific questions

                Not russian, I only know a few words (za zdarovye!) Your English is fine but if I miss something let me know

                You are right btw, lets continue in the wish-a-mod topic. I will update it soon with a proper reply

                https://forum.faforever.com/topic/8368/wish-a-mod-foundation

                1 Reply Last reply Reply Quote 1
                6 out of 7
                • First post
                  6/7
                  Last post