Page 1 of 2

widget request: auto dgun

Posted: 28 Jul 2009, 18:47
by ChaosMonkey
i bet some ppl already have this and arent sharing.. but wat i think would be the best widget evar is a widget which just automaticly dguns enemy units which come in range of ur com.. even air units! but there should be a button u can press on keyboard to change to auto laser rather than auto dgun for scouts and that kind of stuff. and it would be x2 more cool if it always dguns where it can hit the most units for times when big armies come at you

Re: widget request: auto dgun

Posted: 28 Jul 2009, 18:51
by SkyStar
Not exactly what your looking for but close, Dont know if it still works, either way enjoy.
Credits to Quantum.
btw, beware of team killing since it dguns at anything pretty much.

Code: Select all

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

function widget:GetInfo()
  return {
    name      = "Auto D-Gunner",
    desc      = "Gives a d-gun order on units in range.",
    author    = "quantum",
    date      = "Oct, 26, 2008",
    license   = "GNU GPL, v2 or later",
    layer     = 0,
    enabled   = true  --  loaded by default?
  }
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

local commIDs = {}
local lastAttack = 0

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

function widget:UnitCreated(unitID, unitDefID)
  if (UnitDefs[unitDefID].isCommander) then
    for _, weaponData in ipairs(UnitDefs[unitDefID].weapons) do
      local wd = WeaponDefs[weaponData.weaponDef]
      if (wd.name:lower():find"disintegrator") then
        commIDs[unitID] = wd.range
      end
    end
  end
end


function widget:UnitDestroyed(unitID)
  commIDs[unitID] = nil
end


function widget:Initialize()
  for _, unitID in ipairs(Spring.GetAllUnits()) do
    widget:UnitCreated(unitID, Spring.GetUnitDefID(unitID))
  end
end


function widget:Update(dt)
  if (Spring.GetGameSeconds() - lastAttack < 0.2) then
    return
  end
  for unitID, range in pairs(commIDs) do
    if (not Spring.GetUnitIsDead(unitID)) then
      local nearestEnemy = Spring.GetUnitNearestEnemy(unitID, range)
      if (nearestEnemy) then
        Spring.GiveOrderToUnit(unitID, CMD.DGUN, { nearestEnemy },{})
        lastAttack = Spring.GetGameSeconds();
      end
    end
  end
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Re: widget request: auto dgun

Posted: 28 Jul 2009, 19:34
by manolo_
i smell cheat

Re: widget request: auto dgun

Posted: 28 Jul 2009, 19:40
by imbaczek
you should smell the havoc of a com trying to autodgun a microed jeffy in his base.

Re: widget request: auto dgun

Posted: 28 Jul 2009, 19:45
by very_bad_soldier
You must be hatin your teammates really much if you use this. Or they will be hating you if you use it, cant decide.

Re: widget request: auto dgun

Posted: 28 Jul 2009, 19:52
by Falcrum
Stop this... cheat!

Re: widget request: auto dgun

Posted: 28 Jul 2009, 20:11
by Jazcash
Worst. Idea. Ever.

Dgun is the most awesome thing about *A Mods. The sheer awesomeness of reaping enemy troops in firey swoops as you pump annoying sounds into peoples ears is far greater than your widgets shall ever be!

Plz. Plz. Plz do not listen to this idea.

Re: widget request: auto dgun

Posted: 28 Jul 2009, 20:11
by ChaosMonkey
skystar that widget is shit! it takes 5 seconds for it to react to enemy units coming near it and it makes it so enemy can comnap u so easy because it attempts (and fails) to dgun the atlas! and it doesnt even dgun allies like u promised!

Re: widget request: auto dgun

Posted: 28 Jul 2009, 23:19
by TheFatController
Honestly, this is a "pointless decision" anyways. If a commander is surrounded by enemy units, then you have two options:
1) D-gun
2) Be stupid.

There is no downside to (2), just a micro-management issue since you have to wait until you're positive the enemies will be in range before D-gunning.

In other words, it's micro that adds nothing to the gameplay.

So, why not do it as a gadget? Obviously, BA won't do this because BA hates usability.

