Is there a widget that shows the range of all allied and enemy units at all times? Possibly in different colors? :D
If not, how difficult would it be to make something like this? (I know nothing about lua)
[Request] Range widget
Moderator: Moderators
Re: [Request] Range widget
There is one that shows the range of defenses which is bundled in a few of the *A modifications. I believe there is another for all units, but it may have just been a proof of concept.
Re: [Request] Range widget
Yeah, I have that one. I'm just thinking something that will make microing outside of range of mobile units a little more convenient, without holding shift and mousing over the enemy constantly.Neddie wrote:There is one that shows the range of defenses which is bundled in a few of the *A modifications. I believe there is another for all units, but it may have just been a proof of concept.
Re: [Request] Range widget
Thanks, that's at least part of what I was looking for
Re: [Request] Range widget
Here's a basic one for radar and jammer range:
Code: Select all
function widget:GetInfo()
return {
name = "Radar Ranges",
desc = "Draws radar ranges on the map when radar units are selected.",
author = "AF",
date = "28/07/2007",
license = "GNU GPL, v2 or later",
layer = 5,
enabled = true -- loaded by default?
}
end
function widget:DrawWorldPreUnit()
local units = Spring.GetSelectedUnits()
gl.LineWidth(5)
for _,uid in ipairs(Spring.GetSelectedUnits()) do
-- for _,uid in pairs(units) do
local udid = Spring.GetUnitDefID(uid)
local ud = udid and UnitDefs[udid] or nil
if (ud and (ud.radarRadius > 400)) then
gl.Color(0.5, 0.5, 1, 0.5)
local x, y, z = Spring.GetUnitBasePosition(uid)
if (x) then
gl.DrawGroundCircle(x, y, z, ud.radarRadius, 128)
end
end
if (ud and (ud.jammerRadius > 200)) then
gl.Color(1, 0, 0, 0.5)
local x, y, z = Spring.GetUnitBasePosition(uid)
if (x) then
gl.DrawGroundCircle(x, y, z, ud.jammerRadius, 128)
end
end
end
gl.LineWidth(1)
end
Re: [Request] Range widget
AF wrote:Here's a basic one for radar and jammer range:
Code: Select all
function widget:GetInfo() return { name = "Radar Ranges", desc = "Draws radar ranges on the map when radar units are selected.", author = "AF", date = "28/07/2007", license = "GNU GPL, v2 or later", layer = 5, enabled = true -- loaded by default? } end function widget:DrawWorldPreUnit() local units = Spring.GetSelectedUnits() gl.LineWidth(5) for _,uid in ipairs(Spring.GetSelectedUnits()) do -- for _,uid in pairs(units) do local udid = Spring.GetUnitDefID(uid) local ud = udid and UnitDefs[udid] or nil if (ud and (ud.radarRadius > 400)) then gl.Color(0.5, 0.5, 1, 0.5) local x, y, z = Spring.GetUnitBasePosition(uid) if (x) then gl.DrawGroundCircle(x, y, z, ud.radarRadius, 128) end end if (ud and (ud.jammerRadius > 200)) then gl.Color(1, 0, 0, 0.5) local x, y, z = Spring.GetUnitBasePosition(uid) if (x) then gl.DrawGroundCircle(x, y, z, ud.jammerRadius, 128) end end end gl.LineWidth(1) end
I usually play with the radar overlay on, except late game when it lowers my fps too much, so I don't really need this. Thanks anyway though. Maybe I should learn lua...