C Request for modification unit selection. Ineed HELP
-
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. -
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
-
@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.
-
@FreadyFish your double click won't distinct between click and drag select.
-
This post is deleted! -
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.
-
@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