UI Modding question

Talk about anything not related to FA or FAF here !

UI Modding question

Postby johnie102 » 05 Apr 2013, 19:31

Hey everyone,

I'm trying to create a UI mod where I press a certain key and it selects all the idle engineers currently on screen. I have zero experience modding this game and nil experience with LUA, and this was what I could come up with:

Code: Select all
UISelectionByCategory("ENGINEER", false, true, true, true) -- select the engineer on screen closest to the mouse
Ui_EXpandCurrentSelection() -- select all the engineers on screen
UI_MakeSelectionSet("temp") -- name this selection

local unitlist = {}
for index, unit in selectionSets["temp"] do -- for every engineer...
   if unit:IsIdle() then -- if it is idle....
      table.insert(unitlist,unit) -- save it in a new list
   end
end

AddSelectionSet("temp", unitlist) -- Renew the selection with this new unit list
ApplySelectionSet("temp") -- Make this the active selection

-- SelectUnits(unitlist) Or should I use this function?


Now, my question is: Would this work? And in which function would I have to put it to make it activate by a hotkey? Is there also an easy way to make this hotkey configurable in the controls menu?

Lastly: My first idea was that I could drag a selection box while holding a certain key and that it would then only select the idle engineers, but this seems way harder to do. Any help with this maybe?

Thanks for the help!
-John

BTW: Is this the appropriate forum for this?
johnie102
Avatar-of-War
 
Posts: 128
Joined: 27 Dec 2012, 22:26
Has liked: 0 time
Been liked: 2 times
FAF User Name: johnie102

Re: UI Modding question

Postby Zock » 05 Apr 2013, 19:33

You don't need a UI mod for that, there is such a hotkey in the game, but its unassigned by default. I think you need GAZ_UI to change it, if not i'd get it anyway. :) Then just F1 -> Change Keybindings.
gg no re

ohh! what a pretty shining link! https://www.youtube.com/c/Zockyzock
User avatar
Zock
Supreme Commander
 
Posts: 1395
Joined: 31 Aug 2011, 22:44
Has liked: 173 times
Been liked: 397 times
FAF User Name: Zock

Re: UI Modding question

Postby johnie102 » 05 Apr 2013, 21:12

Wow, yeah, there is actually a binding for that. Didn't know they went that specific. There's also a binding for 'Select nearest idle lowest tech mass extractor'. That is going to come in handy!
johnie102
Avatar-of-War
 
Posts: 128
Joined: 27 Dec 2012, 22:26
Has liked: 0 time
Been liked: 2 times
FAF User Name: johnie102


Return to Off-Topic

Who is online

Users browsing this forum: No registered users and 1 guest