Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Moderator: Moderators
Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
What I want is that when I order some group of units to Fight.. the units without weapons that is radar and jammer vehicles/kbots would follow(guard) units with the longest range.
Not that hard to do. Most likely I will do it after a while. But someone might do it more professionally.
Not that hard to do. Most likely I will do it after a while. But someone might do it more professionally.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Hell, I'd be happy if they fixed stupid radar/jammer behavior: walking into a firefight with nothing but a radar dish.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
REVENGE wrote:Hell, I'd be happy if they fixed stupid radar/jammer behavior: walking into a firefight with nothing but a radar dish.
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
iirc thats because BA jammers and radar vechs/bots have fake weapons (for whatever reason, damned if i know) this causes them to leap into the fray. id suggest putting them on hold-fire
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
what about canattack=0? i dont know if they will still be able to use radar/jammer but if they can then it would be a good idea(going to test....)Pressure Line wrote:iirc thats because BA jammers and radar vechs/bots have fake weapons (for whatever reason, damned if i know) this causes them to leap into the fray. id suggest putting them on hold-fire
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
The dummy weapons are so they'll stop when given a fight command instead of ignoring enemies and just marching forward.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
but when you use attack, they just rush in the enemy, thinking that ther radar beams can kill the enemy or somethingKDR_11k wrote:The dummy weapons are so they'll stop when given a fight command instead of ignoring enemies and just marching forward.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
I use this widget so jamers dont charge enemeis:
unit_dontmove.lua
unit_dontmove.lua
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
BTW does anyone think that this widget should work on moving order too?
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Perhaps the range of the fake weapon is too short, or an LOS weapon? If it was slightly longer than arty range, they'd park outside of arty radius of their chosen impossible target.Hoi wrote:but when you use attack, they just rush in the enemy, thinking that ther radar beams can kill the enemy or somethingKDR_11k wrote:The dummy weapons are so they'll stop when given a fight command instead of ignoring enemies and just marching forward.
I just wish there was a way to order a unit to maintain a minimum distance to target instead of a maximum one.
How about a Group Guard widget? That is, select group A and order it to guard all units in group B. They get a queue of guard orders that starts with a random unit and then continues to the next random unit in the group, so that if it dies. Wouldn't be useful for some things, but for basic radar-follow behaviour it would help - move your arty units into a group, order radars to group-guard the arties. I do this often with flakkers and my slowest units in a team, but usually I just task them all to one unit, so when it dies they all get lost.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Well I ain't signing for that!Pxtl wrote: How about a Group Guard widget? That is, select group A and order it to guard all units in group B. They get a queue of guard orders that starts with a random unit and then continues to the next random unit in the group, so that if it dies. Wouldn't be useful for some things, but for basic radar-follow behaviour it would help - move your arty units into a group, order radars to group-guard the arties. I do this often with flakkers and my slowest units in a team, but usually I just task them all to one unit, so when it dies they all get lost.

[EDIT] Though your idea actually isn't that hard to implement.

