Page 2 of 2

Posted: 18 Oct 2007, 14:06
by AF
Firstly:

Yes you can pause builders but you cant pause construction. If I pause a builder after a few seconds the building half done starts loosing health as if it has no builder. So its not true pause.

And this widget could help AIs in some mods by being converted into an AI unit only gadget.

Posted: 19 Oct 2007, 01:01
by LordMatt
Masure wrote:
LordMatt wrote:Hmm dunno how I feel about this widget, but I'll try it out anyways. :P Does it stop things from building even if you have a lot of e though?
Yeah there is no smart E excess control.

I think D-Gun unstall is an emergency behaviour, no matter if you waste E for 10s.

That would be great to control E smarter but, harder to dev.
So, to clarify because I am potentially dumb: It stops all your building for 10s every time you dgun? That doesn't seem terribly useful to me.

Posted: 19 Oct 2007, 01:25
by lurker
LordMatt wrote:So, to clarify because I am potentially dumb: It stops all your building for 10s every time you dgun? That doesn't seem terribly useful to me.
And turns off all metalmakers. And you can set it to something like 2-3 seconds.

Posted: 19 Oct 2007, 01:28
by Masure
You can turn this off by setting 0 to hysteresis parameter.

Posted: 19 Oct 2007, 02:02
by 1v0ry_k1ng
LordMatt wrote: That doesn't seem terribly useful to me.
are you nuts?

Posted: 19 Oct 2007, 02:37
by LordMatt
I don't really want all my construction stopped every time I dgun. I don't stall while dgunning very often (and often stop factories anyway if I'm in danger of stalling when I see the units coming).

Posted: 19 Oct 2007, 14:03
by Satirik
it stops construction if you don't have 600e to dgun ... and it stops 10s but if you get 600e before it reactivates the cons

when the dgun unstall detect a dgun it does the same as the metal makers but try to always have more than 600e and stop everything that use e

Posted: 19 Oct 2007, 17:55
by rattle
Does it use hardcoded values?

Posted: 20 Oct 2007, 19:02
by Masure
No you can edit he lua script with the value you want (hysteresis, energyaim)

Posted: 20 Oct 2007, 22:28
by rattle
So it is hardcoded, it doesn't calculate the value.

Posted: 22 Oct 2007, 13:40
by Masure
D-Gun energy cost is a known value so there is no need to make it in a different way.

Posted: 22 Oct 2007, 14:23
by rattle
So each mod uses 600 energy for their D-Gun, it they happen to have one?

Posted: 22 Oct 2007, 16:41
by Masure
I'll try to use the weapondef to dynamically read the dgun energy cost.

Re: D-Gun unstall widget

Posted: 31 Jul 2008, 17:36
by FrOzEnTaCo
lurker wrote:
Masure wrote:sets builders and factories to wait
You can do whatnow? :shock:

press the ''w'' key to make a factory or building ''wait''. it will pause everything. press the ''w'' key again to unpause it. if you hold shift, you will see a ''wait'' icon indicating that the building or builder is paused

Re: D-Gun unstall widget

Posted: 31 Jul 2008, 21:48
by Beherith
I hate necroing threads, but currently the dgun unstall widget only works if you do a /luaui reload or an f11+remove+add widget. I was trying to find a workaround to this by making it look for the commander, but the widget still fails unless reloaded:

Code: Select all

	for _, comID in ipairs(coms) do
		Spring.Echo("parsing for dgun order")
		bDgunOrder = findCmdId(comID, CMD.DGUN)
		
		if bDgunOrder then
			break
		end 
	end
I have added in game (after 5 secs of ingame time) commander detection, then it manages to detect a comm, but the parsing line never gets called unless the widget is reloaded.

Re: D-Gun unstall widget

Posted: 01 Aug 2008, 12:01
by Masure
Hi Beherith,

I haven't used/modified this widget since its release (which version of Spring and BA > I don't know). Shame on me cause it wasn't far from being fully operational.

However I'm surprised cause as far as I remember, I never had issues with Com detection. The only issue I remember was the "de-waiting" of a unit type (metal maker I think).

Maybe the issue you're talking about appeared in our current releases of Spring and BA. I'll give it a look.

No matter you necroed that thread, It's cool indeed.

Re: D-Gun unstall widget

Posted: 01 Aug 2008, 12:19
by Masure

Code: Select all

function widget:Initialize()
  local _, _, spec = Spring.GetPlayerInfo(MyTeamId)
  if spec then
    widgetHandler:RemoveWidget()
    return false
  end
  local units = Spring.GetTeamUnits(MyTeamId)
  for _,UID in ipairs(units) do
  
    local UDID = Spring.GetUnitDefID(UID)
    local UD = UnitDefs[UDID]
	
	if (UD == nil) then break end
    if (UD.TEDClass == "COMMANDER") then
	  table.insert(coms,UID)
    end
  end

end


function widget:UnitCreated(unitID, unitDefID, unitTeam)
  local UD
  UD = UnitDefs[unitDefID]
  if (UD.TEDClass == "COMMANDER") then
	table.insert(coms,UID)
  end
end

function widget:UnitGiven(unitID, unitDefID, unitTeam)
  local UD
  UD = UnitDefs[unitDefID]
  if (UD.TEDClass == "COMMANDER") then
	table.insert(coms,UID)
  end
end

function widget:UnitDestroyed(unitID, unitDefID, unitTeam)
	for comIndex,comID in ipairs(coms) do
      if (unitID == comID) then
        table.remove(coms,comIndex)
        break
      end
    end
end

function widget:UnitTaken(unitID, unitDefID, unitTeam)
	for comIndex,comID in ipairs(coms) do
      if (unitID == comID) then
        table.remove(coms,comIndex)
        break
      end
    end
end
Here is the code that should keep the coms array updated. As I said, this worked at the time of the widget release. I won't have time this evening but I'll have some in the week end.

Stay tuned :D

Re: D-Gun unstall widget

Posted: 02 Aug 2008, 04:56
by REVENGE
I used this widget for a little bit, but I have some ideas for seriously improving it.

Allow players to set a minimum energy level that economic units will simply not violate. I'll illustrate this with an example:

I drag a slider on my energy bar (similar to the one that autoshares) up to 500. As soon as my energy decreases to that point, my buildings and units currently under construction would "stall" like they do normally, but I will still have that 500 energy below my slider left untouched. That 500 e can only be accessed by weapons fire, and e will be prioritized to charge up to 500 before construction can resume.

So, it's sortof like setting a new bottom line for your stall point. Everything having to do with construction and metal maker usage will use that point as the bottom line, while your weapons and such can still dip into your reserves in order to fire. This way, even early ingame, I can ensure that my dgun will be able to fire at least once upon command, and I won't have to wait for energy to charge up.