Page 1 of 1
[Request] Range widget
Posted: 01 Jun 2010, 00:25
by Hobo Joe
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)
Re: [Request] Range widget
Posted: 01 Jun 2010, 08:08
by Neddie
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
Posted: 01 Jun 2010, 11:16
by Jazcash
Defense Range by VBS?
Re: [Request] Range widget
Posted: 01 Jun 2010, 15:30
by Hobo Joe
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.
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.
Re: [Request] Range widget
Posted: 01 Jun 2010, 16:05
by luckywaldo7
Re: [Request] Range widget
Posted: 01 Jun 2010, 18:18
by manolo_
also at SD
Re: [Request] Range widget
Posted: 02 Jun 2010, 01:41
by Hobo Joe
Thanks, that's at least part of what I was looking for
Re: [Request] Range widget
Posted: 04 Jun 2010, 16:49
by AF
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
Posted: 05 Jun 2010, 02:30
by Hobo Joe
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...