Last edited by Pendrokar on 17 Jul 2008, 17:23, edited 1 time in total.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Retreat + Autoretreat widgets in CA. Radar and jammer vehicles are automatically set to retreat at 90% health. If something dents them, they turn and run home.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
fail they die before they retreatedCarRepairer wrote:Retreat + Autoretreat widgets in CA. Radar and jammer vehicles are automatically set to retreat at 90% health. If something dents them, they turn and run home.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
This is how far I've gotten (non-Group Guard version)-
Problems - Well it kinda works except that queue commands dont! So the offensive units just move on with the last command.
And the radars and jammers will stop if the unit they follow dies. (just haven't added)
Code: Select all
local radarunitSet = {}
local jammerunitSet = {}
local unitArray = {}
unitArray["radarunitArray"] = {
--radar units
-----BA-----
"armseer",
"armmark",
"corvrad",
"corvoyr",}
unitArray["jammerunitArray"] = {
--jammer units
-----BA-----
"armaser",
"coreter",
"arm_jammer",
"core_spectre",
"armsjam",
"corsjam",}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:Initialize()
if Spring.GetSpectatingState() or Spring.IsReplay() then
widgetHandler:RemoveWidget()
return true
end
for i, v in pairs(unitArray["radarunitArray"]) do
radarunitSet[v] = true
end
for i, v in pairs(unitArray["jammerunitArray"]) do
jammerunitSet[v] = true
end
end
function widget:CommandNotify(commandID, params, options)
local selUnits = Spring.GetSelectedUnits()
local count = #selUnits
table.foreachi(options,Spring.Echo)
if (count>1) and (commandID == CMD.FIGHT) then
local radarunittable = {}
local jammerunittable = {}
local offensiveunittable = {}
local countradars = 0
local countjammers = 0
local countoffensive = 0
for k,unitID in pairs(selUnits) do
local udef = Spring.GetUnitDefID(unitID)
local ud = UnitDefs[udef]
if (ud ~=nil) and (radarunitSet[ud.name]) then
--radar unit
countradars = countradars + 1
radarunittable[countradars] = unitID
elseif (ud ~=nil) and (jammerunitSet[ud.name]) then
--jammer unit
countjammers = countjammers + 1
jammerunittable[countjammers] = unitID
elseif (ud ~= nil) then
--other unit
local wd = ud.weapons[1]
if (wd ~= nil) then
local weaponDefID = wd.weaponDef
if (weaponDefID ~= nil) then
--offensive unit
if (WeaponDefs[weaponDefID].range ~= nil) then
table.insert(offensiveunittable,{ unitID, WeaponDefs[weaponDefID].range })
--Spring.Echo("U:",unitID,WeaponDefs[weaponDefID].range)
end
countoffensive = countoffensive + 1
end
end
end
end
if((countradars ~= 0) or (countjammers ~= 0)) and (countoffensive ~= 0) then
local aradar = 1
local ajammer = 1
table.sort(offensiveunittable, compRanges) --reversed sorting, compRanges is a function
for i in ipairs(offensiveunittable) do
unitID = offensiveunittable[i][1]
range = offensiveunittable[i][2]
if(aradar<countradars+1) then
Spring.GiveOrderToUnit(radarunittable[aradar], CMD.GUARD, {unitID},options)
--Spring.Echo("R",radarunittable[aradar], unitID)
aradar = aradar + 1
end
if(ajammer<countjammers+1) then
Spring.GiveOrderToUnit(jammerunittable[ajammer], CMD.GUARD, {unitID},options)
--Spring.Echo("J",jammerunittable[ajammer], unitID)
ajammer = ajammer + 1
end
-- issue called command
Spring.GiveOrderToUnit(unitID, commandID, params, options) -- for offensive units to move on with their order
-- if radars and jammers are more than offensive units they will still go forth with fight order
end
-- Override command issue process
return true
end
end
return false
end
function compRanges(a,b)
return a[2] > b[2]
end
And the radars and jammers will stop if the unit they follow dies. (just haven't added)
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
@pendrokar
i might be wrong, but if you just add canattack=0 to the radars/jammers fbi they wont attack but wait, however this is a solution that creates other problems it would be best if the jammers stay in jamming range but dont attack and the radars in x radar range
i might be wrong, but if you just add canattack=0 to the radars/jammers fbi they wont attack but wait, however this is a solution that creates other problems it would be best if the jammers stay in jamming range but dont attack and the radars in x radar range
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Im not a dev of either BA, CA or NOTA(doubt other mods have set radars and jammers like that). So I'm the wrong person to whom you should say that. The radar and jammer guarding issue is a mods issue.Hoi wrote:@pendrokar
i might be wrong, but if you just add canattack=0 to the radars/jammers fbi they wont attack but wait, however this is a solution that creates other problems it would be best if the jammers stay in jamming range but dont attack and the radars in x radar range
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
i was just suggesting and if it would work i will ask the mod devs to add itPendrokar wrote:Im not a dev of either BA, CA or NOTA(doubt other mods have set radars and jammers like that). So I'm the wrong person to whom you should say that. The radar and jammer guarding issue is a mods issue.Hoi wrote:@pendrokar
i might be wrong, but if you just add canattack=0 to the radars/jammers fbi they wont attack but wait, however this is a solution that creates other problems it would be best if the jammers stay in jamming range but dont attack and the radars in x radar range
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Fake weapons on radar units are leftovers from OTA times. Back then the AI didn't know how to use radar units, so they were often given a fake long-range weapon by modders to make the AI bring them closer to battle.
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
Ok I uploaded a 0.8 version at Spring Job Jol.
- http://spring.jobjol.nl/show_file.php?id=1294
- http://spring.jobjol.nl/show_file.php?id=1294
When ordering a group of units to fight, Any specified in the widget mobile radars or jammers will guard units that have the
longest range. If radars or jammers are more than other units then those will still go with the fight order,
Improvements
needed:
1) After having the Fight order pressed with shift the Fight cursor will change to Move! Need to fix
2) Radars and
Jammers to follow closest units that have the longest range. Right now they will guard a random unit withing the unit range
sort(Means even if there is a unit with the longest range in the group close to a radar unit the radar unit may guard some
other unit).
Re: Widget Request/(later)Reveal: Radar&Jammer vehicle follow.
2) issue fixed. Though the offensive units are the ones making decisions of which closest radar/jammer to take!
- http://spring.jobjol.nl/show_file.php?id=1294
- http://spring.jobjol.nl/show_file.php?id=1294
When ordering a group of units to fight, Any specified in the widget mobile radars or jammers will guard units that have the
longest range. If radars or jammers are more than other units then those will still go with the fight order,
Improvements needed:
1) After having the Fight order pressed with shift the Fight cursor will change to Move! Need to fix