widget request: auto dgun

widget request: auto dgun

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
ChaosMonkey
Posts: 180
Joined: 06 Jul 2009, 21:21

widget request: auto dgun

Post 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
SkyStar
Engines Of War Developer
Posts: 23
Joined: 08 Jul 2009, 15:05

Re: widget request: auto dgun

Post 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

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: widget request: auto dgun

Post by manolo_ »

i smell cheat
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: widget request: auto dgun

Post by imbaczek »

you should smell the havoc of a com trying to autodgun a microed jeffy in his base.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: widget request: auto dgun

Post 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.
User avatar
Falcrum
Posts: 149
Joined: 14 Nov 2007, 01:03

Re: widget request: auto dgun

Post by Falcrum »

Stop this... cheat!
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: widget request: auto dgun

Post 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.
User avatar
ChaosMonkey
Posts: 180
Joined: 06 Jul 2009, 21:21

Re: widget request: auto dgun

Post 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!
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: widget request: auto dgun

Post 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.
SkyStar
Engines Of War Developer
Posts: 23
Joined: 08 Jul 2009, 15:05

Re: widget request: auto dgun

Post 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.:-)
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: widget request: auto dgun

Post 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
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: widget request: auto dgun

Post 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.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: widget request: auto dgun

Post 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
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: widget request: auto dgun

Post 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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: widget request: auto dgun

Post by smoth »

it has been around for some time man.
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: widget request: auto dgun

Post by Caydr »

Lay off the sauce, you're creeping me out. Where's the perfect Smoth grammar? You didn't even capitalize "it".
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: widget request: auto dgun

Post by smoth »

you should check out auto skirmish if this one bothers you...
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: widget request: auto dgun

Post 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.
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Re: widget request: auto dgun

Post 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
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: widget request: auto dgun

Post 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.
Post Reply

Return to “Lua Scripts”