But for CA et al, it seems like a good idea to follow this simple logic: when a commander is attacked, it will dgun automatically.

Re: widget request: auto dgun

Posted: 29 Jul 2009, 02:23
by SkyStar
xD, all I did was dig around the forums(which you could've done on your own, considering all I did was search "auto dgun").

Considering how small the widget is you shouldn't be surprised that its very basic.
-----------
Also I meant that since this widget dguns any enemy regardless of direction or position you could dgun your own vehicle factory trying to hit a scout or something :twisted:
-----------
I don't think the widget has support for air either, Just be happy with the anti-comnap widget, which makes your com move around.
-----------
I was thinking of using this myself ---> now I know not to.:-)

Re: widget request: auto dgun

Posted: 29 Jul 2009, 07:30
by manolo_
tbh
anti com nap is the same fucking stuff >_<. and this as an gadget - NO. i want to dgun by myself, maybe scout stands infront of fusion and now the boi dguns it - SUPERB

Re: widget request: auto dgun

Posted: 29 Jul 2009, 12:02
by Jazcash
The day isn't long where AI developers starting implementing their AI into widgets so players can just watch the widget play the game for them.

That being said:

A while back, Dizekat made a nice widget which Dguns up when your com is about to get napped. This somehow vanished and I can't find it any more. Anybody mind making a shiny new one? I'll feed many cookies ofc.

Re: widget request: auto dgun

Posted: 29 Jul 2009, 14:59
by manolo_
i talked to braindamage sometimes ago and he said there will be a solution, if the host blacks the function out, that widgets could send commands. but a big problem would be that custom formation or metalmakerwidgets wouldnt work then

Re: widget request: auto dgun

Posted: 30 Jul 2009, 06:52
by Caydr
A widget to automatically use your commander's d-gun... I take it this is mostly for situations where you don't have the time to directly micro your commander. So it takes a situation where your opponent has forced you up against a wall and successfully distracted you from your commander, arguably the most important unit in the game, and neutralizes that.

I feel like you're raping my game.

Re: widget request: auto dgun

Posted: 30 Jul 2009, 06:58
by smoth
it has been around for some time man.

Re: widget request: auto dgun

Posted: 30 Jul 2009, 07:00
by Caydr
Lay off the sauce, you're creeping me out. Where's the perfect Smoth grammar? You didn't even capitalize "it".

Re: widget request: auto dgun

Posted: 30 Jul 2009, 07:10
by smoth
you should check out auto skirmish if this one bothers you...

Re: widget request: auto dgun

Posted: 30 Jul 2009, 10:30
by Beherith
smoth wrote:you should check out auto skirmish if this one bothers you...
Auto dgun will be worse than anyone competent, it doesnt even aim ahead.

Auto skirm is horrible, id rather set them on hold pos and watch them die.

Re: widget request: auto dgun

Posted: 30 Jul 2009, 15:00
by 1v0ry_k1ng
I had an excellent autodgun widget, you could specify what kind of units it would attempt to dgun and it was pretty reliable.
the main drawback was it did not compensate for moving units, and ignored the danger of dgunning enemy units

it was VERY useful just set to dgun air transports :p

Re: widget request: auto dgun

Posted: 03 Aug 2009, 10:32
by Forboding Angel
The concept of the dgun is kind of retarded anyway. It would be much more useful to remove the dgun and the pew pew laser and replace it all with a short range superpwered anni laser with a 1 sec recharge. The downside is that you lose the ability to kill lines of stuff. The upside is that you can kill low flying aircraft easily and you don't have to micro your comm.

The fact that you have to manually aim your dgun isn't really a feature...

Moreso a necessary limitation so that the AI doesn't cause you to dgun everything you own.

Even better idea. Dgun doesn't damage friendly units and fires automagically. Set com to return fire if you prefer old behavior. The fact that the dgun destroys any building wreckage is also not a feature. Cause if you're really hard up you might actually need to dgun your own factory to kill that flashtank, at the very least it would be nice to be able to reclaim the dead fac and not be totally fucked.

I just don't care for the dgun idea. It was novel in 1997, but it's just annoying now because there are so many other ways to accomplish the same thing.